Browse Source

客户添加管理员Feign

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
3813131af1
  1. 12
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
  2. 6
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
  3. 13
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

12
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java

@ -5,9 +5,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO;
import com.epmet.dto.form.CustomerManagerFormDTO;
import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback; import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
@ -41,4 +43,14 @@ public interface OperCrmOpenFeignClient {
*/ */
@PostMapping("/oper/crm/customerapp/getconfigallapp") @PostMapping("/oper/crm/customerapp/getconfigallapp")
Result<List<CustomerAppDTO>> getConfigAllApp(); Result<List<CustomerAppDTO>> getConfigAllApp();
/**
* 添加根管理员
* @author zhaoqifeng
* @date 2020/8/3 15:24
* @param form
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/oper/crm/customer/addmanager")
Result addManager(@RequestBody CustomerManagerFormDTO form);
} }

6
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO;
import com.epmet.dto.form.CustomerManagerFormDTO;
import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -39,4 +40,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient {
public Result<List<CustomerAppDTO>> getConfigAllApp() { public Result<List<CustomerAppDTO>> getConfigAllApp() {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getConfigAllApp", null); return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getConfigAllApp", null);
} }
@Override
public Result addManager(CustomerManagerFormDTO form) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "CustomerManagerFormDTO", form);
}
} }

13
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

@ -278,6 +278,19 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
throw new RenException("没有查询到客户根级组织,无法设置管理员:".concat(getRoleResult.toString())); throw new RenException("没有查询到客户根级组织,无法设置管理员:".concat(getRoleResult.toString()));
} }
StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO();
staffRoleFormDTO.setOrgId(customerRootAgencyResult.getData().getId());
staffRoleFormDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
Result<List<GovStaffRoleResultDTO>> managersResult = epmetUserFeignClient.getStaffsInRole(staffRoleFormDTO);
if(!managersResult.success()) {
log.error("查询客户根级组织的管理员失败".concat(getRoleResult.toString()));
throw new RenException("查询客户根级组织的管理员失败".concat(getRoleResult.toString()));
}
if(null != managersResult.getData() && managersResult.getData().size() > NumConstant.ZERO) {
log.error("客户已存在管理员".concat(getRoleResult.toString()));
throw new RenException("客户已存在管理员".concat(getRoleResult.toString()));
}
StaffSubmitFromDTO staffSubmitFrom = new StaffSubmitFromDTO(); StaffSubmitFromDTO staffSubmitFrom = new StaffSubmitFromDTO();
staffSubmitFrom.setCustomerId(form.getCustomerId()); staffSubmitFrom.setCustomerId(form.getCustomerId());
staffSubmitFrom.setAgencyId(customerRootAgencyResult.getData().getId()); staffSubmitFrom.setAgencyId(customerRootAgencyResult.getData().getId());

Loading…
Cancel
Save