|
@@ -0,0 +1,70 @@
|
|
|
+package com.persagy.fm.saas.facade;
|
|
|
+
|
|
|
+import com.persagy.common.enums.ResponseCode;
|
|
|
+import com.persagy.common.exception.BusinessException;
|
|
|
+import com.persagy.fm.common.response.FmResponseContent;
|
|
|
+import com.persagy.fm.common.response.FmResponseMsg;
|
|
|
+import com.persagy.fm.common.response.PageList;
|
|
|
+import com.persagy.fm.saas.client.RoleClient;
|
|
|
+import com.persagy.fm.saas.model.SaasRole;
|
|
|
+import com.persagy.fm.saas.model.dto.DeleteSaasRoleDTO;
|
|
|
+import com.persagy.fm.saas.model.dto.PageQuerySaasRoleDTO;
|
|
|
+import com.persagy.fm.saas.model.dto.QuerySaasRoleDTO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 角色服务接口 门面模式
|
|
|
+ * @author Charlie Yu
|
|
|
+ * @date 2021-04-02
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class RoleFeignFacade {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RoleClient client;
|
|
|
+
|
|
|
+ public PageList<SaasRole> queryRolePageList(PageQuerySaasRoleDTO dto) {
|
|
|
+ FmResponseContent<List<SaasRole>> page = client.queryRolePageList(dto);
|
|
|
+ // 失败
|
|
|
+ if(!ResponseCode.A00000.getCode().equals(page.getRespCode())) {
|
|
|
+ throw new BusinessException(page.getRespCode(), page.getRespMsg());
|
|
|
+ }
|
|
|
+ return new PageList<>(page.getContent(), page.getCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<SaasRole> queryRoleList(QuerySaasRoleDTO dto) {
|
|
|
+ FmResponseContent<List<SaasRole>> page = client.queryRoleList(dto);
|
|
|
+ // 失败
|
|
|
+ if(!ResponseCode.A00000.getCode().equals(page.getRespCode())) {
|
|
|
+ throw new BusinessException(page.getRespCode(), page.getRespMsg());
|
|
|
+ }
|
|
|
+ return page.getContent();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void createSaasRole(SaasRole role) {
|
|
|
+ FmResponseContent<String> page = client.createSaasRole(role);
|
|
|
+ // 失败
|
|
|
+ if(!ResponseCode.A00000.getCode().equals(page.getRespCode())) {
|
|
|
+ throw new BusinessException(page.getRespCode(), page.getRespMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void updateSaasRole(SaasRole role) {
|
|
|
+ FmResponseMsg page = client.updateSaasRole(role);
|
|
|
+ // 失败
|
|
|
+ if(!ResponseCode.A00000.getCode().equals(page.getRespCode())) {
|
|
|
+ throw new BusinessException(page.getRespCode(), page.getRespMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void deleteSaasRole(DeleteSaasRoleDTO dto) {
|
|
|
+ FmResponseMsg page = client.deleteSaasRole(dto);
|
|
|
+ // 失败
|
|
|
+ if(!ResponseCode.A00000.getCode().equals(page.getRespCode())) {
|
|
|
+ throw new BusinessException(page.getRespCode(), page.getRespMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|