diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java
index 3a60549d6a..3250a4f25f 100644
--- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java
+++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java
@@ -3,6 +3,7 @@ package com.epmet.commons.mybatis.aspect;
import com.epmet.commons.mybatis.annotation.DataFilter;
import com.epmet.commons.mybatis.feign.MybatisGovAccessFeignClient;
import com.epmet.commons.mybatis.dto.form.*;
+import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.user.LoginUserUtil;
@@ -39,6 +40,11 @@ public class DataFilterAspect {
@Before("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)")
public void dataFilter(JoinPoint point) {
+ if (!AppClientConstant.APP_GOV.equals(loginUserUtil.getLoginUserApp())) {
+ // 只校验gov,否则放行
+ return;
+ }
+
// 从ThreadLocal中取所需权限
String requirePermission = ThreadLocalConstant.requirePermissionTl.get();
// 没有配置所需权限,不做操作,打印提示日志
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
index 02e26acdf9..bce71012a1 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
@@ -70,7 +70,7 @@ public abstract class BaseRequestLogAspect {
long execTimeMillis = Duration.between(startTime, endTime).toMillis();
if (exception != null) {
- log.info("<<<<<<<<异常响应<<<<<<<<:线程ID:{},执行时长:{}ms, 响应数据:{}, 异常信息:{}",
+ log.error("<<<<<<<<异常响应<<<<<<<<:线程ID:{},执行时长:{}ms, 响应数据:{}, 异常信息:{}",
id, execTimeMillis, result == null ? result : result.toString(), ExceptionUtils.getErrorStackTrace(exception));
} else {
log.info("<<<<<<<<正常响应<<<<<<<<:线程ID:{},执行时长:{}ms, 响应数据:{}",
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 243367637a..dbe9e88573 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
@@ -48,7 +48,12 @@ public enum EpmetErrorCode {
PROJECT_IS_CLOSED(8601,"项目已结案"),
// 该错误不会提示给前端,只是后端传输错误信息用。
- ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数");
+ ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
+ OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),
+ OPER_ADD_CUSTOMER_ROOT_AGENCY_EXISTS(8703, "添加客户根级组织失败,根级组织已存在"),
+ OPER_CUSTOMER_EXISTS(8704, "客户已存在"),
+ OPER_ADD_CUSTOMER_ERROR(8705, "新增客户失败"),
+ OPER_ADD_CUSTOMER_MANAGER_ERROR(8706, "新增客户管理员失败");
private int code;
private String msg;
diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java
new file mode 100755
index 0000000000..d39f405e29
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java
@@ -0,0 +1,51 @@
+/**
+ * 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 java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 角色默认的可操作功能列表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-05-21
+ */
+@Data
+public class RoleOperationDefaultDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ */
+ private String id;
+
+ /**
+ * 角色KEY
+ */
+ private String roleKey;
+
+ /**
+ * 操作key
+ */
+ private String operationKey;
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml
index e53f25d20a..4a2e1485b1 100644
--- a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
gov-access-server:
container_name: gov-access-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.11
+ image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.12
ports:
- "8099:8099"
network_mode: host # 使用现有网络
diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml
index 49c19fc6cb..b24b00099d 100644
--- a/epmet-module/gov-access/gov-access-server/pom.xml
+++ b/epmet-module/gov-access/gov-access-server/pom.xml
@@ -2,7 +2,7 @@
- 0.3.11
+ 0.3.12
gov-access
com.epmet
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java
index 8e9778734b..0cf13fdfb8 100644
--- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java
@@ -3,6 +3,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.RoleOperationResultDTO;
import com.epmet.service.RoleOperationService;
+import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@@ -28,6 +29,4 @@ public class RoleController {
List roleOperationResultDTOS = roleOperationService.listOperationsByRoleId(roleId);
return new Result>().ok(roleOperationResultDTOS);
}
-
-
}
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java
new file mode 100755
index 0000000000..0417991bb5
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java
@@ -0,0 +1,33 @@
+/**
+ * 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.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.RoleOperationDefaultEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 角色默认的可操作功能列表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-05-21
+ */
+@Mapper
+public interface RoleOperationDefaultDao extends BaseDao {
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java
new file mode 100755
index 0000000000..b19c7e08e0
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java
@@ -0,0 +1,41 @@
+/**
+ * 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.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+public class RoleOperationDefaultEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色KEY
+ */
+ private String roleKey;
+
+ /**
+ * 操作key
+ */
+ private String operationKey;
+
+}
diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
index 28c9535f83..b5ec4bd689 100644
--- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
+++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
@@ -2,6 +2,7 @@ package com.epmet.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.epmet.bean.OpeScopeFilterResultBean;
+import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.OpeScopeConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
@@ -122,6 +123,11 @@ public class AccessServiceImpl implements AccessService {
@Override
public Boolean hasPermission(String operationKey, String userId, String app, String client) {
+ if (!AppClientConstant.APP_GOV.equals(app)) {
+ // 如果不是gov,那么不判断权限,放行
+ return true;
+ }
+
GovTokenDto userDetails = getUserDetails(app, client, userId);
if (userDetails == null) {
return false;
diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml
new file mode 100755
index 0000000000..d7d7532ca6
--- /dev/null
+++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddRootAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddRootAgencyFormDTO.java
new file mode 100644
index 0000000000..d4fffc6ef3
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddRootAgencyFormDTO.java
@@ -0,0 +1,90 @@
+/**
+ * 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 org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+/**
+ * 添加组织-接口入参
+ *
+ * @author sun
+ */
+@Data
+public class AddRootAgencyFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ //=====分组校验========
+ public interface AddRootAgencyGroup {}
+
+ /**
+ * 客户ID
+ */
+ @NotBlank(message = "客户ID不能为空", groups = AddRootAgencyGroup.class)
+ private String customerId;
+
+ /**
+ * 机构组织名称
+ */
+ @NotBlank(message = "组织名称不能为空" , groups = AddRootAgencyGroup.class)
+ @Length(max=50,message = "机构名称不能超过50个字" , groups = AddRootAgencyGroup.class)
+ private String agencyName;
+
+ /**
+ * 机关级别(社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province)
+ */
+ @NotBlank(message = "机关级别不能为空" , groups = AddRootAgencyGroup.class)
+ @Length(max=30,message = "机关类别不能超过30个字" , groups = AddRootAgencyGroup.class)
+ private String level;
+
+ /**
+ * 地区编码
+ */
+ @NotBlank(message = "地区编码不能为空", groups = AddRootAgencyGroup.class)
+ @Length(max=10,message = "地区编码不能超过10位", groups = AddRootAgencyGroup.class)
+ private String areaCode;
+
+ /**
+ * 省份
+ */
+ @NotBlank(message = "省级机关名称不能为空", groups = AddRootAgencyGroup.class)
+ @Length(max=30,message = "省级机关名称不能超过30个字", groups = AddRootAgencyGroup.class)
+ private String province;
+
+ /**
+ * 城市
+ */
+ @Length(max=30,message = "市级机关名称不能超过30个字", groups = AddRootAgencyGroup.class)
+ private String city;
+
+ /**
+ * 区县
+ */
+ @Length(max=30,message = "区县级机关名称不能超过30个字", groups = AddRootAgencyGroup.class)
+ private String district;
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
index 95fba64652..dec83bdd46 100644
--- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
gov-org-server:
container_name: gov-org-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.47
+ image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.48
ports:
- "8092:8092"
network_mode: host # 使用现有网络
diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml
index 34a0a69aa8..f5612b9751 100644
--- a/epmet-module/gov-org/gov-org-server/pom.xml
+++ b/epmet-module/gov-org/gov-org-server/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- 0.3.47
+ 0.3.48
com.epmet
gov-org
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
index babbdf49b9..a5c6f56580 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
@@ -38,6 +38,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import javax.xml.validation.Validator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -81,6 +82,20 @@ public class AgencyController {
return agencyService.addAgency(formDTO);
}
+ /**
+ * 添加根级组织
+ * @param form
+ * @return
+ */
+ @PostMapping("addrootagency")
+ public Result> addRootAgency(@RequestBody AddRootAgencyFormDTO form) {
+ ValidatorUtils.validateEntity(form, AddRootAgencyFormDTO.AddRootAgencyGroup.class);
+ String agencyId = agencyService.addRootAgency(form);
+ HashMap resultMap = new HashMap<>();
+ resultMap.put("agencyId", agencyId);
+ return new Result>().ok(resultMap);
+ }
+
/**
* @param formDTO
* @return
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
index 72d682688d..fa441eb40b 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
@@ -87,9 +87,11 @@ public class StaffController {
*/
@PostMapping("addstaff")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_CREATE)
- public Result addStaff(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitFromDTO fromDTO){
+ public Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO){
+ fromDTO.setApp("gov");
+ fromDTO.setClient("wxmp");
ValidatorUtils.validateEntity(fromDTO);
- return staffService.addStaff(tokenDto, fromDTO);
+ return staffService.addStaff(fromDTO);
}
/**
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
index 6ebd81f812..a3cf56ec89 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
@@ -97,4 +97,6 @@ public interface AgencyService {
* @param customerId
*/
CustomerAgencyDTO getCustomerRootAgency(String customerId);
+
+ String addRootAgency(AddRootAgencyFormDTO form);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
index 5f36f85c12..d30549e58f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
@@ -56,7 +56,7 @@ public interface StaffService {
* @param fromDTO 参数
* @return Result
*/
- Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO);
+ Result addStaff(StaffSubmitFromDTO fromDTO);
/**
* 人员编辑
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index f5f97eea0d..46b5bc90d1 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -254,4 +254,23 @@ public class AgencyServiceImpl implements AgencyService {
public CustomerAgencyDTO getCustomerRootAgency(String customerId) {
return customerAgencyDao.getCustomerRootAgency(customerId);
}
+
+ @Override
+ public String addRootAgency(AddRootAgencyFormDTO form) {
+
+ CustomerAgencyDTO rootAgencyExists = customerAgencyDao.getCustomerRootAgency(form.getCustomerId());
+ if (rootAgencyExists != null) {
+ throw new RenException(EpmetErrorCode.OPER_ADD_CUSTOMER_ROOT_AGENCY_EXISTS.getCode());
+ }
+
+ CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(form, CustomerAgencyEntity.class);
+ entity.setAllParentName("");
+ entity.setOrganizationName(form.getAgencyName());
+ entity.setPids("0");
+ entity.setPid("0");
+ entity.setTotalUser(0);
+ entity.setCustomerId(form.getCustomerId());
+ customerAgencyDao.insert(entity);
+ return entity.getId();
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
index 6db7038395..aa3d328a57 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
@@ -101,10 +101,10 @@ public class StaffServiceImpl implements StaffService {
@Override
@Transactional(rollbackFor = Exception.class)
- public Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) {
+ public Result addStaff(StaffSubmitFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
- fromDTO.setApp(tokenDto.getApp());
- fromDTO.setClient(tokenDto.getClient());
+ //fromDTO.setApp(tokenDto.getApp());
+ //fromDTO.setClient(tokenDto.getClient());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
Result result = epmetUserFeignClient.addStaff(fromDTO);
diff --git a/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml b/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml
index 2d91e321ca..e72743d9a6 100644
--- a/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
oper-access-server:
container_name: oper-access-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/oper-access-server:0.3.8
+ image: 192.168.1.130:10080/epmet-cloud-dev/oper-access-server:0.3.9
ports:
- "8093:8093"
network_mode: host # 使用现有网络
diff --git a/epmet-module/oper-access/oper-access-server/pom.xml b/epmet-module/oper-access/oper-access-server/pom.xml
index b03039e480..e38e014a32 100644
--- a/epmet-module/oper-access/oper-access-server/pom.xml
+++ b/epmet-module/oper-access/oper-access-server/pom.xml
@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- 0.3.8
+ 0.3.9
oper-access
com.epmet
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java
index f2f9c61891..bd9ba0afa3 100644
--- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java
@@ -74,9 +74,14 @@ public class CustomerDTO implements Serializable {
private String customerPassword;
/**
- * 客户组织级别:0.省级,1市级,2.区县级,3.乡镇街道级 字典表key:organizationlevel
+ * 客户组织级别:机关级别
+ * (社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province)
*/
- private Integer organizationLevel;
+ private String organizationLevel;
/**
* 删除标识:0.未删除 1.已删除
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java
index b4fbbeff49..daab4602dc 100644
--- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java
@@ -2,6 +2,7 @@ package com.epmet.dto.form;
import lombok.Data;
+import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
@@ -12,9 +13,31 @@ import java.util.List;
*/
@Data
public class CustomerFormDTO implements Serializable {
+
+ public interface AddCustomerGroup {
+ }
+
+ public interface GetCustomerDetailGroup {
+ }
+
/**
* 客户id集合
- * */
+ */
private List customerIdList;
+
+ /**
+ * 客户名称
+ */
+ @NotBlank(message = "客户名称不能为空", groups = {AddCustomerGroup.class})
+ private String customerName;
+
+ /**
+ * 组织级别
+ */
+ @NotBlank(message = "客户的组织级别", groups = {AddCustomerGroup.class})
+ private String organizationLevel;
+
+ @NotBlank(message = "客户ID", groups = {GetCustomerDetailGroup.class})
+ private String customerId;
}
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerManagerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerManagerFormDTO.java
new file mode 100644
index 0000000000..8cc2b660cb
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerManagerFormDTO.java
@@ -0,0 +1,38 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * {
+ * "customerId": "100824",
+ * "realName": "XF9wxEFMfi",
+ * "gender": "Vxa8GNrMfb",
+ * "mobile": "54RyjPWtwh",
+ * "agencyId": "101259"
+ * }
+ */
+@Data
+public class CustomerManagerFormDTO {
+
+ public interface AddManagerGroup {}
+
+ @NotBlank(message = "客户ID不能为空", groups = { AddManagerGroup.class })
+ private String customerId;
+
+ @NotBlank(message = "管理员名字不能为空", groups = { AddManagerGroup.class })
+ private String realName;
+
+ @NotNull(message = "管理员性别不能为空", groups = { AddManagerGroup.class })
+ private Integer gender;
+
+ @NotBlank(message = "管理员手机号不能为空", groups = { AddManagerGroup.class })
+ private String mobile;
+
+ // 根据customerId查询rootAgency即可获得
+ //@NotBlank(message = "管理员所属组织ID不能为空", groups = { AddManagerGroup.class })
+ //private String agencyId;
+
+}
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java
new file mode 100644
index 0000000000..cb2730f9aa
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java
@@ -0,0 +1,17 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class CustomerDetailResultDTO {
+
+ private RootAgencyDTO rootAgencyDTO;
+
+ private CustomerInfoDTO customerInfoDTO;
+
+ private List managers = new ArrayList<>();
+
+}
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java
new file mode 100644
index 0000000000..6c2bd282bf
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java
@@ -0,0 +1,9 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+@Data
+public class CustomerInfoDTO {
+ private String customerName;
+ private String organizationLevel;
+}
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java
new file mode 100644
index 0000000000..6b0cfb619d
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java
@@ -0,0 +1,12 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+@Data
+public class ManagerDTO {
+
+ private String realName;
+ private String gender;
+ private String mobile;
+
+}
diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java
new file mode 100644
index 0000000000..27a924084e
--- /dev/null
+++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java
@@ -0,0 +1,13 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+@Data
+public class RootAgencyDTO {
+ private String agencyName;
+ private String level;
+ private String areaCode;
+ private String province;
+ private String city;
+ private String district;
+}
diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml
index f58578779e..d94ecdc631 100644
--- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
oper-crm-server:
container_name: oper-crm-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.10
+ image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.11
ports:
- "8090:8090"
network_mode: host # 使用现有网络
diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml
index 9628e0c10b..a5135feb65 100644
--- a/epmet-module/oper-crm/oper-crm-server/pom.xml
+++ b/epmet-module/oper-crm/oper-crm-server/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- 0.3.10
+ 0.3.11
com.epmet
oper-crm
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
index 1605fd6c80..be507662b6 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
@@ -17,6 +17,8 @@
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;
@@ -26,16 +28,23 @@ 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.CustomerDTO;
+import com.epmet.dto.form.AddRootAgencyFormDTO;
import com.epmet.dto.form.CustomerFormDTO;
+import com.epmet.dto.form.CustomerManagerFormDTO;
+import com.epmet.dto.result.CustomerDetailResultDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.excel.CustomerExcel;
+import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.CustomerService;
+import org.apache.ibatis.mapping.ResultMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.validation.Validator;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -54,6 +63,9 @@ public class CustomerController {
@Autowired
private CustomerService customerService;
+ @Autowired
+ private GovOrgFeignClient govOrgFeignClient;
+
@GetMapping("page")
public Result> page(@RequestParam Map params) {
PageData page = customerService.page(params);
@@ -156,4 +168,59 @@ public class CustomerController {
public Result> queryCustomerList(@RequestBody CustomerFormDTO formDTO) {
return customerService.queryCustomerList(formDTO);
}
+
+ /**
+ * 添加客户
+ * @param form
+ * @return
+ */
+ @PostMapping("add")
+ public Result> addCustomer(@RequestBody CustomerFormDTO form) {
+ ValidatorUtils.validateEntity(form, CustomerFormDTO.AddCustomerGroup.class);
+ String customerId = customerService.addCustomer(form.getCustomerName(), form.getOrganizationLevel());
+ Map resultmap = new HashMap<>();
+ resultmap.put("customerId", customerId);
+ return new Result>().ok(resultmap);
+ }
+
+ /**
+ * 添加客户根级组织
+ * @param form
+ * @return
+ */
+ @PostMapping("addrootagency")
+ public Result> addRootAgency(@RequestBody AddRootAgencyFormDTO form) {
+ Result> result = govOrgFeignClient.addRootAgency(form);
+ if (!result.success()) {
+ throw new RenException(EpmetErrorCode.OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR.getCode(),
+ EpmetErrorCode.OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR.getMsg().concat(",错误信息:").concat(result.getMsg()));
+ }
+ return result;
+ }
+
+ /**
+ *
+ * 添加管理员
+ * @param form
+ * @return
+ */
+ @PostMapping("addmanager")
+ public Result addManager(@RequestBody CustomerManagerFormDTO form) {
+ ValidatorUtils.validateEntity(form, CustomerManagerFormDTO.AddManagerGroup.class);
+ customerService.addManager(form);
+ return new Result();
+ }
+
+ /**
+ *
+ * 客户详情
+ * @param form
+ * @return
+ */
+ @PostMapping("detail")
+ public Result getCustomerDetail(@RequestBody CustomerFormDTO form) {
+ ValidatorUtils.validateEntity(form, CustomerFormDTO.GetCustomerDetailGroup.class);
+ CustomerDetailResultDTO customerDetailResultDto = customerService.getcustomerDetail(form.getCustomerId());
+ return new Result().ok(customerDetailResultDto);
+ }
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
index 6a958cc6d2..2d15ea214a 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
@@ -51,4 +51,11 @@ public interface CustomerDao extends BaseDao {
* @Date 2020/4/24 9:21
**/
List selectListByIds(@Param("customerIdList") List customerIdList);
+
+ /**
+ * 根据名字查询客户
+ * @param customerName
+ * @return
+ */
+ CustomerDTO selectByCustomerName(@Param("customerName") String customerName);
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java
index 76df0cdd70..41ec253b2c 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java
@@ -73,9 +73,14 @@ public class CustomerEntity extends BaseEpmetEntity {
*/
private String customerPassword;
- /**
- * 客户组织级别:0.省级,1市级,2.区县级,3.乡镇街道级 字典表key:organizationlevel
- */
- private Integer organizationLevel;
+ /**
+ * 客户组织级别:机关级别
+ * (社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province)
+ */
+ private String organizationLevel;
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
index 047782a221..1942525951 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
@@ -2,10 +2,13 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.GovStaffRoleDTO;
+import com.epmet.dto.form.CustomerRoleFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -32,4 +35,20 @@ public interface EpmetUserFeignClient {
*/
@PostMapping("/epmetuser/staffrole/staffsinroleoforgs")
Result>> getStaffsInRoleOfOrgs(@RequestBody StaffRoleFormDTO staffRoleFormDTO);
+
+ /**
+ * 为客户初始化政府端工作人员角色
+ * @param customerId
+ * @return
+ */
+ @PostMapping("/epmetuser/staffrole/initrolesforcustomer/{customerId}")
+ Result initGovStaffRolesForCustomer(@PathVariable String customerId);
+
+ /**
+ * 根据客户ID和角色key查询角色信息
+ * @param form
+ * @return
+ */
+ @PostMapping("/epmetuser/staffrole/roleofcustomer")
+ Result getRoleOfCustomer(@RequestBody CustomerRoleFormDTO form);
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
index 10a05d5547..b35a29c1d5 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
@@ -1,10 +1,20 @@
package com.epmet.feign;
+import com.epmet.commons.tools.annotation.LoginUser;
+import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.enums.RequirePermissionEnum;
+import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
+import com.epmet.dto.form.AddAgencyFormDTO;
+import com.epmet.dto.form.AddRootAgencyFormDTO;
+import com.epmet.dto.form.StaffSubmitFromDTO;
+import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallBack;
+import oracle.jdbc.proxy.annotation.Post;
import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -15,6 +25,14 @@ import java.util.Map;
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class)
public interface GovOrgFeignClient {
+ /**
+ * 查询客户根级组织
+ * @param customerId
+ * @return
+ */
+ @PostMapping("/gov/org/agency/customerrootagency/{customerId}")
+ Result getCustomerRootAgency(@PathVariable String customerId);
+
/**
* 批量查询客户根级组织
* @param customerIds
@@ -23,4 +41,28 @@ public interface GovOrgFeignClient {
@PostMapping("/gov/org/agency/customerrootagencybatch")
Result> getCustomerRootAgencyBatch(List customerIds);
+ /**
+ * 添加组织
+ * @param formDTO
+ * @return
+ */
+ @PostMapping("/gov/org/agency/addagency")
+ Result addAgency(@RequestBody AddAgencyFormDTO formDTO);
+
+ /**
+ * 添加根级组织
+ * @param form
+ * @return
+ */
+ @PostMapping("/gov/org/agency/addrootagency")
+ Result> addRootAgency(@RequestBody AddRootAgencyFormDTO form);
+
+ /**
+ * 人员添加
+ *
+ * @param fromDTO 参数
+ * @return Result
+ */
+ @PostMapping("/gov/org/staff/addstaff")
+ Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO);
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
index 4df7aedb61..5bd2671206 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
@@ -3,6 +3,8 @@ 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.GovStaffRoleDTO;
+import com.epmet.dto.form.CustomerRoleFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
@@ -22,4 +24,14 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result>> getStaffsInRoleOfOrgs(StaffRoleFormDTO staffRoleFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffsInRoleOfOrgs", staffRoleFormDTO);
}
+
+ @Override
+ public Result initGovStaffRolesForCustomer(String customerId) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId);
+ }
+
+ @Override
+ public Result getRoleOfCustomer(CustomerRoleFormDTO form) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRoleOfCustomer", form);
+ }
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
index b24bc5a7f1..d88b87ce9f 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
@@ -4,6 +4,10 @@ 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.form.AddAgencyFormDTO;
+import com.epmet.dto.form.AddRootAgencyFormDTO;
+import com.epmet.dto.form.StaffSubmitFromDTO;
+import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
@@ -13,8 +17,28 @@ import java.util.Map;
@Component
public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
+ @Override
+ public Result getCustomerRootAgency(String customerId) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerRootAgency", customerId);
+ }
+
@Override
public Result> getCustomerRootAgencyBatch(List customerIds) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerRootAgencyBatch", customerIds);
}
+
+ @Override
+ public Result addAgency(AddAgencyFormDTO formDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "addAgency", formDTO);
+ }
+
+ @Override
+ public Result> addRootAgency(AddRootAgencyFormDTO form) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "addRootAgency", form);
+ }
+
+ @Override
+ public Result addStaff(StaffSubmitFromDTO fromDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "addStaff", fromDTO);
+ }
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
index a50c87a138..28b47d4af0 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
@@ -22,6 +22,8 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerFormDTO;
+import com.epmet.dto.form.CustomerManagerFormDTO;
+import com.epmet.dto.result.CustomerDetailResultDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.CustomerEntity;
@@ -130,4 +132,20 @@ public interface CustomerService extends BaseService {
* @Date 2020/4/24 9:13
**/
Result> queryCustomerList(CustomerFormDTO formDTO);
+
+ /**
+ * 新增客户
+ * @param customerName
+ * @param organizationLevel
+ * @return
+ */
+ String addCustomer(String customerName, String organizationLevel);
+
+ /**
+ * 添加管理员
+ * @param form
+ */
+ void addManager(CustomerManagerFormDTO form);
+
+ CustomerDetailResultDTO getcustomerDetail(String customerId);
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
index 708deb0894..14f5ff4bcb 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
@@ -20,17 +20,20 @@ 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.exception.EpmetErrorCode;
+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.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.constant.RoleKeyConstants;
+import com.epmet.constant.UserWorkType;
import com.epmet.dao.CustomerDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerDTO;
-import com.epmet.dto.form.CustomerFormDTO;
-import com.epmet.dto.form.StaffRoleFormDTO;
-import com.epmet.dto.result.GovStaffRoleResultDTO;
-import com.epmet.dto.result.ValidCustomerResultDTO;
+import com.epmet.dto.GovStaffRoleDTO;
+import com.epmet.dto.form.*;
+import com.epmet.dto.result.*;
import com.epmet.entity.CustomerEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgFeignClient;
@@ -197,4 +200,161 @@ public class CustomerServiceImpl extends BaseServiceImpl>().ok(customerDTOList);
}
+ @Override
+ @Transactional
+ public String addCustomer(String customerName, String organizationLevel) {
+
+ // 校验
+ CustomerDTO customerExists = baseDao.selectByCustomerName(customerName);
+ if (customerExists != null) {
+ throw new RenException(EpmetErrorCode.OPER_CUSTOMER_EXISTS.getCode());
+ }
+
+ // 1. 本地新增客户信息
+ CustomerEntity customerEntity = new CustomerEntity();
+ customerEntity.setCustomerName(customerName);
+ customerEntity.setTitle("");
+ customerEntity.setOrganizationNumber("");
+ customerEntity.setOrganizationImg("");
+ customerEntity.setValidityTime(getValidityTime());
+ customerEntity.setOrganizationLevel(organizationLevel);
+ int insert = baseDao.insert(customerEntity);
+ if (insert == 0) {
+ throw new RenException(EpmetErrorCode.OPER_ADD_CUSTOMER_ERROR.getCode());
+ }
+
+ // 2. 给客户初始化角色列表
+ Result initResult = epmetUserFeignClient.initGovStaffRolesForCustomer(customerEntity.getId());
+ if (!initResult.success()) {
+ throw new RenException("客户新增:为客户初始化角色调用user服务失败:".concat(initResult.toString()));
+ }
+
+ return customerEntity.getId();
+ }
+
+ @Override
+ public void addManager(CustomerManagerFormDTO form) {
+
+ // 查询客户具有指定RoleKey的角色信息
+ CustomerRoleFormDTO customerRoleForm = new CustomerRoleFormDTO();
+ customerRoleForm.setCustomerId(form.getCustomerId());
+ customerRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_MANAGER);
+ Result getRoleResult = epmetUserFeignClient.getRoleOfCustomer(customerRoleForm);
+ if (!getRoleResult.success()) {
+ throw new RenException("查询客户具有指定RoleKey的角色信息失败:".concat(getRoleResult.toString()));
+ }
+
+ if (getRoleResult.getData() == null) {
+ throw new RenException("未查询到客户具有指定RoleKey的角色信息:".concat(getRoleResult.toString()));
+ }
+
+ // 查询客户根级组织
+ Result customerRootAgencyResult = govOrgFeignClient.getCustomerRootAgency(form.getCustomerId());
+ if (!customerRootAgencyResult.success()) {
+ throw new RenException("查询客户根级组织失败:".concat(getRoleResult.toString()));
+ }
+
+ if (customerRootAgencyResult.getData() == null) {
+ throw new RenException("没有查询到客户根级组织,无法设置管理员:".concat(getRoleResult.toString()));
+ }
+
+ StaffSubmitFromDTO staffSubmitFrom = new StaffSubmitFromDTO();
+ staffSubmitFrom.setCustomerId(form.getCustomerId());
+ staffSubmitFrom.setAgencyId(customerRootAgencyResult.getData().getId());
+ staffSubmitFrom.setGender(form.getGender());
+ staffSubmitFrom.setMobile(form.getMobile());
+ staffSubmitFrom.setName(form.getRealName());
+ staffSubmitFrom.setWorkType(UserWorkType.FULL_TIME);
+ staffSubmitFrom.setRoles(Arrays.asList(getRoleResult.getData().getId()));
+ Result result = govOrgFeignClient.addStaff(staffSubmitFrom);
+ if (!result.success()) {
+ throw new RenException(EpmetErrorCode.OPER_ADD_CUSTOMER_MANAGER_ERROR.getCode());
+ }
+ }
+
+ @Override
+ public CustomerDetailResultDTO getcustomerDetail(String customerId) {
+ // 客户信息
+ CustomerEntity customer = baseDao.selectById(customerId);
+ CustomerInfoDTO customerInfo = ConvertUtils.sourceToTarget(customer, CustomerInfoDTO.class);
+
+ if (customerInfo == null) {
+ return new CustomerDetailResultDTO();
+ }
+
+ // 根级组织
+ Result customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(customerId);
+ if (!customerRootAgencyRst.success()) {
+ throw new RenException("查询客户详情:查询客户根级组织失败:".concat(customerRootAgencyRst.toString()));
+ }
+
+ CustomerAgencyDTO customerRootAgency = customerRootAgencyRst.getData();
+
+ // 管理员
+ List managers = new ArrayList<>();
+ if (customerRootAgency != null) {
+ StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO();
+ staffsInRoleForm.setOrgId(customerRootAgency.getId());
+ staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_MANAGER);
+ Result> managersResult = epmetUserFeignClient.getStaffsInRole(staffsInRoleForm);
+ if (!managersResult.success()) {
+ throw new RenException("查询客户详情:查询客户管理员失败:".concat(managersResult.toString()));
+ }
+ managers = managersResult.getData();
+ }
+
+
+
+ return constructCustomerDetail(customerInfo, customerRootAgency, managers);
+ }
+
+ /**
+ * 构造客户详情dto
+ * @param customerInfo
+ * @param customerRootAgency
+ * @param managers
+ * @return
+ */
+ public CustomerDetailResultDTO constructCustomerDetail(CustomerInfoDTO customerInfo,
+ CustomerAgencyDTO customerRootAgency,
+ List managers) {
+
+ CustomerDetailResultDTO customerDetail = new CustomerDetailResultDTO();
+ // 构造管理员
+ if (!CollectionUtils.isEmpty(managers)) {
+ for (GovStaffRoleResultDTO manager : managers) {
+ ManagerDTO managerDTO = new ManagerDTO();
+ managerDTO.setRealName(manager.getRealName());
+ managerDTO.setMobile(manager.getMobile());
+ managerDTO.setGender(manager.getGender());
+ customerDetail.getManagers().add(managerDTO);
+ }
+ }
+
+ // 客户信息
+ customerDetail.setCustomerInfoDTO(customerInfo);
+
+ // 根级组织
+ if (customerRootAgency != null) {
+ RootAgencyDTO rootAgencyDTO = new RootAgencyDTO();
+ rootAgencyDTO.setAgencyName(customerRootAgency.getOrganizationName());
+ rootAgencyDTO.setAreaCode(customerRootAgency.getAreaCode());
+ rootAgencyDTO.setCity(customerRootAgency.getCity());
+ rootAgencyDTO.setDistrict(customerRootAgency.getDistrict());
+ rootAgencyDTO.setLevel(customerRootAgency.getLevel());
+ rootAgencyDTO.setProvince(customerRootAgency.getProvince());
+ customerDetail.setRootAgencyDTO(rootAgencyDTO);
+ }
+ return customerDetail;
+ }
+
+ /**
+ * 获取客户的有效时长
+ * @return
+ */
+ private Date getValidityTime() {
+ int life = 3600 * 1000 * 24 * 365 * 10;
+ return new Date(new Date().getTime() + Long.valueOf(life));
+ }
+
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml
index 340883f472..6f16fec155 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml
@@ -48,4 +48,11 @@
#{customerId}
+
+
+
+ SELECT *
+ FROM customer
+ WHERE CUSTOMER_NAME = #{customerName}
+
diff --git a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml
index f37e3e8913..4ed2656eec 100644
--- a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
resi-partymember-server:
container_name: resi-partymember-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/resi-partymember-server:0.3.30
+ image: 192.168.1.130:10080/epmet-cloud-dev/resi-partymember-server:0.3.31
ports:
- "8096:8096"
network_mode: host # 使用现有网络
diff --git a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml
index bcb31b4122..7d9151492e 100644
--- a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml
+++ b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
resi-partymember-server:
container_name: resi-partymember-server-test
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-partymember-server:0.3.30
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-partymember-server:0.3.31
ports:
- "8096:8096"
network_mode: host # 使用现有网络
diff --git a/epmet-module/resi-partymember/resi-partymember-server/pom.xml b/epmet-module/resi-partymember/resi-partymember-server/pom.xml
index 2b0cd8cb8e..f2fb266285 100644
--- a/epmet-module/resi-partymember/resi-partymember-server/pom.xml
+++ b/epmet-module/resi-partymember/resi-partymember-server/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- 0.3.30
+ 0.3.31
com.epmet
resi-partymember
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java
new file mode 100644
index 0000000000..1bc1e03a24
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java
@@ -0,0 +1,17 @@
+package com.epmet.constant;
+
+/**
+ * 角色key常量
+ */
+public class RoleKeyConstants {
+
+ public static final String ROLE_KEY_MANAGER = "manager";
+ public static final String ROLE_KEY_PARTY_PRINCIPALS = "party_principals";
+ public static final String ROLE_KEY_GRID_MANAGER = "grid_manager";
+ public static final String ROLE_KEY_AGENCY_LEADER = "agency_leader";
+ public static final String ROLE_KEY_GRID_PARTY_DIRECTOR = "grid_party_director";
+ public static final String ROLE_KEY_DEPT_LEADER = "dept_leader";
+ public static final String ROLE_KEY_STAFF = "staff";
+ public static final String ROLE_KEY_GRID_MEMBER = "grid_member";
+
+}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/UserWorkType.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/UserWorkType.java
new file mode 100644
index 0000000000..5eb25fce69
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/UserWorkType.java
@@ -0,0 +1,8 @@
+package com.epmet.constant;
+
+public class UserWorkType {
+
+ public static final String FULL_TIME="fulltime";
+ public static final String PART_TIME="parttime";
+
+}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerRoleFormDTO.java
new file mode 100644
index 0000000000..72a6c7d96b
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerRoleFormDTO.java
@@ -0,0 +1,18 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class CustomerRoleFormDTO {
+
+ public interface GetRoleByCustomerAndKey{}
+
+ @NotBlank(message = "客户ID不能为空", groups = { GetRoleByCustomerAndKey.class })
+ private String customerId;
+
+ @NotBlank(message = "角色Key不能为空", groups = { GetRoleByCustomerAndKey.class })
+ private String roleKey;
+
+}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java
index 6123f16677..51586242da 100644
--- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java
@@ -53,4 +53,12 @@ public class GovStaffRoleResultDTO implements Serializable {
* 角色名称
*/
private String roleName;
+
+ /**
+ * 姓名
+ */
+ private String realName;
+
+ private String mobile;
+ private String gender;
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java
new file mode 100755
index 0000000000..5427012aba
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java
@@ -0,0 +1,86 @@
+/**
+ * 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 java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 政府端角色模板表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-05-21
+ */
+@Data
+public class GovStaffRoleTemplateDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ private String id;
+
+ /**
+ * 角色key
+ */
+ private String roleKey;
+
+ /**
+ * 角色名称
+ */
+ private String roleName;
+
+ /**
+ * 角色所属体系类型:org,dept,grid
+ */
+ private String orgType;
+
+ /**
+ *
+ */
+ private Integer delFlag;
+
+ /**
+ *
+ */
+ private Integer revision;
+
+ /**
+ *
+ */
+ private String createdBy;
+
+ /**
+ *
+ */
+ private Date createdTime;
+
+ /**
+ *
+ */
+ private String updatedBy;
+
+ /**
+ *
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
index 04fdfadaf7..82749718aa 100644
--- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
+++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-user-server:
container_name: epmet-user-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.31
+ image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.32
ports:
- "8087:8087"
network_mode: host # 不会创建新的网络
diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml
index ea4fe5c4d1..1682a0e23a 100644
--- a/epmet-user/epmet-user-server/pom.xml
+++ b/epmet-user/epmet-user-server/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- 0.3.31
+ 0.3.32
com.epmet
epmet-user
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 209e8fd251..7b9424076f 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
@@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
+import com.epmet.dto.form.CustomerRoleFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
@@ -13,12 +14,10 @@ import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService;
import com.epmet.service.StaffRoleService;
+import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.BeanUtils;
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 org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
@@ -120,4 +119,27 @@ public class StaffRoleController {
public Result> specificRolesStaffs(@RequestBody RolesUsersListFormDTO rolesUsersListFormDTO) {
return staffRoleService.getSpecificRolesStaffs(rolesUsersListFormDTO);
}
+
+ /**
+ * 为客户初始化政府端工作人员角色
+ * @param customerId
+ * @return
+ */
+ @PostMapping("initrolesforcustomer/{customerId}")
+ public Result initGovStaffRolesForCustomer(@PathVariable String customerId) {
+ govStaffRoleService.initGovStaffRolesForCustomer(customerId);
+ return new Result();
+ }
+
+ /**
+ * 根据客户ID和角色key查询角色信息
+ * @param form
+ * @return
+ */
+ @PostMapping("roleofcustomer")
+ public Result getRoleOfCustomer(@RequestBody CustomerRoleFormDTO form) {
+ ValidatorUtils.validateEntity(form, CustomerRoleFormDTO.GetRoleByCustomerAndKey.class);
+ GovStaffRoleDTO role = govStaffRoleService.getRoleByCustomerIdAndRoleKey(form.getCustomerId(), form.getRoleKey());
+ return new Result().ok(role);
+ }
}
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 3220c70604..907bb84ea1 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
@@ -48,4 +48,12 @@ public interface GovStaffRoleDao extends BaseDao {
* @return
*/
List selectGovStaffRoleList(GovStaffRoleDTO params);
+
+ /**
+ * 查询客户的指定roleKey的角色信息
+ * @param customerId
+ * @param roleKey
+ * @return
+ */
+ GovStaffRoleDTO getRoleByCustomerIdAndRoleKey(@Param("customerId") String customerId, @Param("roleKey") String roleKey);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java
new file mode 100755
index 0000000000..4622b81f79
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java
@@ -0,0 +1,41 @@
+/**
+ * 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.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.result.GovStaffRoleTemplateDTO;
+import com.epmet.entity.GovStaffRoleTemplateEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 政府端角色模板表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-05-21
+ */
+@Mapper
+public interface GovStaffRoleTemplateDao extends BaseDao {
+
+ /**
+ * 列出有效的角色字典
+ * @return
+ */
+ List listValidateRoles();
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java
new file mode 100755
index 0000000000..7e843810dc
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java
@@ -0,0 +1,56 @@
+/**
+ * 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.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 政府端角色模板表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-05-21
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("gov_staff_role_template")
+public class GovStaffRoleTemplateEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色key
+ */
+ private String roleKey;
+
+ /**
+ * 角色名称
+ */
+ private String roleName;
+
+ /**
+ * 角色所属体系类型:org,dept,grid
+ */
+ private String orgType;
+
+}
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 80b04fa5a6..d7985c8758 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
@@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.GovStaffRoleDTO;
+import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import java.util.List;
@@ -106,4 +107,17 @@ public interface GovStaffRoleService extends BaseService {
* @return
*/
List getGovStaffRoleList(GovStaffRoleDTO dto);
+
+ /**
+ * 为客户初始化角色列表
+ * @param customerId
+ */
+ void initGovStaffRolesForCustomer(String customerId);
+
+ /**
+ * 根据客户ID和角色key查询角色信息
+ * @param customerId
+ * @param roleKey
+ */
+ GovStaffRoleDTO getRoleByCustomerIdAndRoleKey(String customerId, String roleKey);
}
\ 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 cd26eaa0a4..6e0860f82e 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
@@ -24,7 +24,9 @@ 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.GovStaffRoleDao;
+import com.epmet.dao.GovStaffRoleTemplateDao;
import com.epmet.dto.GovStaffRoleDTO;
+import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.redis.GovStaffRoleRedis;
import com.epmet.service.GovStaffRoleService;
@@ -49,6 +51,12 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl page(Map params) {
IPage page = baseDao.selectPage(
@@ -115,4 +123,21 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl getGovStaffRoleList(GovStaffRoleDTO dto) {
return baseDao.selectGovStaffRoleList(dto);
}
+
+ @Override
+ @Transactional
+ public void initGovStaffRolesForCustomer(String customerId) {
+ List validRoles = govStaffRoleTemplateDao.listValidateRoles();
+ for (GovStaffRoleTemplateDTO validRole : validRoles) {
+ GovStaffRoleEntity entity = ConvertUtils.sourceToTarget(validRole, GovStaffRoleEntity.class);
+ entity.setCustomerId(customerId);
+ entity.setId(null);
+ baseDao.insert(entity);
+ }
+ }
+
+ @Override
+ public GovStaffRoleDTO getRoleByCustomerIdAndRoleKey(String customerId, String roleKey) {
+ return govStaffRoleDao.getRoleByCustomerIdAndRoleKey(customerId, roleKey);
+ }
}
\ 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 01a44db29a..a38188f700 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
@@ -27,12 +27,15 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.dao.GovStaffRoleTemplateDao;
import com.epmet.dao.StaffRoleDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
+import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
+import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.entity.StaffRoleEntity;
import com.epmet.redis.StaffRoleRedis;
import com.epmet.service.StaffRoleService;
@@ -58,6 +61,9 @@ public class StaffRoleServiceImpl extends BaseServiceImpl page(Map params) {
IPage page = baseDao.selectPage(
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 d3de570592..4cd4ff5b2b 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
@@ -41,4 +41,13 @@
AND ORG_TYPE = 'agency'
ORDER BY SORT ASC
+
+
+
+ SELECT *
+ FROM gov_staff_role
+ WHERE CUSTOMER_ID = #{customerId}
+ AND ROLE_KEY = #{roleKey}
+ AND DEL_FLAG = '0'
+
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml
new file mode 100755
index 0000000000..263d76beec
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT *
+ FROM gov_staff_role_template
+ WHERE DEL_FLAG = 0
+
+
+
+
\ 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 c6402ed3b8..1f570a073d 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
@@ -27,10 +27,11 @@
- SELECT sr.STAFF_ID, sr.ROLE_ID, r.ROLE_NAME, r.ROLE_KEY
+ SELECT sr.STAFF_ID, sr.ROLE_ID, r.ROLE_NAME, r.ROLE_KEY, s.REAL_NAME, s.MOBILE, s.GENDER
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
+ INNER JOIN customer_staff s ON (sr.STAFF_ID = s.USER_ID)
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}