Explorar el Código

Merge branch 'mazq-roleauth-apply-231123' into 'master'

Mazq roleauth apply 231123

See merge request dcuc-tjdsj/app-service!96
黄资权 hace 1 año
padre
commit
8c624fe379

+ 0 - 9
dcuc-app-api/src/main/java/com/dragoninfo/dcuc/app/facade/IApplyInfoFacade.java

@@ -104,15 +104,6 @@ public interface IApplyInfoFacade {
     @PostMapping(value = "isRepeat")
     ResponseStatus isRepeat(@RequestBody ApplyInfo applyInfo);
 
-//    /**
-//     * 根据机构ID获取所有应用ID
-//     *
-//     * @param orgId 机构id
-//     * @return 应用ID集合
-//     */
-//    @RequestMapping(value = "getAppIdsByOrgId")
-//    List<String> getAppIdsByOrgId(@RequestParam("orgId") String orgId);
-
     /**
      * 根据施工人员id查看该人员负责的应用
      *

+ 8 - 0
dcuc-app-api/src/main/java/com/dragoninfo/dcuc/app/facade/IServiceResourceFacade.java

@@ -84,4 +84,12 @@ public interface IServiceResourceFacade {
      */
     @DeleteMapping(value = "/service-resource/{id}")
     ResponseStatus deleteById(@PathVariable(name = "id") String id);
+
+    /**
+     * 根据id集合获取
+     * @param serviceIds
+     * @return
+     */
+    @PostMapping("/service-resource/getByIds")
+    List<ServiceResourceVo> getServiceByIds(@RequestBody List<String> serviceIds);
 }

+ 26 - 0
dcuc-app-service/pom.xml

@@ -303,6 +303,32 @@
                             <testFailureIgnore>true</testFailureIgnore>
                         </configuration>
                     </plugin>
+                    <!--生成git-infos.properties 版本文件-->
+                    <plugin>
+                        <groupId>pl.project13.maven</groupId>
+                        <artifactId>git-commit-id-plugin</artifactId>
+                        <version>4.9.10</version>
+                        <executions>
+                            <execution>
+                                <id>get-the-git-infos</id>
+                                <goals>
+                                    <goal>revision</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <abbrevLength>8</abbrevLength>
+                            <dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
+                            <generateGitPropertiesFile>true</generateGitPropertiesFile>
+                            <includeOnlyProperties>
+                                <includeOnlyProperty>^git.branch</includeOnlyProperty>
+                                <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
+                                <includeOnlyProperty>^git.commit.(id|id.abbrev|message.full)*</includeOnlyProperty>
+                            </includeOnlyProperties>
+                            <generateGitPropertiesFilename>${project.build.outputDirectory}/git-infos.properties
+                            </generateGitPropertiesFilename>
+                        </configuration>
+                    </plugin>
                 </plugins>
             </build>
         </profile>

+ 0 - 25
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/AppEvent.java

@@ -1,25 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.dto.AppEventDTO;
-//import org.springframework.context.ApplicationEvent;
-//
-///**
-// * 应用改变事件
-// *
-// * @author huangzqa
-// * @date 2020/11/9
-// */
-//public class AppEvent extends ApplicationEvent {
-//    private static final long serialVersionUID = -5110876919669369672L;
-//
-//    private AppEventDTO appEventDTO;
-//
-//    public AppEvent(AppEventDTO appEventDTO) {
-//        super(appEventDTO);
-//        this.appEventDTO = appEventDTO;
-//    }
-//
-//    public AppEventDTO getAppEventDTO() {
-//        return appEventDTO;
-//    }
-//}

+ 0 - 105
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/AppEventListener.java

