Эх сурвалжийг харах

feature(评测内容开发): 评测内容开发

评测内容开发
mazq 2 жил өмнө
parent
commit
ce95ab2687
27 өөрчлөгдсөн 928 нэмэгдсэн , 10 устгасан
  1. 17 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IAuthApplyFacade.java
  2. 57 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/element/facade/IEnvElementFacade.java
  3. 22 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/RedListCheckEventDto.java
  4. 72 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/RedListRiskLog.java
  5. 40 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/vo/RedListRiskLogVo.java
  6. 24 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/element/vo/EnvElementSaveVo.java
  7. 31 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/element/vo/RespEnvElementVo.java
  8. 15 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/IAuthApplyBusiness.java
  9. 66 9
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/AuthApplyBusiness.java
  10. 26 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/event/RedListCheckEvent.java
  11. 11 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/AuthApplyFacade.java
  12. 88 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/listener/RedListRiskLogListener.java
  13. 13 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/RedListRiskLogReposiroty.java
  14. 25 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IRedListRiskLogService.java
  15. 30 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RedListRiskLogServiceImpl.java
  16. 24 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/business/IEnvElementBusiness.java
  17. 83 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/business/impl/EnvElementBusiness.java
  18. 73 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/entity/EnvElement.java
  19. 48 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/facade/EnvElementFacade.java
  20. 13 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/repo/EnvElementRepository.java
  21. 23 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/service/IEnvElementService.java
  22. 56 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/service/impl/EnvElementServiceImpl.java
  23. 8 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IRedListService.java
  24. 10 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IWhiteListService.java
  25. 2 1
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/RedListServiceImpl.java
  26. 10 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/WhiteListServiceImpl.java
  27. 41 0
      dcuc-auth-service/src/main/resources/config/mysql/V4_3_0027__AddEnvElement.sql

+ 17 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IAuthApplyFacade.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.facade;
 
 import com.dragoninfo.dcuc.auth.auth.dto.*;
+import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
@@ -114,4 +115,20 @@ public interface IAuthApplyFacade {
      */
     @GetMapping("getFlowDefineInfo")
     ResponseDTO<FlowDefineInfoDTO> getFlowDefineInfo(@RequestParam(value = "applyType") String applyType);
+
+    /**
+     * 自助申请
+     * @param resourceInfos
+     * @return
+     */
+    @PostMapping("redListCheck")
+    Boolean redListCheck(@RequestBody List<AppFunAuthResourceDTO> resourceInfos);
+
+    /**
+     * 权限申请命中红名单风险日志
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping("redListApplyLog")
+    Page<RedListRiskLogVo> redListApplyLog(@RequestBody SearchDTO searchDTO);
 }

+ 57 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/element/facade/IEnvElementFacade.java

@@ -0,0 +1,57 @@
+package com.dragoninfo.dcuc.auth.element.facade;
+
+import com.dragoninfo.dcuc.auth.element.vo.EnvElementSaveVo;
+import com.dragoninfo.dcuc.auth.element.vo.RespEnvElementVo;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/envElementFacade")
+public interface IEnvElementFacade {
+
+    /**
+     * 根据id获取详情
+     * @param id
+     * @return
+     */
+    @GetMapping("getById/{id}")
+    RespEnvElementVo getById(@PathVariable("id") String id);
+
+    /**
+     * 分页查询场景信息
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping("pageSearch")
+    Page<RespEnvElementVo> pageSearch(@RequestBody SearchDTO searchDTO);
+
+    /**
+     * 保存场景信息
+     * @param envElementVo
+     * @return
+     */
+    @PostMapping("save")
+    ResponseStatus save(@RequestBody EnvElementSaveVo envElementVo);
+
+    /**
+     * 保存场景信息
+     * @param envElementVo
+     * @return
+     */
+    @PostMapping("update")
+    ResponseStatus update(@RequestBody EnvElementSaveVo envElementVo);
+
+    /**
+     *
+     * @param id
+     * @return
+     */
+    @DeleteMapping("deleteById/{id}")
+    ResponseStatus deleteById(@PathVariable("id") String id);
+}

+ 22 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/RedListCheckEventDto.java

@@ -0,0 +1,22 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Data
+public class RedListCheckEventDto {
+
+    private String logSendAppCode;
+
+    private String logReceiverAppCode;
+
+    private String applyUserId;
+
+    private List<AppFunAuthResourceDTO> resourceInfos;
+
+}

