From 363a1911db415e3f6e5ed02ccf837af93613e1e8 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 17 Jun 2020 19:03:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E9=83=A8=E7=AE=A1=E7=90=86v1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tools/exception/EpmetErrorCode.java | 2 +-
epmet-module/gov-grid/gov-grid-client/pom.xml | 6 ++
.../epmet/dto/form/DeleteBranchFormDTO.java | 20 +++++
.../epmet/dto/form/PartyBranchAddFormDTO.java | 51 +++++++++++
.../dto/form/PartyBranchEditFormDTO.java | 40 +++++++++
.../dto/form/PartyBranchListFormDTO.java | 29 ++++++
.../dto/result/PartyBranchAddResultDTO.java | 20 +++++
.../dto/result/PartyBranchListResultDTO.java | 24 +++++
.../PartyBranchManageController.java | 88 ++++++++++++++++++
.../service/PartyBranchManageService.java | 54 +++++++++++
.../impl/PartyBranchManageServiceImpl.java | 89 +++++++++++++++++++
.../dto/form/ListPartyBranchFormDTO.java | 29 ++++++
.../dto/result/ListPartyBranchResultDTO.java | 24 +++++
.../epmet/feign/GovOrgOpenFeignClient.java | 72 ++++++++++++---
.../GovOrgOpenFeignClientFallback.java | 30 +++++++
.../CustomerPartyBranchController.java | 39 ++++++--
.../com/epmet/dao/CustomerPartyBranchDao.java | 7 +-
.../service/CustomerPartyBranchService.java | 13 ++-
.../impl/CustomerPartyBranchServiceImpl.java | 12 ++-
.../mapper/CustomerPartyBranchDao.xml | 16 +++-
20 files changed, 642 insertions(+), 23 deletions(-)
create mode 100644 epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/DeleteBranchFormDTO.java
create mode 100644 epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchAddFormDTO.java
create mode 100644 epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchEditFormDTO.java
create mode 100644 epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchListFormDTO.java
create mode 100644 epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchAddResultDTO.java
create mode 100644 epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchListResultDTO.java
create mode 100644 epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/PartyBranchManageController.java
create mode 100644 epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/PartyBranchManageService.java
create mode 100644 epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/PartyBranchManageServiceImpl.java
create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListPartyBranchFormDTO.java
create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ListPartyBranchResultDTO.java
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 04aabbf38f..e9828f104f 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
@@ -38,7 +38,7 @@ public enum EpmetErrorCode {
MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"),
NOT_DEL_GRID(8106,"该网格存在工作人员,不允许删除"),
ORG_IS_NOT_NULL(8107,"党组织关系不能为空"),
-
+ CANNOT_DELETE_PARTYB_RANCH(8108,"当前支部存在党员,不允许删除"),
CANNOT_AUDIT_WARM(8201, "请完善居民信息"),
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),
NOT_DEL_AGENCY_PER(8205, "该机关存在工作人员,不允许删除"),
diff --git a/epmet-module/gov-grid/gov-grid-client/pom.xml b/epmet-module/gov-grid/gov-grid-client/pom.xml
index 297cb07121..5c477c501f 100644
--- a/epmet-module/gov-grid/gov-grid-client/pom.xml
+++ b/epmet-module/gov-grid/gov-grid-client/pom.xml
@@ -19,6 +19,12 @@
org.projectlombok
lombok
+
+ com.epmet
+ epmet-commons-tools
+ 2.0.0
+ compile
+
diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/DeleteBranchFormDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/DeleteBranchFormDTO.java
new file mode 100644
index 0000000000..0e3e5f5ea2
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/DeleteBranchFormDTO.java
@@ -0,0 +1,20 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 17:02
+ */
+@Data
+public class DeleteBranchFormDTO implements Serializable {
+ private static final long serialVersionUID = 5321430865413383354L;
+
+ @NotBlank(message = "党支部id不能为空")
+ private String partyBranchId;
+}
diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchAddFormDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchAddFormDTO.java
new file mode 100644
index 0000000000..29ac589a4f
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchAddFormDTO.java
@@ -0,0 +1,51 @@
+package com.epmet.dto.form;
+
+import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
+import lombok.Data;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 添加党支部入参DTO
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 12:35
+ */
+@Data
+public class PartyBranchAddFormDTO implements Serializable {
+ private static final long serialVersionUID = -8102877381223078842L;
+
+ public interface AddUserInternalGroup {
+ }
+
+ public interface AddUserShowGroup extends CustomerClientShowGroup {
+ }
+
+ /**
+ * 客户id
+ */
+ @NotBlank(message = "客户id不能为空", groups = {AddUserInternalGroup.class})
+ private String customerId;
+
+ /**
+ * 网格id
+ */
+ @NotBlank(message = "网格id不能为空", groups = {AddUserInternalGroup.class})
+ private String gridId;
+
+ /**
+ * 党支部名称
+ */
+ @NotBlank(message = "请输入支部名称", groups = {AddUserShowGroup.class})
+ @Length(max = 20, message = "支部名称不能超过20个字", groups = AddUserShowGroup.class)
+ private String partyBranchName;
+
+ /**
+ * 党支部概要信息
+ */
+ @NotBlank(message = "请输入支部概要信息", groups = {AddUserShowGroup.class})
+ @Length(max = 500, message = "支部概要信息不能超过500个字", groups = AddUserShowGroup.class)
+ private String profile;
+}
diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchEditFormDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchEditFormDTO.java
new file mode 100644
index 0000000000..d4f03416a6
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchEditFormDTO.java
@@ -0,0 +1,40 @@
+package com.epmet.dto.form;
+
+import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
+import lombok.Data;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 修改党支部信息入参DTO
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 14:00
+ */
+@Data
+public class PartyBranchEditFormDTO implements Serializable {
+ private static final long serialVersionUID = -6739109166420798965L;
+ public interface AddUserInternalGroup {
+ }
+
+ public interface AddUserShowGroup extends CustomerClientShowGroup {
+ }
+
+ @NotBlank(message = "党支部id不能为空", groups = {AddUserInternalGroup.class})
+ private String partyBranchId;
+ /**
+ * 党支部名称
+ */
+ @NotBlank(message = "请输入支部名称", groups = {AddUserShowGroup.class})
+ @Length(max = 20, message = "支部名称不能超过20个字", groups = AddUserShowGroup.class)
+ private String partyBranchName;
+
+ /**
+ * 党支部概要信息
+ */
+ @NotBlank(message = "请输入支部概要信息", groups = {AddUserShowGroup.class})
+ @Length(max = 500, message = "支部概要信息不能超过500个字", groups = AddUserShowGroup.class)
+ private String profile;
+}
diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchListFormDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchListFormDTO.java
new file mode 100644
index 0000000000..5f1c8681e4
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/PartyBranchListFormDTO.java
@@ -0,0 +1,29 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 3、党支部列表查询入参DTO
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 16:11
+ */
+@Data
+public class PartyBranchListFormDTO implements Serializable {
+ public interface AddUserInternalGroup {
+ }
+ /**
+ * 客户id
+ */
+ @NotBlank(message = "客户id不能为空", groups = {PartyBranchListFormDTO.AddUserInternalGroup.class})
+ private String customerId;
+
+ /**
+ * 网格id
+ */
+ @NotBlank(message = "网格id不能为空", groups = {PartyBranchListFormDTO.AddUserInternalGroup.class})
+ private String gridId;
+}
diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchAddResultDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchAddResultDTO.java
new file mode 100644
index 0000000000..a959eb8e1a
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchAddResultDTO.java
@@ -0,0 +1,20 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 添加党支部返参DTO
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 12:45
+ */
+@Data
+public class PartyBranchAddResultDTO implements Serializable {
+ private static final long serialVersionUID = 5610858988982913682L;
+ /**
+ * 党支部id
+ */
+ private String partyBranchId;
+}
diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchListResultDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchListResultDTO.java
new file mode 100644
index 0000000000..01920b0819
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/PartyBranchListResultDTO.java
@@ -0,0 +1,24 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 3、党支部列表查询返参DTO
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 16:13
+ */
+@Data
+public class PartyBranchListResultDTO implements Serializable {
+ private static final long serialVersionUID = 8342529186641647970L;
+ /**
+ * 支部id
+ */
+ private String partyBranchId;
+ /**
+ * 支部名称
+ */
+ private String partyBranchName;
+}
diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/PartyBranchManageController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/PartyBranchManageController.java
new file mode 100644
index 0000000000..edb06910f7
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/PartyBranchManageController.java
@@ -0,0 +1,88 @@
+package com.epmet.controller;
+
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.dto.form.DeleteBranchFormDTO;
+import com.epmet.dto.form.PartyBranchAddFormDTO;
+import com.epmet.dto.form.PartyBranchEditFormDTO;
+import com.epmet.dto.form.PartyBranchListFormDTO;
+import com.epmet.dto.result.PartyBranchAddResultDTO;
+import com.epmet.dto.result.PartyBranchListResultDTO;
+import com.epmet.service.PartyBranchManageService;
+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;
+
+import java.util.List;
+
+/**
+ * 基层治理-支部管理
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 12:25
+ */
+@RestController
+@RequestMapping("partybranch")
+public class PartyBranchManageController {
+ @Autowired
+ private PartyBranchManageService partyBranchManageService;
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 添加党支部
+ * @Date 2020/6/17 12:47
+ **/
+ @PostMapping("add")
+ public Result addPartyBranch(@RequestBody PartyBranchAddFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, PartyBranchAddFormDTO.AddUserShowGroup.class, PartyBranchAddFormDTO.AddUserInternalGroup.class);
+ PartyBranchAddResultDTO partyBranchAddResultDTO = partyBranchManageService.addPartyBranch(formDTO);
+ return new Result().ok(partyBranchAddResultDTO);
+ }
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 修改党支部信息
+ * @Date 2020/6/17 15:31
+ **/
+ @PostMapping("edit")
+ public Result editPartyBranch(@RequestBody PartyBranchEditFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, PartyBranchEditFormDTO.AddUserShowGroup.class, PartyBranchEditFormDTO.AddUserInternalGroup.class);
+ partyBranchManageService.editPartyBranch(formDTO);
+ PartyBranchAddResultDTO partyBranchAddResultDTO = new PartyBranchAddResultDTO();
+ partyBranchAddResultDTO.setPartyBranchId(formDTO.getPartyBranchId());
+ return new Result().ok(partyBranchAddResultDTO);
+ }
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @author yinzuomei
+ * @description 党支部列表查询
+ * @Date 2020/6/17 16:15
+ **/
+ @PostMapping("list")
+ public Result> listPartyBranch(@RequestBody PartyBranchListFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, PartyBranchListFormDTO.AddUserInternalGroup.class);
+ return new Result>().ok(partyBranchManageService.listPartyBranch(formDTO));
+ }
+
+ /**
+ * @return com.epmet.commons.tools.utils.Result
+ * @param formDTO
+ * @author yinzuomei
+ * @description 删除党支部
+ * @Date 2020/6/17 18:23
+ **/
+ @PostMapping("delete")
+ public Result deleteBranch(@RequestBody DeleteBranchFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO);
+ partyBranchManageService.deleteBranch(formDTO);
+ return new Result();
+ }
+}
diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/PartyBranchManageService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/PartyBranchManageService.java
new file mode 100644
index 0000000000..dae0c060d7
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/PartyBranchManageService.java
@@ -0,0 +1,54 @@
+package com.epmet.service;
+
+import com.epmet.dto.form.DeleteBranchFormDTO;
+import com.epmet.dto.form.PartyBranchAddFormDTO;
+import com.epmet.dto.form.PartyBranchEditFormDTO;
+import com.epmet.dto.form.PartyBranchListFormDTO;
+import com.epmet.dto.result.PartyBranchAddResultDTO;
+import com.epmet.dto.result.PartyBranchListResultDTO;
+
+import java.util.List;
+
+/**
+ * 基层治理-支部管理
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 12:47
+ */
+public interface PartyBranchManageService {
+ /**
+ * @param formDTO
+ * @return com.epmet.dto.result.PartyBranchAddResultDTO
+ * @author yinzuomei
+ * @description 添加党支部
+ * @Date 2020/6/17 13:24
+ **/
+ PartyBranchAddResultDTO addPartyBranch(PartyBranchAddFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.dto.result.PartyBranchAddResultDTO
+ * @author yinzuomei
+ * @description 修改党支部信息
+ * @Date 2020/6/17 14:30
+ **/
+ void editPartyBranch(PartyBranchEditFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return java.util.List
+ * @author yinzuomei
+ * @description 党支部列表查询
+ * @Date 2020/6/17 16:15
+ **/
+ List listPartyBranch(PartyBranchListFormDTO formDTO);
+
+ /**
+ * @return void
+ * @param formDTO
+ * @author yinzuomei
+ * @description 删除党支部
+ * @Date 2020/6/17 17:04
+ **/
+ void deleteBranch(DeleteBranchFormDTO formDTO);
+}
diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/PartyBranchManageServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/PartyBranchManageServiceImpl.java
new file mode 100644
index 0000000000..fd6c6c4d66
--- /dev/null
+++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/PartyBranchManageServiceImpl.java
@@ -0,0 +1,89 @@
+package com.epmet.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerPartyBranchDTO;
+import com.epmet.dto.form.*;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
+import com.epmet.dto.result.PartyBranchAddResultDTO;
+import com.epmet.dto.result.PartyBranchListResultDTO;
+import com.epmet.feign.GovOrgOpenFeignClient;
+import com.epmet.service.PartyBranchManageService;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 基层治理-支部管理
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 13:23
+ */
+@Service
+public class PartyBranchManageServiceImpl implements PartyBranchManageService {
+ private Logger logger = LogManager.getLogger(PartyBranchManageServiceImpl.class);
+ @Autowired
+ private GovOrgOpenFeignClient govOrgOpenFeignClient;
+
+ @Override
+ public PartyBranchAddResultDTO addPartyBranch(PartyBranchAddFormDTO formDTO) {
+ CustomerPartyBranchDTO customerPartyBranchDTO = ConvertUtils.sourceToTarget(formDTO, CustomerPartyBranchDTO.class);
+ customerPartyBranchDTO.setTotalPartyMember(0);
+ PartyBranchAddResultDTO partyBranchAddResultDTO = new PartyBranchAddResultDTO();
+ Result result = govOrgOpenFeignClient.savePartyBranch(customerPartyBranchDTO);
+ if (result.success()) {
+ partyBranchAddResultDTO.setPartyBranchId(result.getData());
+ } else {
+ logger.error("添加党支部错误,调用gov-org-server接口返回失败");
+ }
+ return partyBranchAddResultDTO;
+ }
+
+ @Override
+ public void editPartyBranch(PartyBranchEditFormDTO formDTO) {
+ CustomerPartyBranchDTO customerPartyBranchDTO = ConvertUtils.sourceToTarget(formDTO, CustomerPartyBranchDTO.class);
+ customerPartyBranchDTO.setId(formDTO.getPartyBranchId());
+ Result result = govOrgOpenFeignClient.updatePartyBranch(customerPartyBranchDTO);
+ if (result.success()) {
+ logger.info("修改党支部信息成功");
+ }
+ }
+
+ @Override
+ public List listPartyBranch(PartyBranchListFormDTO formDTO) {
+ ListPartyBranchFormDTO listPartyBranchFormDTO = ConvertUtils.sourceToTarget(formDTO, ListPartyBranchFormDTO.class);
+ Result> result = govOrgOpenFeignClient.listPartyBranch(listPartyBranchFormDTO);
+ List resultList=result.getData();
+ if (result.success()) {
+ List list = ConvertUtils.sourceToTarget(resultList, PartyBranchListResultDTO.class);
+ return list;
+ } else {
+ logger.error(String.format("党支部列表查询失败入参:"), JSON.toJSONString(formDTO));
+ }
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void deleteBranch(DeleteBranchFormDTO formDTO) {
+ Result customerPartyBranchDTOResult = govOrgOpenFeignClient.getPartyBranchById(formDTO.getPartyBranchId());
+ if (!customerPartyBranchDTOResult.success()||null==customerPartyBranchDTOResult.getData()) {
+ logger.error(String.format("查询党支部信息失败入参:%s",JSON.toJSONString(formDTO)));
+ return;
+ }else{
+ if (null != customerPartyBranchDTOResult.getData() && customerPartyBranchDTOResult.getData().getTotalPartyMember() > 0) {
+ throw new RenException(EpmetErrorCode.CANNOT_DELETE_PARTYB_RANCH.getCode());
+ }
+ }
+ Result delteResult=govOrgOpenFeignClient.deletePartyBranchById(formDTO.getPartyBranchId());
+ if(!delteResult.success()){
+ logger.error(String.format("删除党支部失败入参:%s",JSON.toJSONString(formDTO)));
+ }
+ }
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListPartyBranchFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListPartyBranchFormDTO.java
new file mode 100644
index 0000000000..ede50112e5
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListPartyBranchFormDTO.java
@@ -0,0 +1,29 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 党支部列表查询
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 16:27
+ */
+@Data
+public class ListPartyBranchFormDTO implements Serializable {
+ private static final long serialVersionUID = -5693132528876149747L;
+
+ /**
+ * 客户id
+ */
+ @NotBlank(message = "客户id不能为空")
+ private String customerId;
+
+ /**
+ * 网格id
+ */
+ @NotBlank(message = "网格id不能为空")
+ private String gridId;
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ListPartyBranchResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ListPartyBranchResultDTO.java
new file mode 100644
index 0000000000..ae84fd8030
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ListPartyBranchResultDTO.java
@@ -0,0 +1,24 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 党支部列表查询返参
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/6/17 16:30
+ */
+@Data
+public class ListPartyBranchResultDTO implements Serializable {
+ private static final long serialVersionUID = 2306892144298853581L;
+ /**
+ * 支部id
+ */
+ private String partyBranchId;
+ /**
+ * 支部名称
+ */
+ private String partyBranchName;
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
index ff0a23f716..db86b3548b 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
@@ -1,16 +1,19 @@
package com.epmet.feign;
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerAgencyDTO;
+import com.epmet.dto.CustomerPartyBranchDTO;
+import com.epmet.dto.form.ListPartyBranchFormDTO;
import com.epmet.dto.result.ArticleGridResultDTO;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
+import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.*;
-import com.epmet.commons.tools.constant.ServiceConstant;
-import com.epmet.commons.tools.utils.Result;
-import com.epmet.dto.CustomerAgencyDTO;
-import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback;
+import java.util.List;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@@ -18,14 +21,13 @@ import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback;
* @author yinzuomei@elink-cn.com
* @date 2020/6/4 13:37
*/
-// @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url =
-// "localhost:8092")
+// @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092")
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class)
public interface GovOrgOpenFeignClient {
/**
* 根据Id查询agency
- *
+ *
* @param agencyId
* @return
*/
@@ -34,7 +36,7 @@ public interface GovOrgOpenFeignClient {
/**
* 根据staffId查询所属的组织机构
- *
+ *
* @param staffId
* @return
*/
@@ -58,4 +60,54 @@ public interface GovOrgOpenFeignClient {
**/
@PostMapping(value = "gov/org/customeragency/getpublishagencylist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result getPublishAgencyList(@PathVariable("staffId") String staffId);
+
+ /**
+ * @param customerPartyBranchDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 添加党支部
+ * @Date 2020/6/17 13:36
+ **/
+ @PostMapping(value = "gov/org/customerpartybranch/save", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ Result savePartyBranch(@RequestBody CustomerPartyBranchDTO customerPartyBranchDTO);
+
+ /**
+ * @param customerPartyBranchDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 修改党支部信息
+ * @Date 2020/6/17 15:31
+ **/
+ @PutMapping(value = "gov/org/customerpartybranch/update", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ Result updatePartyBranch(@RequestBody CustomerPartyBranchDTO customerPartyBranchDTO);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 根据客户id、网格id查询党支部列表
+ * @Date 2020/6/17 16:28
+ **/
+ @PostMapping(value = "gov/org/customerpartybranch/listpartybranch", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ Result> listPartyBranch(@RequestBody ListPartyBranchFormDTO formDTO);
+
+ /**
+ * @param partyBranchId
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 根据党支部id,查询党支部信息
+ * @Date 2020/6/17 18:01
+ **/
+ @GetMapping(value = "gov/org/customerpartybranch/get/{id}")
+ Result getPartyBranchById(@PathVariable("id") String partyBranchId);
+
+ /**
+ * @return com.epmet.commons.tools.utils.Result
+ * @param partyBranchId
+ * @author yinzuomei
+ * @description 根据党支部id,删除党支部(存在党员的不允许删除)
+ * @Date 2020/6/17 18:08
+ **/
+ @GetMapping(value = "gov/org/customerpartybranch/delete/{id}")
+ Result deletePartyBranchById(@PathVariable("id") String partyBranchId);
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
index 8f6c108a7d..2fffa2b13b 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
@@ -4,11 +4,16 @@ 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.CustomerAgencyDTO;
+import com.epmet.dto.CustomerPartyBranchDTO;
+import com.epmet.dto.form.ListPartyBranchFormDTO;
import com.epmet.dto.result.ArticleGridResultDTO;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import org.springframework.stereotype.Component;
+import java.util.List;
+
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
*
@@ -37,4 +42,29 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getPublishAgencyList", staffId);
}
+ @Override
+ public Result savePartyBranch(CustomerPartyBranchDTO customerPartyBranchDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "save", customerPartyBranchDTO);
+ }
+
+ @Override
+ public Result updatePartyBranch(CustomerPartyBranchDTO customerPartyBranchDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "update", customerPartyBranchDTO);
+ }
+
+ @Override
+ public Result> listPartyBranch(ListPartyBranchFormDTO formDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "listpartybranch", formDTO);
+ }
+
+ @Override
+ public Result getPartyBranchById(String partyBranchId) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "get", partyBranchId);
+ }
+
+ @Override
+ public Result deletePartyBranchById(String partyBranchId) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "deleteById", partyBranchId);
+ }
+
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerPartyBranchController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerPartyBranchController.java
index 102b6e15b4..5935d18894 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerPartyBranchController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerPartyBranchController.java
@@ -17,15 +17,19 @@
package com.epmet.controller;
+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.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
-import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerPartyBranchDTO;
+import com.epmet.dto.form.ListPartyBranchFormDTO;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
import com.epmet.excel.CustomerPartyBranchExcel;
import com.epmet.service.CustomerPartyBranchService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,21 +59,20 @@ public class CustomerPartyBranchController {
return new Result>().ok(page);
}
- @GetMapping("{id}")
+ @GetMapping("get/{id}")
public Result get(@PathVariable("id") String id){
CustomerPartyBranchDTO data = customerPartyBranchService.get(id);
return new Result().ok(data);
}
- @PostMapping
- public Result save(@RequestBody CustomerPartyBranchDTO dto){
+ @PostMapping("save")
+ public Result save(@RequestBody CustomerPartyBranchDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
- customerPartyBranchService.save(dto);
- return new Result();
+ return new Result().ok(customerPartyBranchService.save(dto));
}
- @PutMapping
+ @PutMapping("update")
public Result update(@RequestBody CustomerPartyBranchDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@@ -85,10 +88,32 @@ public class CustomerPartyBranchController {
return new Result();
}
+ @GetMapping("delete/{id}")
+ public Result deleteById(@PathVariable("id") String id){
+ CustomerPartyBranchDTO data = customerPartyBranchService.get(id);
+ if(null!=data&&data.getTotalPartyMember()>0){
+ throw new RenException(EpmetErrorCode.CANNOT_DELETE_PARTYB_RANCH.getCode());
+ }
+ customerPartyBranchService.deleteById(id);
+ return new Result();
+ }
+
@GetMapping("export")
public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
List list = customerPartyBranchService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, CustomerPartyBranchExcel.class);
}
+ /**
+ * @return com.epmet.commons.tools.utils.Result>
+ * @param formDTO
+ * @author yinzuomei
+ * @description 党支部列表查询,供gov-grid服务调用
+ * @Date 2020/6/17 16:33
+ **/
+ @PostMapping("listpartybranch")
+ public Result> listpartybranch(@RequestBody ListPartyBranchFormDTO formDTO){
+ ValidatorUtils.validateEntity(formDTO);
+ return new Result>().ok(customerPartyBranchService.listpartybranch(formDTO));
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerPartyBranchDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerPartyBranchDao.java
index 1a29c4df2f..100ddbc86e 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerPartyBranchDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerPartyBranchDao.java
@@ -18,9 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.form.ListPartyBranchFormDTO;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
import com.epmet.entity.CustomerPartyBranchEntity;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 党支部信息
*
@@ -29,5 +33,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerPartyBranchDao extends BaseDao {
-
+ //根据客户id、网格id查询党支部列表
+ List selectListPartyBranchResultDTO(ListPartyBranchFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerPartyBranchService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerPartyBranchService.java
index 8b497b0f1c..d25e849751 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerPartyBranchService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerPartyBranchService.java
@@ -20,6 +20,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerPartyBranchDTO;
+import com.epmet.dto.form.ListPartyBranchFormDTO;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
import com.epmet.entity.CustomerPartyBranchEntity;
import java.util.List;
@@ -71,7 +73,7 @@ public interface CustomerPartyBranchService extends BaseService
+ * @param formDTO
+ * @author yinzuomei
+ * @description 党支部列表查询,供gov-grid服务调用
+ * @Date 2020/6/17 16:33
+ **/
+ List listpartybranch(ListPartyBranchFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerPartyBranchServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerPartyBranchServiceImpl.java
index ae49820a11..07ae09a79a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerPartyBranchServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerPartyBranchServiceImpl.java
@@ -20,11 +20,13 @@ package com.epmet.service.impl;
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.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
-import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CustomerPartyBranchDao;
import com.epmet.dto.CustomerPartyBranchDTO;
+import com.epmet.dto.form.ListPartyBranchFormDTO;
+import com.epmet.dto.result.ListPartyBranchResultDTO;
import com.epmet.entity.CustomerPartyBranchEntity;
import com.epmet.redis.CustomerPartyBranchRedis;
import com.epmet.service.CustomerPartyBranchService;
@@ -82,9 +84,10 @@ public class CustomerPartyBranchServiceImpl extends BaseServiceImpl listpartybranch(ListPartyBranchFormDTO formDTO) {
+ return baseDao.selectListPartyBranchResultDTO(formDTO);
+ }
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerPartyBranchDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerPartyBranchDao.xml
index 024a2f2945..a7d2b9338f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerPartyBranchDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerPartyBranchDao.xml
@@ -18,5 +18,19 @@
-
+
+
\ No newline at end of file