@@ -1,105 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.config.DcucAppKafkaConfig;
-//import com.dragoninfo.dcuc.app.dto.AppEventDTO;
-//import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-//import com.dragoninfo.dcuc.app.enumresources.AppMsgTypeEnum;
-//import com.dragoninfo.duceap.commons.util.kafka.KafkaServer;
-//import com.dragoninfo.mq.client.model.entity.MessageInfoVo;
-//import com.dragoninfo.mq.client.model.entity.RequestVo;
-//import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
-//import com.dragonsoft.duceap.commons.util.date.DateUtils;
-//import com.dragonsoft.duceap.commons.util.json.JsonUtils;
-//import com.dragonsoft.duceap.core.entity.response.ResponseResult;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.ApplicationListener;
-//import org.springframework.stereotype.Component;
-//
-//import java.util.Collections;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * @author huangzqa
-// * @date 2020/11/9
-// */
-//@Slf4j
-//@Component
-//public class AppEventListener implements ApplicationListener<AppEvent> {
-//
-//    @Autowired
-//    private DcucAppKafkaConfig dcucAppKafkaConfig;
-//
-//    @Autowired
-//    private KafkaServer kafkaServer;
-//
-//    @Override
-//    public void onApplicationEvent(AppEvent appEvent) {
-//        //应用变更消息主题
-//        String topic = dcucAppKafkaConfig.getAppChangeTopic();
-//
-//        AppEventDTO appEventDTO = appEvent.getAppEventDTO();
-//        BaseSecurityUser baseSecurityUser = appEventDTO.getBaseSecurityUser();
-//        ApplyInfo applyInfo = appEventDTO.getApplyInfo();
-//        AppMsgTypeEnum appMsgTypeEnum = appEventDTO.getAppMsgTypeEnum();
-//        String content = appEventDTO.getContent();
-//
-//        log.info("消息发送参数:topic:{},content:{},applyInfo:{}", topic, content, applyInfo);
-//
-//        // 转换为 map
-//        Map<String, String> stringStringMap = appToMap(applyInfo, appMsgTypeEnum);
-//        List<Map<String, String>> infoSet = Collections.singletonList(stringStringMap);
-//
-//        MessageInfoVo messageInfoVo = new MessageInfoVo(baseSecurityUser, "应用信息变更", content, topic);
-//        messageInfoVo.setInfoSet(infoSet);
-//
-//        List<MessageInfoVo> messages = Collections.singletonList(messageInfoVo);
-//
-//        RequestVo requestVo = new RequestVo();
-//        requestVo.setTopic(topic);
-//        requestVo.setAppKey(dcucAppKafkaConfig.getAppKey());
-//        requestVo.setAppSecret(dcucAppKafkaConfig.getAppSecret());
-//        requestVo.setMessages(messages);
-//
-//        ResponseResult result = kafkaServer.send(requestVo, dcucAppKafkaConfig.getServer());
-//        log.info("Send result: {}", JsonUtils.toJSONString(result));
-//    }
-//
-//    /**
-//     * 将应用转换为map
-//     *
-//     * @param applyInfo      应用信息
-//     * @param appMsgTypeEnum 操作类型
-//     * @return map
-//     */
-//    private Map<String, String> appToMap(ApplyInfo applyInfo, AppMsgTypeEnum appMsgTypeEnum) {
-//
-//        Map<String, String> map = new HashMap<>();
-//        map.put("OPERATE_TYPE", appMsgTypeEnum.getValue());
-//        map.put("ID", applyInfo.getId());
-//        map.put("APPLY_NAME", applyInfo.getApplyName());
-//        map.put("APPLY_CODE", applyInfo.getApplyCode());
-//        map.put("APPLY_STATUS", applyInfo.getApplyStatus());
-//        map.put("APPLY_CATEGORY", applyInfo.getApplyCategory());
-//        map.put("POLICE_SPECIES", applyInfo.getPoliceSpecies());
-//        map.put("ORG_CODE", applyInfo.getOrgCode());
-//        map.put("ORG_NAME", applyInfo.getOrgName());
-//        map.put("APPLY_URL", applyInfo.getApplyUrl());
-//        map.put("MANUFACTURER_ID", applyInfo.getManufacturerId());
-//        map.put("MANUFACTURER_NAME", applyInfo.getManufacturerName());
-//        map.put("MANAGER_DESCRIBE", applyInfo.getManagerDescribe());
-//        map.put("API_KEY", applyInfo.getApiKey());
-//        map.put("SECRET_KEY", applyInfo.getSecretKey());
-//        map.put("DELETED", applyInfo.getDeleted());
-//        map.put("REGISTRATION_TIME", DateUtils.getDateFormat(applyInfo.getRegistrationTime()));
-//        map.put("SORT", applyInfo.getSort());
-//        map.put("MANAGER_NAME", applyInfo.getManagerName());
-//        map.put("MANAGER_PHONE", applyInfo.getManagerPhone());
-//        map.put("FZR", applyInfo.getFzr());
-//        map.put("FZR_PHONE", applyInfo.getFzrPhone());
-//        map.put("APPLY_ICON", applyInfo.getApplyIcon());
-//        return map;
-//    }
-//}

