Jelajahi Sumber

1.新增服务授权列表等

yica 4 tahun lalu
induk
melakukan
c1eaf90603

+ 1 - 1
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IServiceAuthFacade.java

@@ -37,7 +37,7 @@ public interface IServiceAuthFacade {
      * @param dto
      */
     @PostMapping(value = "serviceAuthFlowSave")
-    ResponseDTO serviceAuthFlowSave(@RequestBody ServiceAuthFlowDTO dto);
+    ResponseDTO  serviceAuthFlowSave(@RequestBody ServiceAuthFlowDTO dto);
 
     /**
      * 服务授权工作单审批结果处理

+ 49 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IServiceAuthResultFacade.java

@@ -0,0 +1,49 @@
+package com.dragoninfo.dcuc.auth.auth.facade;
+
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 服务授权结果Facade
+ * @Author yica
+ * @Date 2021/3/9 10:01
+ **/
+@FeignClient(name = "dcuc-auth", path = "/dcuc/auth/serviceAuthResultFacade")
+public interface IServiceAuthResultFacade {
+
+    /**
+     * 保存
+     * @param dto
+     * @return
+     */
+    @PostMapping(value = "saveServiceAuthResult")
+    ResponseDTO saveServiceAuthResult(@RequestBody ServiceAuthResultDTO dto);
+    /**
+     * 删除
+     * @param id
+     * @return ResponseDTO
+     */
+    @PostMapping(value = "delServiceAuthResult")
+    ResponseDTO delServiceAuthResult(@RequestParam("id") String id);
+    /**
+     * 修改
+     * @param dto
+     * @return
+     */
+    @PostMapping(value = "updateServiceAuthResult")
+    ResponseDTO updateServiceAuthResult(@RequestBody ServiceAuthResultDTO dto);
+
+    @PostMapping(value = "serviceAuthResultPage")
+    Page<ServiceAuthResultDTO> serviceAuthResultPage(@RequestBody SearchDTO searchDTO);
+
+    @PostMapping(value = "getDetail")
+    ServiceAuthResultDTO getDetail(@RequestParam("id")String id);
+}

+ 75 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ServiceAuthResultDTO.java

@@ -0,0 +1,75 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 服务授权结果DTO 可拓展
+ * @author mazq
+ * @Description
+ * @create 2020-11-25 14:21
+ */
+@Data
+public class ServiceAuthResultDTO implements Serializable {
+
+    private String id;
+
+    /**
+     * 工作流实例id
+     */
+    private String flowId;
+
+    /**
+     * 应用编码
+     */
+    private String appCode;
+
+    /**
+     * 应用名称
+     */
+    private String appName;
+
+    /**
+     * 应用id
+     */
+    private String appId;
+
+    /**
+     * 服务编码
+     */
+    private String serviceCode;
+
+
+    /**
+     * 服务名称
+     */
+    private String serviceName;
+
+    /**
+     * 服务id
+     */
+    private String serviceId;
+
+    /**
+     * 状态
+     */
+    private String authStatus;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 是否删除
+     */
+    private String deleted;
+}

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/AppFunInfo.java

@@ -52,7 +52,7 @@ public class AppFunInfo implements IdEntity<String> {
 	private String paramValue;
 
 	//有效标志(0:无效 1:有效)
-	@Column(name = "IS_ACTIVE")
+	@Column(name = " ")
 	private String isActive = "1";
 
 	//排序

+ 62 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/po/ServiceAuthResultPO.java

@@ -0,0 +1,62 @@
+package com.dragoninfo.dcuc.auth.auth.po;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author yica
+ * @Date 2021/3/10 17:34
+ **/
+@Data
+public class ServiceAuthResultPO {
+
+    private String id;
+
+
+    /**
+     * 应用编码
+     */
+    private String appCode;
+
+    /**
+     * 应用编码
+     */
+    private String appName;
+
+    /**
+     * 应用id
+     */
+    private String appId;
+
+    /**
+     * 服务编码
+     */
+    private String serviceCode;
+
+
+    /**
+     * 应用编码
+     */
+    private String serviceName;
+
+    /**
+     * 服务id
+     */
+    private String serviceId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 是否删除
+     */
+    private String deleted;
+}

+ 1 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/RoleFunRsRlBPO.java

@@ -65,7 +65,7 @@ public class RoleFunRsRlBPO extends BaseBPO<RoleFunRsRl, String> {
         if (StringUtils.isNotEmpty(appId)) {
             appSql = " app_id = '" + appId + "' and";
         }
-        String sql = "select  distinct o.app_id as app_id,o.name as name,o.code as code,o.url as url,o.parent_id,l.role_id as role_id,o.seq as seq from t_app_fun_info o left join t_role_fun_rs_rl l on o.id=fun_id where  " + appSql + " code " +
+        String sql = "select  distinct o.app_id as app_id,o.name as name,o.code as code,o.url as url,o.parent_id,l.role_id as role_id,o.seq as seq from t_app_fun_info o left join t_role_fun_rs_rl l on o.id=fun_id where  is_active='1' and  " + appSql + " code " +
                 " in (select distinct(f.code) from t_role_fun_rs_rl t left join t_app_fun_info f on t.fun_id=f.id WHERE  ? like concat('%',concat(t.role_id,'%')))";
         return PersistentFactory.getJdbcDao().queryForList(sql, RoleAppFunVO.class, roleIds);
     }

+ 20 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ServiceAuthResultBPO.java

@@ -2,7 +2,11 @@ package com.dragoninfo.dcuc.auth.auth.bpo;
 
 
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
+import com.dragoninfo.dcuc.auth.auth.po.ServiceAuthResultPO;
 import com.dragoninfo.duceap.core.persistent.BaseBPO;
+import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -15,4 +19,20 @@ public class ServiceAuthResultBPO extends BaseBPO<ServiceAuthResult,String> {
     public int getAllCount() {
         return 0;
     }
+    public Page<ServiceAuthResultPO> serviceAuthResultPage(Searchable searchable){
+        String sql="SELECT\n" +
+                "\tt.*,\n" +
+                "\t r.service_name as serviceName,\n" +
+                "\t r.service_name as service_name,\n" +
+                "  t.service_code as serviceCode,\n" +
+                "  y.apply_name as appName,\n" +
+                "  y.apply_name as app_name,\n" +
+                "  t.app_code as appCode\n" +
+                "FROM\n" +
+                "\tT_SERVICE_AUTH_RESULT t\n" +
+                "LEFT JOIN T_SERVICE_RESOURCE r ON r.id = t.service_id\n" +
+                "LEFT JOIN t_apply_info y ON (y.id = t.app_id) ";
+        Page<ServiceAuthResultPO> paging = PersistentFactory.getJdbcDao().paging(sql, searchable,ServiceAuthResultPO.class);
+        return paging;
+    }
 }

+ 64 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/ServiceAuthResultFacade.java

@@ -0,0 +1,64 @@
+package com.dragoninfo.dcuc.auth.auth.facade;
+
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
+import com.dragoninfo.dcuc.auth.auth.service.IServiceAuthResultService;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Author yica
+ * @Date 2021/3/9 10:04
+ **/
+@RestController
+@RequestMapping(value = "/dcuc/auth/serviceAuthResultFacade")
+public class ServiceAuthResultFacade implements IServiceAuthResultFacade{
+
+    @Autowired
+    private IServiceAuthResultService serviceAuthResultService;
+
+    /**
+     * 保存
+     * @param dto
+     * @return
+     */
+    @Override
+    public ResponseDTO saveServiceAuthResult(ServiceAuthResultDTO dto){
+       return serviceAuthResultService.saveServiceAuthResult(dto);
+    }
+
+    /**
+     * 删除
+     * @param id
+     * @return ResponseDTO
+     */
+    @Override
+    public ResponseDTO delServiceAuthResult(String id){
+
+        return serviceAuthResultService.delServiceAuthResult(id);
+    }
+
+    /**
+     * 修改
+     * @param dto
+     * @return
+     */
+    @Override
+    public ResponseDTO updateServiceAuthResult(ServiceAuthResultDTO dto){
+        return serviceAuthResultService.updateServiceAuthResult(dto);
+    }
+    @Override
+    public Page<ServiceAuthResultDTO> serviceAuthResultPage(SearchDTO searchDTO){
+       return serviceAuthResultService.serviceAuthResultPage(Searchable.toSearchable(searchDTO));
+
+    }
+
+    @Override
+    public ServiceAuthResultDTO getDetail(String id) {
+        return serviceAuthResultService.getDetail(id);
+    }
+}

+ 27 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IServiceAuthResultService.java

@@ -1,8 +1,13 @@
 package com.dragoninfo.dcuc.auth.auth.service;
 
 
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthFlow;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.data.domain.Page;
+
 import java.util.List;
 
 /**
@@ -60,4 +65,26 @@ public interface IServiceAuthResultService {
      */
      Object serviceAuthentication(String appCode);
 
+    /**
+     * 保存
+     * @param dto
+     * @return
+     */
+    ResponseDTO saveServiceAuthResult(ServiceAuthResultDTO dto);
+    /**
+     * 删除
+     * @param id
+     * @return ResponseDTO
+     */
+    ResponseDTO delServiceAuthResult(String id);
+    /**
+     * 修改
+     * @param dto
+     * @return
+     */
+    ResponseDTO updateServiceAuthResult(ServiceAuthResultDTO dto);
+
+    Page<ServiceAuthResultDTO> serviceAuthResultPage(Searchable searchable);
+
+    ServiceAuthResultDTO getDetail(String id);
 }

+ 84 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ServiceAuthResultServiceImpl.java

@@ -10,21 +10,30 @@ import com.dragoninfo.dcuc.app.facade.IResourceFacade;
 import com.dragoninfo.dcuc.auth.auth.async.PermssionServiceUpdateEventBus;
 import com.dragoninfo.dcuc.auth.auth.bpo.ServiceAuthResultBPO;
 import com.dragoninfo.dcuc.auth.auth.dto.AppServiceCodeDto;
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthFlow;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
+import com.dragoninfo.dcuc.auth.auth.po.ServiceAuthResultPO;
 import com.dragoninfo.dcuc.auth.auth.service.IPermissionUpdateService;
 import com.dragoninfo.dcuc.auth.auth.service.IServiceAuthResultService;
 import com.dragoninfo.dcuc.auth.auth.vo.ServiceAuthenticationResVO;
 import com.dragoninfo.dcuc.auth.util.DcucConstantsUtil;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
 import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
+import com.dragonsoft.duceap.core.entity.page.PageRequest;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import springfox.documentation.service.ResponseMessage;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -223,4 +232,79 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
             return redisValue;
         }
     }