+ 72 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/RedListRiskLog.java

@@ -0,0 +1,72 @@
+package com.dragoninfo.dcuc.auth.auth.entity;
+
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.springframework.data.annotation.CreatedDate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_AUTH_RED_LIST_RISK_LOG")
+public class RedListRiskLog {
+
+    @Id
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /**
+     * 日志发送方
+     */
+    @Column(name = "LOG_SENDER")
+    private String logSender;
+
+    /**
+     * 日志接收方
+     */
+    @Column(name = "LOG_RECEIVER")
+    private String logReceiver;
+
+    /**
+     * 用户名
+     */
+    @Column(name = "USER_NAME")
+    private String userName;
+
+    /**
+     * 身份证号
+     */
+    @Column(name = "IDCARD")
+    private String idcard;
+
+    /**
+     * 风险类型
+     */
+    @Column(name = "RISK_TYPE")
+    private String riskType;
+
+    /**
+     * 风险内容
+     */
+    @Column(name = "RISK_CONTENT")
+    private String riskContent;
+
+    /**
+     * 创建时间
+     */
+    @CreatedDate
+    @Column(name = "LOG_SEND_TIME")
+    private Date logSendTime;
+
+
+}

+ 40 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/vo/RedListRiskLogVo.java

@@ -0,0 +1,40 @@
+package com.dragoninfo.dcuc.auth.auth.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Data
+@ApiModel(value = "权限申请命中红名单风险日志")
+public class RedListRiskLogVo {
+
+    @ApiModelProperty(value = "日志发送方")
+    private String logSender;
+
+    @ApiModelProperty(value = "日志接收方")
+    private String logReceiver;
+
+    @ApiModelProperty(value = "姓名")
+    private String userName;
+
+    @ApiModelProperty(value = "身份证号码")
+    private String idcard;
+
+    @ApiModelProperty(value = "风险类型")
+    private String riskType;
+
+    @ApiModelProperty(value = "风险内容")
+    private String riskContent;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @ApiModelProperty(value = "风险发送时间")
+    private Date logSendTime;
+
+}

+ 24 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/element/vo/EnvElementSaveVo.java

@@ -0,0 +1,24 @@
+package com.dragoninfo.dcuc.auth.element.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Data
+@ApiModel(value = "环境要素保存Vo")
+public class EnvElementSaveVo {
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "环境要素类型 码表值")
+    private String envElementType;
+
+    @ApiModelProperty(value = "环境要素名称")
+    private String envElementName;
+
+}

+ 31 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/element/vo/RespEnvElementVo.java

@@ -0,0 +1,31 @@
+package com.dragoninfo.dcuc.auth.element.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Data
+@ApiModel(value = "环境要素Vo")
+public class RespEnvElementVo {
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "环境要素类型 码表值")
+    private String envElementType;
+
+    @ApiModelProperty(value = "环境要素名称")
+    private String envElementName;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date createTime;
+}

+ 15 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/IAuthApplyBusiness.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.business;
 
 import com.dragoninfo.dcuc.auth.auth.dto.*;
+import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
@@ -105,4 +106,18 @@ public interface IAuthApplyBusiness {
      * @return
      */
     ResponseDTO<FlowDefineInfoDTO> getFlowDefineInfo(String applyType);
+
+    /**
+     * 权限自助申请红名单校验
+     * @param resourceInfos
+     * @return
+     */
+    Boolean redListCheck(List<AppFunAuthResourceDTO> resourceInfos);
+
+    /**
+     * 权限申请命中红名单风险日志
+     * @param searchDTO
+     * @return
+     */
+    Page<RedListRiskLogVo> redListApplyLog(SearchDTO searchDTO);
 }

+ 66 - 9
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/AuthApplyBusiness.java

@@ -10,20 +10,21 @@ import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.business.IAuthApplyBusiness;
 import com.dragoninfo.dcuc.auth.auth.constance.AuthFlowOpeCons;
 import com.dragoninfo.dcuc.auth.auth.dto.*;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunApplyContent;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragoninfo.dcuc.auth.auth.entity.*;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunApplyContentService;
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthResultService;
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunInfoService;
-import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
+import com.dragoninfo.dcuc.auth.auth.event.RedListCheckEvent;
+import com.dragoninfo.dcuc.auth.auth.service.*;
+import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
 import com.dragoninfo.dcuc.auth.config.DcucAuthApprovalConfig;
 import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
 import com.dragoninfo.dcuc.auth.constance.ApprovalApiConstance;