+ 0 - 45
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/EventPublisher.java

@@ -1,45 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.dto.AppEventDTO;
-//import com.dragoninfo.dcuc.app.dto.ManufacturerEventDTO;
-//import com.dragoninfo.dcuc.app.dto.UpdateUserInfoEventDTO;
-//import org.springframework.beans.BeansException;
-//import org.springframework.context.ApplicationContext;
-//import org.springframework.context.ApplicationContextAware;
-//import org.springframework.scheduling.annotation.Async;
-//import org.springframework.stereotype.Component;
-//
-///**
-// * 服务事件发布类
-// *
-// * @author huangzqa
-// * @date 2020/11/9
-// */
-//@Component
-//public class EventPublisher implements ApplicationContextAware {
-//
-//    private ApplicationContext applicationContext;
-//
-//    @Async
-//    public void publishAppEvent(AppEventDTO appEventDTO) {
-//        AppEvent appEvent = new AppEvent(appEventDTO);
-//        applicationContext.publishEvent(appEvent);
-//    }
-//
-//    @Async
-//    public void publishManufacturerEvent(ManufacturerEventDTO manufacturerEventDTO) {
-//        ManufacturerEvent manufacturerEvent = new ManufacturerEvent(manufacturerEventDTO);
-//        applicationContext.publishEvent(manufacturerEvent);
-//    }
-//
-//    @Async
-//    public void publishUpdateUserInfoEvent(UpdateUserInfoEventDTO updateUserInfoEventDTO) {
-//        UpdateUserInfoEvent updateUserInfoEvent = new UpdateUserInfoEvent(updateUserInfoEventDTO);
-//        applicationContext.publishEvent(updateUserInfoEvent);
-//    }
-//
-//    @Override
-//    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-//        this.applicationContext = applicationContext;
-//    }
-//}

+ 0 - 25
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/ManufacturerEvent.java

@@ -1,25 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.dto.ManufacturerEventDTO;
-//import org.springframework.context.ApplicationEvent;
-//
-///**
-// * 厂商改变事件
-// *
-// * @author huangzqa
-// * @date 2020/11/10
-// */
-//public class ManufacturerEvent extends ApplicationEvent {
-//    private static final long serialVersionUID = -3738969636861738884L;
-//
-//    private ManufacturerEventDTO manufacturerEventDTO;
-//
-//    public ManufacturerEvent(ManufacturerEventDTO manufacturerEventDTO) {
-//        super(manufacturerEventDTO);
-//        this.manufacturerEventDTO = manufacturerEventDTO;
-//    }
-//
-//    public ManufacturerEventDTO getManufacturerEventDTO() {
-//        return manufacturerEventDTO;
-//    }
-//}

+ 0 - 85
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/ManufacturerEventListener.java