+
+    /**
+     * 保存
+     * @param dto
+     * @return
+     */
+    @Override
+    public ResponseDTO saveServiceAuthResult(ServiceAuthResultDTO dto){
+       try{
+           ServiceAuthResult result=new ServiceAuthResult();
+           BeanUtils.copyProperties(dto,result);
+           this.saveAuthResult(result);
+       }catch (Exception e){
+            log.error("save ServiceAuthResult error :",e);
+           return ResponseDTO.fail("保存失败",new Object());
+       }
+       return ResponseDTO.success("保存成功",null);
+    }
+
+    /**
+     * 删除
+     * @param id
+     * @return ResponseDTO
+     */
+    @Override
+    public ResponseDTO delServiceAuthResult(String id){
+        ServiceAuthResult result = serviceAuthResultBPO.get(id);
+        result.setDeleted(BooleanEnum.TRUE.value);
+        serviceAuthResultBPO.update(result);
+        return ResponseDTO.success("删除成功",null);
+    }
+
+    /**
+     * 修改
+     * @param dto
+     * @return
+     */
+    @Override
+    public ResponseDTO updateServiceAuthResult(ServiceAuthResultDTO dto){
+        ServiceAuthResult result=serviceAuthResultBPO.get(dto.getId());
+        BeanUtils.copyProperties(result,dto);
+        result.setUpdateTime(new Date());
+        serviceAuthResultBPO.update(result);
+        return ResponseDTO.success("修改成功",null);
+    }
+
+    /**
+     *
+     * @param searchable
+     * @return
+     */
+    @Override
+    public Page<ServiceAuthResultDTO> serviceAuthResultPage(Searchable searchable){
+        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.getValue());
+        Page<ServiceAuthResultPO> paging = serviceAuthResultBPO.serviceAuthResultPage(searchable);
+        List<ServiceAuthResultDTO> dtos=new ArrayList<>();
+        paging.forEach(item->{
+            ServiceAuthResultDTO dto=new ServiceAuthResultDTO();
+            BeanUtils.copyProperties(item,dto);
+            dtos.add(dto);
+        });
+        Pageable newPageable = new PageRequest(paging.getNumber(), paging.getSize());
+        PageImpl<ServiceAuthResultDTO> pageResult = new PageImpl<>(dtos, newPageable, paging.getTotalElements());
+        return pageResult;
+    }
+
+    @Override
+    public ServiceAuthResultDTO getDetail(String id) {
+        ServiceAuthResult result=serviceAuthResultBPO.get(id);
+        ServiceAuthResultDTO dto=new ServiceAuthResultDTO();
+        BeanUtils.copyProperties(result,dto);
+        return dto;
+
+    }
+
 }