+import com.dragoninfo.dcuc.auth.list.entity.RedListContent;
+import com.dragoninfo.dcuc.auth.list.entity.WhiteList;
+import com.dragoninfo.dcuc.auth.list.service.IRedListService;
+import com.dragoninfo.dcuc.auth.list.service.IWhiteListService;
 import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.enumresource.SubObjTypeEnum;
 import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
 import com.dragoninfo.dcuc.auth.util.WorkFlowTimeUtil;
 import com.dragoninfo.dcuc.common.Constants;
@@ -41,7 +42,6 @@ import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.UUIDUtils;
-import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.context.ContextUtils;
 import com.dragonsoft.duceap.core.search.Searchable;
@@ -49,12 +49,14 @@ import com.dragonsoft.duceap.core.search.enums.SearchOperator;
 import com.dragonsoft.duceap.core.search.filter.Condition;
 import com.google.common.base.Joiner;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.http.Header;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
 import org.apache.http.message.BasicHeader;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.Pageable;
@@ -101,6 +103,17 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
     @Autowired
     private IAppFunInfoService appFunInfoService;
 
+    @Autowired
+    private IRedListService redListService;
+
+    @Autowired
+    private IWhiteListService whiteListService;
+
+    @Autowired
+    private IRedListRiskLogService redListRiskLogService;
+
+    @Autowired
+    private ApplicationEventPublisher publisher;
 
     @Override
     public ResponseStatus funApplySave(AppFunAuthApplyDTO authApplyDTO) {
@@ -146,11 +159,22 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
             String applicantOrdNo = status.getResult().toString();
             workFlow.setApplicantOrdNo(applicantOrdNo);
             workFlowService.update(workFlow);
+            // 申请内容命中红名单校验
+            sendRedListCheckEvent(authApplyDTO.getResourceInfos());
         }
         return status;
 
     }
 
+    private void sendRedListCheckEvent(List<AppFunAuthResourceDTO> resourceInfos) {
+        String userId = UserContextUtils.getCurrentUser().getId();
+        RedListCheckEventDto eventDto = new RedListCheckEventDto();
+        eventDto.setApplyUserId(userId);
+        eventDto.setResourceInfos(resourceInfos);
+        RedListCheckEvent event = new RedListCheckEvent(this, eventDto);
+        publisher.publishEvent(event);
+    }
+
     private List<AppFunAuthResourceDTO> fillResourceInfo(List<AppFunAuthResourceDTO> resourceInfos,
                                                          List<AppFunAuthResourceDTO> delResourceInfos,
                                                          AuthUserInfo userInfo) {
@@ -544,6 +568,39 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
         return ResponseDTO.success(ResponseStatus.SUCCESS_CODE, dto);
     }
 