@@ -1,85 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.config.DcucAppKafkaConfig;
-//import com.dragoninfo.dcuc.app.dto.ManufacturerEventDTO;
-//import com.dragoninfo.dcuc.app.entity.ManufacturerInfo;
-//import com.dragoninfo.dcuc.app.enumresources.ManufacturerMsgTypeEnum;
-//import com.dragoninfo.duceap.commons.util.kafka.KafkaServer;
-//import com.dragoninfo.mq.client.model.entity.MessageInfoVo;
-//import com.dragoninfo.mq.client.model.entity.RequestVo;
-//import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
-//import com.dragonsoft.duceap.commons.util.json.JsonUtils;
-//import com.dragonsoft.duceap.core.entity.response.ResponseResult;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.ApplicationListener;
-//import org.springframework.stereotype.Component;
-//
-//import java.util.Collections;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * @author huangzqa
-// * @date 2020/11/10
-// */
-//@Slf4j
-//@Component
-//public class ManufacturerEventListener implements ApplicationListener<ManufacturerEvent> {
-//
-//    @Autowired
-//    private DcucAppKafkaConfig dcucAppKafkaConfig;
-//
-//    @Autowired
-//    private KafkaServer kafkaServer;
-//
-//    @Override
-//    public void onApplicationEvent(ManufacturerEvent event) {
-//        boolean manufacturerChangeEnable = dcucAppKafkaConfig.getManufacturerChangeEnable();
-//        if (manufacturerChangeEnable) {
-//            ManufacturerEventDTO manufacturerEventDTO = event.getManufacturerEventDTO();
-//            BaseSecurityUser baseSecurityUser = manufacturerEventDTO.getBaseSecurityUser();
-//            ManufacturerInfo manufacturerInfo = manufacturerEventDTO.getManufacturerInfo();
-//            String content = manufacturerEventDTO.getContent();
-//            ManufacturerMsgTypeEnum manufacturerMsgTypeEnum = manufacturerEventDTO.getManufacturerMsgTypeEnum();
-//
-//            String topic = dcucAppKafkaConfig.getManufacturerChangeTopic();
-//
-//            log.info("消息发送参数:topic:{},content:{},manufacturerInfo:{}", topic, content, manufacturerInfo);
-//
-//            // 转换为 map
-//            Map<String, String> stringStringMap = manufactureTorMap(manufacturerInfo, manufacturerMsgTypeEnum);
-//            List<Map<String, String>> infoSet = Collections.singletonList(stringStringMap);
-//
-//            MessageInfoVo messageInfoVo = new MessageInfoVo(baseSecurityUser, "厂商信息变更", content, topic);
-//            messageInfoVo.setInfoSet(infoSet);
-//
-//            List<MessageInfoVo> messages = Collections.singletonList(messageInfoVo);
-//
-//            RequestVo requestVo = new RequestVo();
-//            requestVo.setTopic(topic);
-//            requestVo.setAppKey(dcucAppKafkaConfig.getAppKey());
-//            requestVo.setAppSecret(dcucAppKafkaConfig.getAppSecret());
-//            requestVo.setMessages(messages);
-//            log.info(Thread.currentThread().getName());
-//            ResponseResult result = kafkaServer.send(requestVo, dcucAppKafkaConfig.getServer());
-//            log.info("Send result: {}", JsonUtils.toJSONString(result));
-//        }
-//
-//    }
-//
-//    public Map<String, String> manufactureTorMap(ManufacturerInfo manufacturerInfo, ManufacturerMsgTypeEnum manufacturerMsgTypeEnum) {
-//        Map<String, String> map = new HashMap<>();
-//        map.put("OPERATE_TYPE", manufacturerMsgTypeEnum.getValue());
-//        map.put("ID", manufacturerInfo.getId());
-//        map.put("MANUFACTURER_NAME", manufacturerInfo.getManufacturerName());
-//        map.put("NAME", manufacturerInfo.getName());
-//        map.put("IDCARD", manufacturerInfo.getIdcard());
-//        map.put("PHONE", manufacturerInfo.getPhone());
-//        map.put("CODE", manufacturerInfo.getCode());
-//        map.put("ADDRESS", manufacturerInfo.getAddress());
-//        map.put("DELETED", manufacturerInfo.getDeleted());
-//        return map;
-//    }
-//}

+ 0 - 24
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/UpdateUserInfoEvent.java

@@ -1,24 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.dto.UpdateUserInfoEventDTO;
-//import org.springframework.context.ApplicationEvent;
-//
-///**
-// * @author huangzqa
-// * @date 2020/11/10
-// */
-//public class UpdateUserInfoEvent extends ApplicationEvent {
-//
-//    private static final long serialVersionUID = 448843421966193765L;
-//
-//    private UpdateUserInfoEventDTO updateUserInfoEventDTO;
-//
-//    public UpdateUserInfoEvent(UpdateUserInfoEventDTO updateUserInfoEventDTO) {
-//        super(updateUserInfoEventDTO);
-//        this.updateUserInfoEventDTO = updateUserInfoEventDTO;
-//    }
-//
-//    public UpdateUserInfoEventDTO getUpdateUserInfoEventDTO() {
-//        return updateUserInfoEventDTO;
-//    }
-//}

+ 0 - 43
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/event/UpdateUserInfoEventListener.java