+    @Override
+    public Boolean redListCheck(List<AppFunAuthResourceDTO> resourceInfos) {
+        String userId = UserContextUtils.getCurrentUser().getId();
+        List<String> funIds = resourceInfos.stream().map(AppFunAuthResourceDTO::getFunId).collect(Collectors.toList());
+        List<RedListContent> redList = redListService.getRedListContentByFunIds(funIds);
+        if (CollectionUtils.isEmpty(redList)) {
+            return false;
+        }
+        WhiteList userWhite = whiteListService.getBySubId(SubObjTypeEnum.SUB_USER.getCode(), userId);
+        if (null == userWhite) {
+            return true;
+        }
+        String level = userWhite.getLevel();
+        List<RedListContent> collect = redList.stream().filter(e -> e.getLevel().compareTo(level) >= 1).collect(Collectors.toList());
+        return CollectionUtils.isNotEmpty(collect);
+    }
+
+    @Override
+    public Page<RedListRiskLogVo> redListApplyLog(SearchDTO searchDTO) {
+        Searchable searchable = Searchable.toSearchable(searchDTO);
+        Page<RedListRiskLog> page = redListRiskLogService.pageSearch(searchable);
+        if (page.isEmpty()) {
+            return new PageImpl<>(new ArrayList<>(), searchable.getPage(),0L);
+        }
+        List<RedListRiskLog> content = page.getContent();
+        List<RedListRiskLogVo> collect = content.stream().map(e -> {
+            RedListRiskLogVo logVo = new RedListRiskLogVo();
+            BeanUtils.copyProperties(e, logVo);
+            return logVo;
+        }).collect(Collectors.toList());
+        return new PageImpl<>(collect, page.getPageable(), page.getTotalElements());
+    }
+
     private String getApprovalUrl(String applyOrdNo, String approvalApi) {
         String url = authConfig.getApprovalCenterUrl();
         approvalApi = approvalApi.replace("{approveNo}", applyOrdNo);

+ 26 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/event/RedListCheckEvent.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.auth.auth.event;
+
+import com.dragoninfo.dcuc.auth.auth.dto.RedListCheckEventDto;
+import org.springframework.context.ApplicationEvent;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+public class RedListCheckEvent extends ApplicationEvent {
+
+    private RedListCheckEventDto dto;
+
+    public RedListCheckEvent(Object source, RedListCheckEventDto dto) {
+        super(source);
+        this.dto = dto;
+    }
+
+    public RedListCheckEventDto getDto() {
+        return dto;
+    }
+
+    public void setDto(RedListCheckEventDto dto) {
+        this.dto = dto;
+    }
+}

+ 11 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/AuthApplyFacade.java

@@ -2,6 +2,7 @@ package com.dragoninfo.dcuc.auth.auth.facade;
 
 import com.dragoninfo.dcuc.auth.auth.business.IAuthApplyBusiness;
 import com.dragoninfo.dcuc.auth.auth.dto.*;
+import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
@@ -81,4 +82,14 @@ public class AuthApplyFacade implements IAuthApplyFacade {
     public ResponseDTO<FlowDefineInfoDTO> getFlowDefineInfo(String applyType) {
         return authApplyBusiness.getFlowDefineInfo(applyType);
     }
+
+    @Override
+    public Boolean redListCheck(List<AppFunAuthResourceDTO> resourceInfos) {
+        return authApplyBusiness.redListCheck(resourceInfos);
+    }
+
+    @Override
+    public Page<RedListRiskLogVo> redListApplyLog(SearchDTO searchDTO) {
+        return authApplyBusiness.redListApplyLog(searchDTO);
+    }
 }

+ 88 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/listener/RedListRiskLogListener.java

@@ -0,0 +1,88 @@
+package com.dragoninfo.dcuc.auth.auth.listener;
+
+import cn.hutool.core.util.StrUtil;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResourceDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunInfoDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.RedListCheckEventDto;
+import com.dragoninfo.dcuc.auth.auth.entity.RedListRiskLog;
+import com.dragoninfo.dcuc.auth.auth.event.RedListCheckEvent;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunInfoService;
+import com.dragoninfo.dcuc.auth.auth.service.IRedListRiskLogService;
+import com.dragoninfo.dcuc.auth.list.entity.RedListContent;
+import com.dragoninfo.dcuc.auth.list.entity.WhiteList;
+import com.dragoninfo.dcuc.auth.list.service.IRedListService;
+import com.dragoninfo.dcuc.auth.list.service.IWhiteListService;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.enumresource.SubObjTypeEnum;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Component
+public class RedListRiskLogListener {
+
+    @Autowired
+    private IRedListService redListService;
+
+    @Autowired
+    private IWhiteListService whiteListService;
+
+    @Autowired
+    private IAppFunInfoService appFunInfoService;
+
+    @Autowired
+    private IAuthUserInfoService userInfoService;
+
+    @Autowired
+    private IRedListRiskLogService redListRiskLogService;
+
+
+    @Async
+    @EventListener(RedListCheckEvent.class)
+    public void handel(RedListCheckEvent event) {
+        RedListCheckEventDto dto = event.getDto();
+        String userId = dto.getApplyUserId();
+        List<AppFunAuthResourceDTO> resourceInfos = dto.getResourceInfos();
+        List<String> funIds = resourceInfos.stream().map(AppFunAuthResourceDTO::getFunId).collect(Collectors.toList());
+        List<RedListContent> redList = redListService.getRedListContentByFunIds(funIds);
+        // 不存在风险内容
+        if (CollectionUtils.isEmpty(redList)) {
+            return ;
+        }
+        WhiteList userWhite = whiteListService.getBySubId(SubObjTypeEnum.SUB_USER.getCode(), userId);
+        // 过滤在白名单等级之上的命中红名单菜单
+        if (null != userWhite) {
+            String level = userWhite.getLevel();
+            redList = redList.stream().filter(e -> e.getLevel().compareTo(level) >= 1).collect(Collectors.toList());
+        }
+        RedListRiskLog riskLog = getRiskLog(userId, redList);
+        redListRiskLogService.save(riskLog);
+    }
+
+    private RedListRiskLog getRiskLog(String userId, List<RedListContent> redList) {
+        List<String> collect = redList.stream().map(RedListContent::getFunId).collect(Collectors.toList());
+        List<AppFunInfoDTO> funInfos = appFunInfoService.getByIds(collect);
+        String funNames = funInfos.stream().map(AppFunInfoDTO::getName).collect(Collectors.joining(StrUtil.COMMA));
+        AuthUserInfo userInfo = userInfoService.findById(userId);
+        RedListRiskLog riskLog = new RedListRiskLog();
+        if (null != userInfo) {
+            riskLog.setIdcard(userInfo.getIdcard());
+            riskLog.setUserName(userInfo.getName());
+        }
+        riskLog.setRiskContent(funNames);
+        riskLog.setLogReceiver("权限服务");
+        riskLog.setLogSender("权限服务");
+        riskLog.setRiskType("01");
+        return riskLog;
+    }
+}

+ 13 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/RedListRiskLogReposiroty.java

@@ -0,0 +1,13 @@
+package com.dragoninfo.dcuc.auth.auth.repo;
+
+import com.dragoninfo.dcuc.auth.auth.entity.RedListRiskLog;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Repository
+public interface RedListRiskLogReposiroty extends BaseRepository<RedListRiskLog,String> {
+}

+ 25 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IRedListRiskLogService.java

@@ -0,0 +1,25 @@
+package com.dragoninfo.dcuc.auth.auth.service;
+
+import com.dragoninfo.dcuc.auth.auth.entity.RedListRiskLog;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.data.domain.Page;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+public interface IRedListRiskLogService {
+
+    /**
+     * 保存
+     * @param riskLog
+     */
+    void save(RedListRiskLog riskLog);
+
+    /**
+     * 分页查询
+     * @param searchable
+     * @return
+     */
+    Page<RedListRiskLog> pageSearch(Searchable searchable);
+}

+ 30 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RedListRiskLogServiceImpl.java

@@ -0,0 +1,30 @@
+package com.dragoninfo.dcuc.auth.auth.service.impl;
+
+import com.dragoninfo.dcuc.auth.auth.entity.RedListRiskLog;
+import com.dragoninfo.dcuc.auth.auth.repo.RedListRiskLogReposiroty;
+import com.dragoninfo.dcuc.auth.auth.service.IRedListRiskLogService;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Service
+public class RedListRiskLogServiceImpl implements IRedListRiskLogService {
+
+    @Autowired
+    private RedListRiskLogReposiroty reposiroty;
+
+    @Override
+    public void save(RedListRiskLog riskLog) {
+        reposiroty.save(riskLog);
+    }
+
+    @Override
+    public Page<RedListRiskLog> pageSearch(Searchable searchable) {
+        return reposiroty.paging(searchable);
+    }
+}

+ 24 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/business/IEnvElementBusiness.java

@@ -0,0 +1,24 @@
+package com.dragoninfo.dcuc.auth.element.business;
+
+import com.dragoninfo.dcuc.auth.element.vo.EnvElementSaveVo;
+import com.dragoninfo.dcuc.auth.element.vo.RespEnvElementVo;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.data.domain.Page;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+public interface IEnvElementBusiness {
+
+    RespEnvElementVo getById(String id);
+
+    Page<RespEnvElementVo> pageSearch(SearchDTO searchDTO);
+
+    ResponseStatus save(EnvElementSaveVo envElementVo);
+
+    ResponseStatus update(EnvElementSaveVo envElementVo);
+
+    ResponseStatus deleteById(String id);
+}

+ 83 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/business/impl/EnvElementBusiness.java

@@ -0,0 +1,83 @@
+package com.dragoninfo.dcuc.auth.element.business.impl;
+
+import com.dragoninfo.dcuc.auth.element.business.IEnvElementBusiness;
+import com.dragoninfo.dcuc.auth.element.entity.EnvElement;
+import com.dragoninfo.dcuc.auth.element.service.IEnvElementService;
+import com.dragoninfo.dcuc.auth.element.vo.EnvElementSaveVo;
+import com.dragoninfo.dcuc.auth.element.vo.RespEnvElementVo;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.core.search.Searchable;
+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.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Service
+public class EnvElementBusiness implements IEnvElementBusiness {
+
+    @Autowired
+    private IEnvElementService envElementService;
+
+    @Override
+    public RespEnvElementVo getById(String id) {
+        EnvElement envElement = envElementService.getById(id);
+        if (null == envElement) {
+            return null;
+        }
+        RespEnvElementVo vo = new RespEnvElementVo();
+        BeanUtils.copyProperties(envElement, vo);
+        return vo;
+    }
+
+    @Override
+    public Page<RespEnvElementVo> pageSearch(SearchDTO searchDTO) {
+        Searchable searchable = Searchable.toSearchable(searchDTO);
+        Page<EnvElement> page = envElementService.page(searchable);
+        if (page.isEmpty()) {
+            return new PageImpl<>(new ArrayList<>(), searchable.getPage(), 0L);
+        }
+        List<EnvElement> content = page.getContent();
+        List<RespEnvElementVo> collect = content.stream().map(e -> {
+            RespEnvElementVo vo = new RespEnvElementVo();
+            BeanUtils.copyProperties(e, vo);
+            return vo;
+        }).collect(Collectors.toList());
+        return new PageImpl<>(collect, page.getPageable(), collect.size());
+    }
+
+    @Override
+    public ResponseStatus save(EnvElementSaveVo envElementVo) {
+        EnvElement envElement = new EnvElement();
+        BeanUtils.copyProperties(envElementVo, envElement);
+        envElementService.save(envElement);
+        return ResponseStatus.success();
+    }
+
+    @Override
+    public ResponseStatus update(EnvElementSaveVo envElementVo) {
+        EnvElement element = envElementService.getById(envElementVo.getId());
+        if (null == element) {
+            return ResponseStatus.fail("环境要素不存在");
+        }
+        BeanUtils.copyProperties(envElementVo, element,"createUser", "createTime");
+        envElementService.update(element);
+        return ResponseStatus.success();
+    }
+
+    @Override
+    public ResponseStatus deleteById(String id) {
+        envElementService.deleted(id);
+        return ResponseStatus.success();
+    }
+}

+ 73 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/entity/EnvElement.java

@@ -0,0 +1,73 @@
+package com.dragoninfo.dcuc.auth.element.entity;
+
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedBy;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_AUTH_ENV_ELE")
+public class EnvElement {
+
+    /**
+     * ID
+     */
+    @Id
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /**
+     * 环境要素类型
+     */
+    @Column(name = "ENV_ELE_TYPE")
+    private String envElementType;
+
+    /**
+     * 环境要素名称
+     */
+    @Column(name = "ENV_ELE_NAME")
+    private String envElementName;
+
+    /**
+     * 新增时间
+     */
+    @CreatedDate
+    @Column(name = "CREATE_TIME")
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    @CreatedBy
+    @Column(name = "CREATE_USER")
+    private String createUser;
+
+    /**
+     * 更新时间
+     */
+    @LastModifiedDate
+    @Column(name = "UPDATE_TIME")
+    private Date updateTime;
+
+    /**
+     * 更新人
+     */
+    @LastModifiedBy
+    @Column(name = "UPDATE_USER")
+    private String updateUser;
+
+}

+ 48 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/facade/EnvElementFacade.java

@@ -0,0 +1,48 @@
+package com.dragoninfo.dcuc.auth.element.facade;
+
+import com.dragoninfo.dcuc.auth.element.business.IEnvElementBusiness;
+import com.dragoninfo.dcuc.auth.element.vo.EnvElementSaveVo;
+import com.dragoninfo.dcuc.auth.element.vo.RespEnvElementVo;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+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 mazq
+ * @date 2022/8/25
+ */
+@RestController
+@RequestMapping("/dcuc/auth/envElementFacade")
+public class EnvElementFacade implements IEnvElementFacade {
+
+    @Autowired
+    private IEnvElementBusiness envElementBusiness;
+
+    @Override
+    public RespEnvElementVo getById(String id) {
+        return envElementBusiness.getById(id);
+    }
+
+    @Override
+    public Page<RespEnvElementVo> pageSearch(SearchDTO searchDTO) {
+        return envElementBusiness.pageSearch(searchDTO);
+    }
+
+    @Override
+    public ResponseStatus save(EnvElementSaveVo envElementVo) {
+        return envElementBusiness.save(envElementVo);
+    }
+
+    @Override
+    public ResponseStatus update(EnvElementSaveVo envElementVo) {
+        return envElementBusiness.update(envElementVo);
+    }
+
+    @Override
+    public ResponseStatus deleteById(String id) {
+        return envElementBusiness.deleteById(id);
+    }
+}

+ 13 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/repo/EnvElementRepository.java

@@ -0,0 +1,13 @@
+package com.dragoninfo.dcuc.auth.element.repo;
+
+import com.dragoninfo.dcuc.auth.element.entity.EnvElement;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Repository
+public interface EnvElementRepository extends BaseRepository<EnvElement,String> {
+}

+ 23 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/service/IEnvElementService.java

@@ -0,0 +1,23 @@
+package com.dragoninfo.dcuc.auth.element.service;
+
+import com.dragoninfo.dcuc.auth.element.entity.EnvElement;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.data.domain.Page;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+public interface IEnvElementService {
+
+    EnvElement getById(String id);
+
+    EnvElement save(EnvElement element);
+
+    void update(EnvElement element);
+
+    void deleted(String id);
+
+    Page<EnvElement> page(Searchable searchable);
+
+}

+ 56 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/element/service/impl/EnvElementServiceImpl.java

@@ -0,0 +1,56 @@
+package com.dragoninfo.dcuc.auth.element.service.impl;
+
+import com.dragoninfo.dcuc.auth.element.entity.EnvElement;
+import com.dragoninfo.dcuc.auth.element.repo.EnvElementRepository;
+import com.dragoninfo.dcuc.auth.element.service.IEnvElementService;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author mazq
+ * @date 2022/8/25
+ */
+@Service
+public class EnvElementServiceImpl implements IEnvElementService {
+
+    @Autowired
+    private EnvElementRepository repository;
+
+
+    @Override
+    public EnvElement getById(String id) {
+        if (StringUtils.isBlank(id)) {
+            return null;
+        }
+        return repository.findOne(id);
+    }
+
+    @Override
+    public EnvElement save(EnvElement element) {
+        return repository.save(element);
+    }
+
+    @Override
+    public void update(EnvElement element) {
+        if (null == element || StringUtils.isBlank(element.getId())) {
+            return;
+        }
+        repository.update(element);
+    }
+
+    @Override
+    public void deleted(String id) {
+        if (StringUtils.isBlank(id)) {
+            return;
+        }
+        repository.deleteById(id);
+    }
+
+    @Override
+    public Page<EnvElement> page(Searchable searchable) {
+        return repository.paging(searchable);
+    }
+}

+ 8 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IRedListService.java

@@ -6,6 +6,7 @@ import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListDTO;
 import com.dragoninfo.dcuc.auth.list.dto.FunRedListTreeDTO;
 import com.dragoninfo.dcuc.auth.list.dto.RedListOperateDTO;
 import com.dragoninfo.dcuc.auth.list.entity.RedList;
+import com.dragoninfo.dcuc.auth.list.entity.RedListContent;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.core.search.Searchable;
 import org.springframework.data.domain.Page;
@@ -84,4 +85,11 @@ public interface IRedListService {
      * @return
      */
     List<AppFunRedListDTO> funRedListContentSearch(Searchable searchable);
+
+    /**
+     * 根据菜单id获取是否添加过红名单
+     * @param funIds
+     * @return
+     */
+    List<RedListContent> getRedListContentByFunIds(List<String> funIds);
 }

+ 10 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IWhiteListService.java

@@ -2,6 +2,7 @@ package com.dragoninfo.dcuc.auth.list.service;
 
 import com.dragoninfo.dcuc.auth.list.dto.WhiteListOperateDTO;
 import com.dragoninfo.dcuc.auth.list.dto.WhiteListUserDTO;
+import com.dragoninfo.dcuc.auth.list.entity.WhiteList;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import org.springframework.data.domain.Page;
@@ -55,4 +56,13 @@ public interface IWhiteListService {
      * @return
      */
     ResponseDTO<List<WhiteListUserDTO>> userWhiteListSearch(SearchDTO searchDTO);
+
+    /**
+     * 根据主体id获取用户白名单
+     *
+     * @param subType
+     * @param subId
+     * @return
+     */
+    WhiteList getBySubId(String subType, String subId);
 }

+ 2 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/RedListServiceImpl.java

@@ -494,7 +494,8 @@ public class RedListServiceImpl implements IRedListService {
      * @param funIds
      * @return
      */
-    private List<RedListContent> getRedListContentByFunIds(List<String> funIds) {
+    @Override
+    public List<RedListContent> getRedListContentByFunIds(List<String> funIds) {
         Searchable searchable = Searchable.newSearchable();
         searchable.addSearchFilter("funId", SearchOperator.in, funIds);
         searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.value);

+ 10 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/WhiteListServiceImpl.java

@@ -17,6 +17,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
 import com.dragonsoft.duceap.core.search.filter.Condition;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.Pageable;
@@ -215,4 +216,13 @@ public class WhiteListServiceImpl implements IWhiteListService {
         list = getWhiteListUsers(authUserInfos, all);
         return ResponseDTO.success("success", list);
     }
+
+    @Override
+    public WhiteList getBySubId(String subType, String subId) {
+        WhiteList whiteList = new WhiteList();
+        whiteList.setSubId(subId);
+        whiteList.setSubType(subType);
+        Example<WhiteList> example = Example.of(whiteList);
+        return whiteListRepository.findOne(example).orElse(null);
+    }
 }

+ 41 - 0
dcuc-auth-service/src/main/resources/config/mysql/V4_3_0027__AddEnvElement.sql

@@ -0,0 +1,41 @@
+CREATE TABLE `T_AUTH_ENV_ELE` (
+      `ID` varchar(32) NOT NULL COMMENT '主键id',
+      `ENV_ELE_TYPE` varchar(10) DEFAULT NULL COMMENT '环境要素类型',
+      `ENV_ELE_NAME` varchar(128) DEFAULT NULL COMMENT '环境要素名称',
+      `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间',
+      `CREATE_USER` varchar(32) DEFAULT NULL COMMENT '创建人员',
+      `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
+      `UPDATE_USER` varchar(32) DEFAULT NULL COMMENT '更新人员',
+      PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE `t_auth_red_list_risk_log` (
+    `ID` varchar(32) NOT NULL COMMENT '主键id',
+    `LOG_SENDER` varchar(128) DEFAULT NULL COMMENT '日志发送方',
+    `LOG_RECEIVER` varchar(128) DEFAULT NULL COMMENT '日志接收方',
+    `USER_NAME` varchar(128) DEFAULT NULL COMMENT '用户名',
+    `IDCARD` varchar(32) DEFAULT NULL COMMENT '身份证号',
+    `RISK_TYPE` varchar(10) DEFAULT NULL COMMENT '风险类型',
+    `RISK_CONTENT` varchar(512) DEFAULT NULL COMMENT '风险内容',
+    `LOG_SEND_TIME` datetime DEFAULT NULL COMMENT '创建时间',
+    PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE `dm_author_risk_type` (
+   `CODE` varchar(10) NOT NULL,
+   `VALUE` varchar(50) DEFAULT NULL,
+   PRIMARY KEY (`CODE`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE `dm_env_ele_type` (
+   `CODE` varchar(5) NOT NULL,
+   `VALUE` varchar(20) DEFAULT NULL,
+   PRIMARY KEY (`CODE`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO `t_md_sys_code_dic` ( `code_id`, `name`, `entity_name`, `code_field`, `name_field`)
+VALUES
+    ( 'DM_AUTHOR_RISK_TYPE', '授权风险类型', 'DM_AUTHOR_RISK_TYPE', 'CODE', 'VALUE');
+INSERT INTO `t_md_sys_code_dic` ( `code_id`, `name`, `entity_name`, `code_field`, `name_field`)
+VALUES
+    ( 'DM_ENV_ELE_TYPE', '环境要素类别', 'DM_ENV_ELE_TYPE', 'CODE', 'VALUE');