@@ -1,43 +0,0 @@
-//package com.dragoninfo.dcuc.app.event;
-//
-//import com.dragoninfo.dcuc.app.dto.UpdateUserInfoEventDTO;
-//import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-//import com.dragoninfo.dcuc.org.entity.OrgInfo;
-//import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-//import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.ApplicationListener;
-//import org.springframework.stereotype.Component;
-//
-///**
-// * @author huangzqa
-// * @date 2020/11/10
-// */
-//@Slf4j
-//@Component
-//public class UpdateUserInfoEventListener implements ApplicationListener<UpdateUserInfoEvent> {
-//
-//    @Autowired
-//    private IOrgInfoFacade orgInfoFacade;
-//
-//    @Autowired
-//    private IUserInfoFacade userInfoFacade;
-//
-//    @Override
-//    public void onApplicationEvent(UpdateUserInfoEvent event) {
-//        UpdateUserInfoEventDTO updateUserInfoEventDTO = event.getUpdateUserInfoEventDTO();
-//        ApplyInfo applyInfo = updateUserInfoEventDTO.getApplyInfo();
-//
-//        String applyInfoId = applyInfo.getId();
-//        String orgId = applyInfo.getOrgId();
-//        // 获取机构信息
-//        OrgInfo orgInfo = orgInfoFacade.detail(orgId);
-//        String fullName = orgInfo.getFullName();
-//        String code = orgInfo.getCode();
-//        // todo 使用消息
-//        log.info("更新施工人员冗余信息orgId:{},fullName:{},code:{},appId:{}", orgId, fullName, code, applyInfoId);
-//
-//        userInfoFacade.updateExternalPersonnel(orgId, fullName, code, applyInfoId);
-//    }
-//}

+ 6 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/facade/ServiceResourceFacade.java

@@ -105,4 +105,10 @@ public class ServiceResourceFacade implements IServiceResourceFacade {
     public ResponseStatus deleteById(String id) {
         return serviceResourceService.deleteServiceResourceById(id);
     }
+
+
+    @Override
+    public List<ServiceResourceVo> getServiceByIds(List<String> serviceIds) {
+        return serviceResourceService.getServiceByIds(serviceIds);
+    }
 }

+ 7 - 0
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/IServiceResourceService.java

@@ -84,4 +84,11 @@ public interface IServiceResourceService extends IBaseService<ServiceResource, S
      * @return
      */
     Long count(Date startTime, Date endTime);
+
+    /**
+     * 根据id获取资源
+     * @param serviceIds
+     * @return
+     */
+    List<ServiceResourceVo> getServiceByIds(List<String> serviceIds);
 }

+ 13 - 4
dcuc-app-service/src/main/java/com/dragoninfo/dcuc/app/service/impl/ServiceResourceServiceImpl.java

@@ -12,6 +12,7 @@ import com.dragoninfo.dcuc.app.service.IApplyInfoService;
 import com.dragoninfo.dcuc.app.service.IServiceResourceService;
 import com.dragoninfo.dcuc.app.vo.ServiceResourceVo;
 import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
+import com.dragoninfo.dcuc.common.utils.DcucBeanUtil;
 import com.dragoninfo.dcuc.duceap.enums.ServiceProvideWayEnum;
 import com.dragoninfo.dcuc.duceap.enums.ServiceResourceTypeEnum;
 import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
@@ -41,10 +42,7 @@ import javax.annotation.Resource;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -273,6 +271,17 @@ public class ServiceResourceServiceImpl extends BaseMybatisService<ServiceResour
         return Long.valueOf(serviceResourceMapper.selectCount(query));
     }
 
+    @Override
+    public List<ServiceResourceVo> getServiceByIds(List<String> serviceIds) {
+        if (CollectionUtils.isEmpty(serviceIds)) {
+            return Collections.emptyList();
+        }
+        LambdaQueryWrapper<ServiceResource> wrapper = Wrappers.lambdaQuery();
+        wrapper.in(ServiceResource::getId, serviceIds);
+        List<ServiceResource> serviceResources = serviceResourceMapper.selectList(wrapper);
+        return DcucBeanUtil.createCopyToObjectList(serviceResources, ServiceResourceVo.class);
+    }
+
     /**
      * 构建服务资源数组
      * @param inputStream