mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
feat: add service config templates and extraction script
Former-commit-id: 1de24b7eb79676d1aba9d799a58c5a753290cf52
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>ninca-crk-from-lib-reactor</artifactId>
|
||||
<version>2.9.1_210630-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>ninca-crk-conference-attendance-service</artifactId>
|
||||
<name>ninca-crk-conference-attendance-service</name>
|
||||
<description>CFR from ninca-crk-conference-attendance-service-2.9.1_210630-SNAPSHOT.jar (embedded pom: none)</description>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>ninca-crk-conference-attendance-interface</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>ninca-crk-conference-attendance-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>ninca-crk-conference-attendance-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.intelligent</groupId>
|
||||
<artifactId>intelligent-cwoscomponent-interface</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.cloud</groupId>
|
||||
<artifactId>cloudwalk-common-result</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.ninca</groupId>
|
||||
<artifactId>ninca-crk-portal-resource-stubs</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.intelligent</groupId>
|
||||
<artifactId>davinci-manager-storage</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.client.resource.application.param.ApplicationQueryParam
|
||||
* cn.cloudwalk.client.resource.application.result.ApplicationResult
|
||||
* cn.cloudwalk.client.resource.application.service.ApplicationService
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* org.slf4j.Logger
|
||||
* org.slf4j.LoggerFactory
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.cache.annotation.Cacheable
|
||||
* org.springframework.stereotype.Service
|
||||
* org.springframework.util.CollectionUtils
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.cacheable;
|
||||
|
||||
import cn.cloudwalk.client.resource.application.param.ApplicationQueryParam;
|
||||
import cn.cloudwalk.client.resource.application.result.ApplicationResult;
|
||||
import cn.cloudwalk.client.resource.application.service.ApplicationService;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
public class ConferenceApplicationCacheableService {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
@Autowired
|
||||
private ApplicationService applicationService;
|
||||
|
||||
@Cacheable(cacheNames={"CONFERENCE_ApplicationCache"}, key="T(cn.cloudwalk.service.ninca.conference.cacheable.ConferenceCacheOverrideConfig).CONFERENCE_APPLICATION_ID_PREFIX + #businessId", condition="#result != null")
|
||||
public String getApplicationId(String businessId) throws ServiceException {
|
||||
ApplicationQueryParam param = new ApplicationQueryParam();
|
||||
param.setBusinessId(businessId);
|
||||
param.setServiceCode("conference-attn");
|
||||
CloudwalkResult cloudwalkResult = this.applicationService.query(param);
|
||||
if (cloudwalkResult.isSuccess()) {
|
||||
if (!CollectionUtils.isEmpty((Collection)((Collection)cloudwalkResult.getData()))) {
|
||||
return ((ApplicationResult)((List)cloudwalkResult.getData()).get(0)).getId();
|
||||
}
|
||||
this.logger.info("\u672a\u67e5\u5230applicationId");
|
||||
throw new ServiceException("76250005", "\u672a\u67e5\u5230applicationId");
|
||||
}
|
||||
this.logger.info("\u67e5\u8be2applicationId\u5931\u8d25");
|
||||
throw new ServiceException("76250006", "\u67e5\u8be2applicationId\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility
|
||||
* com.fasterxml.jackson.annotation.PropertyAccessor
|
||||
* com.fasterxml.jackson.databind.ObjectMapper
|
||||
* com.fasterxml.jackson.databind.ObjectMapper$DefaultTyping
|
||||
* org.springframework.context.annotation.Bean
|
||||
* org.springframework.context.annotation.Configuration
|
||||
* org.springframework.context.annotation.Primary
|
||||
* org.springframework.data.redis.connection.RedisConnectionFactory
|
||||
* org.springframework.data.redis.core.RedisTemplate
|
||||
* org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
|
||||
* org.springframework.data.redis.serializer.RedisSerializer
|
||||
* org.springframework.data.redis.serializer.StringRedisSerializer
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.cacheable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
public class ConferenceCacheOverrideConfig {
|
||||
public static final String CONFERENCE_APPLICATION_CACHE = "CONFERENCE_ApplicationCache";
|
||||
public static final String CONFERENCE_APPLICATION_ID_PREFIX = "conference_applicationId:";
|
||||
public static final String CACHE_KEY_CONFERENCE_EXPORT_PREFIX = "conference_export_prefix:";
|
||||
|
||||
@Primary
|
||||
@Bean(value={"redisTemplate"})
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisTemplate redisTemplate = new RedisTemplate();
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
|
||||
redisTemplate.setValueSerializer((RedisSerializer)jackson2JsonRedisSerializer);
|
||||
redisTemplate.setKeySerializer((RedisSerializer)stringRedisSerializer);
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.application.service.ApplicationImageStoreService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.biology.param.FeatureQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.biology.service.BiologyToolService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceImageStoreQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceImageStoreResult
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceResult
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceImageStoreService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStoreListResult
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService
|
||||
* cn.cloudwalk.client.ninca.conference.capture.param.ConferenceCaptureFeatureQueryParam
|
||||
* cn.cloudwalk.client.ninca.conference.capture.result.ConferenceFeatureQueryResult
|
||||
* cn.cloudwalk.client.ninca.conference.capture.service.ConferenceBiologyFeatureService
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.util.CollectionUtils
|
||||
* cn.cloudwalk.intelligent.davinci.storage.manager.FileStorageManager
|
||||
* javax.annotation.Resource
|
||||
* org.apache.commons.codec.binary.Base64
|
||||
* org.springframework.stereotype.Service
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.capture;
|
||||
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.application.service.ApplicationImageStoreService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.biology.param.FeatureQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.biology.service.BiologyToolService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceImageStoreQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceImageStoreResult;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceResult;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceImageStoreService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStoreListResult;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService;
|
||||
import cn.cloudwalk.client.ninca.conference.capture.param.ConferenceCaptureFeatureQueryParam;
|
||||
import cn.cloudwalk.client.ninca.conference.capture.result.ConferenceFeatureQueryResult;
|
||||
import cn.cloudwalk.client.ninca.conference.capture.service.ConferenceBiologyFeatureService;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.util.CollectionUtils;
|
||||
import cn.cloudwalk.intelligent.davinci.storage.manager.FileStorageManager;
|
||||
import cn.cloudwalk.service.ninca.conference.cacheable.ConferenceApplicationCacheableService;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ConferenceBiologyFeatureServiceImpl
|
||||
extends AbstractService
|
||||
implements ConferenceBiologyFeatureService {
|
||||
@Resource
|
||||
private FileStorageManager fileStorageManager;
|
||||
@Resource
|
||||
private BiologyToolService biologyToolService;
|
||||
@Resource
|
||||
private DeviceImageStoreService deviceImageStoreService;
|
||||
@Resource
|
||||
private DeviceService deviceService;
|
||||
@Resource
|
||||
private ApplicationImageStoreService applicationImageStoreService;
|
||||
@Resource
|
||||
private ConferenceApplicationCacheableService conferenceApplicationCacheableService;
|
||||
@Resource
|
||||
private ImageStoreService imageStoreService;
|
||||
|
||||
public ConferenceFeatureQueryResult featureQuery(ConferenceCaptureFeatureQueryParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
List<String> imagestoreIds;
|
||||
byte[] bytes = this.fileStorageManager.fileDownload(param.getImagePath());
|
||||
if (bytes != null && CollectionUtils.isNotEmpty(imagestoreIds = this.queryImagestoreIds(param, context))) {
|
||||
FeatureQueryParam featureQueryParam = new FeatureQueryParam();
|
||||
featureQueryParam.setImageStoreIds(imagestoreIds);
|
||||
featureQueryParam.setImageBase64(Base64.encodeBase64String((byte[])bytes));
|
||||
featureQueryParam.setTopN(Integer.valueOf(1));
|
||||
CloudwalkResult result = this.biologyToolService.query(featureQueryParam, context);
|
||||
if (result.isSuccess() && CollectionUtils.isNotEmpty((Collection)((Collection)result.getData()))) {
|
||||
return (ConferenceFeatureQueryResult)BeanCopyUtils.copyProperties(((List)result.getData()).get(0), ConferenceFeatureQueryResult.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.logger.error("1:N\u5f15\u64ce\u67e5\u8be2\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> queryImagestoreIds(ConferenceCaptureFeatureQueryParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
DeviceQueryParam deviceQueryParam = new DeviceQueryParam();
|
||||
deviceQueryParam.setDeviceCode(param.getDeviceCode());
|
||||
CloudwalkResult deviceCloudwalkResult = this.deviceService.list(deviceQueryParam, context);
|
||||
if (!deviceCloudwalkResult.isSuccess() || CollectionUtils.isEmpty((Collection)((Collection)deviceCloudwalkResult.getData()))) {
|
||||
this.logger.error("\u67e5\u8be2\u8bbe\u5907\u5931\u8d25\uff0c\u6ca1\u6709\u627e\u5230\u8bbe\u5907\u4fe1\u606f\uff0c\u8bbe\u5907\u7f16\u7801\uff1a{}", (Object)param.getDeviceCode());
|
||||
return null;
|
||||
}
|
||||
DeviceImageStoreQueryParam deviceImageStoreQueryParam = new DeviceImageStoreQueryParam();
|
||||
String deviceId = ((DeviceResult)((List)deviceCloudwalkResult.getData()).get(0)).getId();
|
||||
deviceImageStoreQueryParam.setDeviceId(deviceId);
|
||||
CloudwalkResult deviceImagestoreResult = this.deviceImageStoreService.list(deviceImageStoreQueryParam, context);
|
||||
if (!deviceImagestoreResult.isSuccess() || CollectionUtils.isEmpty((Collection)((Collection)deviceImagestoreResult.getData()))) {
|
||||
this.logger.warn("\u8be5\u8bbe\u5907\u4e0b\u672a\u67e5\u8be2\u5230\u56fe\u5e93\u5217\u8868\uff0cdeviceId{}", (Object)deviceId);
|
||||
return null;
|
||||
}
|
||||
String applicationId = this.conferenceApplicationCacheableService.getApplicationId(context.getCompany().getCompanyId());
|
||||
ImageStoreQueryParam imageStoreQueryParam = new ImageStoreQueryParam();
|
||||
imageStoreQueryParam.setSourceApplicationId(applicationId);
|
||||
CloudwalkResult imageStoreResult = this.imageStoreService.list(imageStoreQueryParam, context);
|
||||
if (!imageStoreResult.isSuccess() || CollectionUtils.isEmpty((Collection)((Collection)imageStoreResult.getData()))) {
|
||||
this.logger.warn("\u8be5\u5e94\u7528\u4e0b\u672a\u67e5\u8be2\u5230\u56fe\u5e93\u5217\u8868\uff0capplicationId{}", (Object)applicationId);
|
||||
return null;
|
||||
}
|
||||
return this.merge((List)deviceImagestoreResult.getData(), (List)imageStoreResult.getData());
|
||||
}
|
||||
|
||||
private List<String> merge(List<DeviceImageStoreResult> data1, List<ImageStoreListResult> data2) {
|
||||
List list1 = data1.stream().map(DeviceImageStoreResult::getImageStoreId).collect(Collectors.toList());
|
||||
List list2 = data2.stream().map(ImageStoreListResult::getId).collect(Collectors.toList());
|
||||
return list1.stream().filter(list2::contains).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.biz.ninca.conference.device.ConferenceDeviceManager
|
||||
* cn.cloudwalk.biz.ninca.conference.imagestore.ConferenceImageStoreManager
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.application.param.ApplicationImageStoreAddParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.application.param.ApplicationImageStoreDelParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.application.service.ApplicationImageStoreService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceApplicationParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceApplicationQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceImageStoreParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceImageStoreQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceApplicationService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceImageStoreService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreAddParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreDelParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreEditParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStorePersonData
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceAddParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceCancelParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceEditParam
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.DataAccessException
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceUnbindQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.imagestore.dto.ConferenceImageStoreGetDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.imagestore.dto.ConferenceImageStoreResultDTO
|
||||
* javax.annotation.Resource
|
||||
* org.springframework.util.CollectionUtils
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.common;
|
||||
|
||||
import cn.cloudwalk.biz.ninca.conference.device.ConferenceDeviceManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.imagestore.ConferenceImageStoreManager;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.application.param.ApplicationImageStoreAddParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.application.param.ApplicationImageStoreDelParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.application.service.ApplicationImageStoreService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceApplicationParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceApplicationQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceImageStoreParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceImageStoreQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceApplicationService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceImageStoreService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreAddParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreDelParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreEditParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStorePersonData;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceAddParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceCancelParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceEditParam;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.DataAccessException;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceUnbindQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.imagestore.dto.ConferenceImageStoreGetDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.imagestore.dto.ConferenceImageStoreResultDTO;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
public class AbstractConferenceService
|
||||
extends AbstractService {
|
||||
@Resource
|
||||
private ConferenceImageStoreManager conferenceImageStoreManager;
|
||||
@Resource
|
||||
private DeviceApplicationService deviceApplicationService;
|
||||
@Resource
|
||||
private ImageStoreService imageStoreService;
|
||||
@Resource
|
||||
private DeviceImageStoreService deviceImageStoreService;
|
||||
@Resource
|
||||
private ApplicationImageStoreService applicationImageStoreService;
|
||||
@Resource
|
||||
private ConferenceDeviceManager conferenceDeviceManager;
|
||||
|
||||
protected void editCwos(ConferenceEditParam param, List<String> oldDeviceIds, String applicationId, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
ConferenceImageStoreGetDTO imageStoreGetDTO = new ConferenceImageStoreGetDTO();
|
||||
imageStoreGetDTO.setConferenceId(param.getId());
|
||||
List imageStoreResultDTOS = this.conferenceImageStoreManager.gets(imageStoreGetDTO);
|
||||
if (CollectionUtils.isEmpty((Collection)imageStoreResultDTOS)) {
|
||||
throw new ServiceException("\u56fe\u5e93\u4e3a\u7a7a");
|
||||
}
|
||||
String imageStoreId = ((ConferenceImageStoreResultDTO)imageStoreResultDTOS.get(0)).getImagestoreId();
|
||||
this.editImageStore(param, imageStoreId, context);
|
||||
ArrayList<String> unBindDeviceList = new ArrayList<String>();
|
||||
for (String oldDeviceId : oldDeviceIds) {
|
||||
if (param.getDeviceIds().contains(oldDeviceId)) continue;
|
||||
unBindDeviceList.add(oldDeviceId);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(unBindDeviceList)) {
|
||||
this.deleteDeviceApplicationRel(param.getId(), applicationId, unBindDeviceList, context);
|
||||
this.deleteDeviceImagestoreRel(unBindDeviceList, imageStoreId, context);
|
||||
}
|
||||
ArrayList<String> newDeviceList = new ArrayList<String>();
|
||||
for (String deviceId : param.getDeviceIds()) {
|
||||
if (oldDeviceIds.contains(deviceId)) continue;
|
||||
newDeviceList.add(deviceId);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(newDeviceList)) {
|
||||
this.addDeviceApplicationRel(applicationId, newDeviceList, context);
|
||||
this.addDeviceImageStoreRel(imageStoreId, newDeviceList, context);
|
||||
}
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u5904\u7406cwos\u5e94\u7528\u3001\u8bbe\u5907\u3001\u56fe\u5e93\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String addCwos(ConferenceAddParam param, String applicationId, String conferenceId, CloudwalkCallContext context) throws ServiceException {
|
||||
return this.addConferenceImageStore(conferenceId, param.getName(), applicationId, param.getPersonIds(), param.getSignBeginTime(), param.getIsSignoff() == 1 ? param.getSignoffDeadline() : param.getEndTime(), param.getDeviceIds(), context);
|
||||
}
|
||||
|
||||
private String addConferenceImageStore(String conferenceId, String name, String applicationId, List<String> personIds, Long expiryBeginDate, Long expiryEndDate, List<String> deviceIds, CloudwalkCallContext context) throws ServiceException {
|
||||
CloudwalkResult addImageStoreResult;
|
||||
ImageStoreAddParam imageStoreAddParam = new ImageStoreAddParam();
|
||||
imageStoreAddParam.setName(String.format("%s[%s]", name, conferenceId));
|
||||
imageStoreAddParam.setSourceApplicationId(applicationId);
|
||||
imageStoreAddParam.setType(Short.valueOf((short)1));
|
||||
if (!CollectionUtils.isEmpty(personIds)) {
|
||||
List includePersons = personIds.stream().map(personId -> {
|
||||
ImageStorePersonData imageStorePersonData = new ImageStorePersonData();
|
||||
imageStorePersonData.setObjectId(personId);
|
||||
imageStorePersonData.setExpiryBeginDate(expiryBeginDate);
|
||||
imageStorePersonData.setExpiryEndDate(expiryEndDate);
|
||||
return imageStorePersonData;
|
||||
}).collect(Collectors.toList());
|
||||
imageStoreAddParam.setIncludePersons(includePersons);
|
||||
}
|
||||
if ((addImageStoreResult = this.imageStoreService.add(imageStoreAddParam, context)).isSuccess()) {
|
||||
try {
|
||||
if (!CollectionUtils.isEmpty(deviceIds)) {
|
||||
this.addDeviceImageStoreRel((String)addImageStoreResult.getData(), deviceIds, context);
|
||||
this.addDeviceApplicationRel(applicationId, deviceIds, context);
|
||||
}
|
||||
this.applicationImageStoreBind(applicationId, (String)addImageStoreResult.getData(), context);
|
||||
}
|
||||
catch (ServiceException e) {
|
||||
this.logger.error("\u4f1a\u8bae\u65b0\u589e\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
try {
|
||||
this.deleteDeviceImagestoreRel(deviceIds, (String)addImageStoreResult.getData(), context);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
this.logger.error("\u4f1a\u8bae\u65b0\u589e\u5931\u8d25\uff0c\u5220\u9664\u8bbe\u5907\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)ex);
|
||||
}
|
||||
try {
|
||||
this.deleteAppImagestoreRel(applicationId, Collections.singletonList(addImageStoreResult.getData()), context);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
this.logger.error("\u4f1a\u8bae\u65b0\u589e\u5931\u8d25\uff0c\u5220\u9664\u5e94\u7528\u4e0e\u56fe\u5e93\u5173\u7cfb\u3001\u56fe\u5e93\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)ex);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
this.logger.error("\u65b0\u589e\u4f1a\u8bae\u56fe\u5e93\u8bb0\u5f55\u5931\u8d25\uff0cmessage: {}, code: {}", (Object)addImageStoreResult.getMessage(), (Object)addImageStoreResult.getCode());
|
||||
throw new ServiceException("\u65b0\u589e\u4f1a\u8bae\u56fe\u5e93\u8bb0\u5f55\u5931\u8d25");
|
||||
return (String)addImageStoreResult.getData();
|
||||
}
|
||||
|
||||
private void applicationImageStoreBind(String applicationId, String imageStoreId, CloudwalkCallContext context) throws ServiceException {
|
||||
ApplicationImageStoreAddParam appImageStoreAddParam = new ApplicationImageStoreAddParam();
|
||||
appImageStoreAddParam.setApplicationId(applicationId);
|
||||
appImageStoreAddParam.setImageStoreId(imageStoreId);
|
||||
CloudwalkResult result = this.applicationImageStoreService.add(appImageStoreAddParam, context);
|
||||
if (!result.isSuccess()) {
|
||||
throw new ServiceException("\u7ed1\u5b9a\u5e94\u7528\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private void editImageStore(ConferenceEditParam param, String imagestoreId, CloudwalkCallContext context) throws ServiceException {
|
||||
ImageStoreEditParam imageStoreEditParam = new ImageStoreEditParam();
|
||||
imageStoreEditParam.setImageStoreId(imagestoreId);
|
||||
imageStoreEditParam.setName(String.format("%s[%s]", param.getName(), param.getId()));
|
||||
if (!CollectionUtils.isEmpty((Collection)param.getPersonIds())) {
|
||||
List includePersons = param.getPersonIds().stream().map(personId -> {
|
||||
ImageStorePersonData imageStorePersonData = new ImageStorePersonData();
|
||||
imageStorePersonData.setObjectId(personId);
|
||||
imageStorePersonData.setExpiryBeginDate(param.getSignBeginTime());
|
||||
imageStorePersonData.setExpiryEndDate(param.getIsSignoff() == 1 ? param.getSignoffDeadline() : param.getEndTime());
|
||||
return imageStorePersonData;
|
||||
}).collect(Collectors.toList());
|
||||
imageStoreEditParam.setIncludePersons(includePersons);
|
||||
}
|
||||
this.imageStoreService.edit(imageStoreEditParam, context);
|
||||
}
|
||||
|
||||
private void deleteDeviceApplicationRel(String id, String applicationId, List<String> deviceIds, CloudwalkCallContext cloudwalkContext) throws ServiceException, DataAccessException {
|
||||
List<String> unBindDeviceList = this.unBindDeviceList(id, deviceIds);
|
||||
for (String deviceId : deviceIds) {
|
||||
if (!CollectionUtils.isEmpty(unBindDeviceList) && unBindDeviceList.contains(deviceId)) continue;
|
||||
DeviceApplicationParam deviceApplicationParam = new DeviceApplicationParam();
|
||||
deviceApplicationParam.setApplicationId(applicationId);
|
||||
deviceApplicationParam.setDeviceId(deviceId);
|
||||
CloudwalkResult deleteResult = this.deviceApplicationService.delete(deviceApplicationParam, cloudwalkContext);
|
||||
if (deleteResult.isSuccess()) continue;
|
||||
this.logger.error("\u5220\u9664\u8bbe\u5907\u4e0e\u5e94\u7528\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a{}", (Object)deleteResult.getMessage());
|
||||
throw new ServiceException("\u5220\u9664\u8bbe\u5907\u4e0e\u5e94\u7528\u5173\u7cfb\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteDeviceImagestoreRel(List<String> deviceIds, String imagestoreId, CloudwalkCallContext context) throws ServiceException {
|
||||
if (!CollectionUtils.isEmpty(deviceIds) && imagestoreId != null) {
|
||||
for (String deviceId : deviceIds) {
|
||||
DeviceImageStoreParam deleteParam = new DeviceImageStoreParam();
|
||||
deleteParam.setDeviceId(deviceId);
|
||||
deleteParam.setImageStoreId(imagestoreId);
|
||||
CloudwalkResult deleteResult = this.deviceImageStoreService.delete(deleteParam, context);
|
||||
if (deleteResult.isSuccess()) continue;
|
||||
this.logger.error("\u5220\u9664\u8bbe\u5907\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a{}", (Object)deleteResult.getMessage());
|
||||
throw new ServiceException("\u5220\u9664\u8bbe\u5907\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> unBindDeviceList(String conferenceId, List<String> deviceIds) throws DataAccessException {
|
||||
ConferenceDeviceUnbindQueryDTO unbindQueryDTO = new ConferenceDeviceUnbindQueryDTO();
|
||||
unbindQueryDTO.setConferenceId(conferenceId);
|
||||
unbindQueryDTO.setDeviceList(deviceIds);
|
||||
unbindQueryDTO.setNowTime(Long.valueOf(System.currentTimeMillis()));
|
||||
List applicationUnbindDeviceList = this.conferenceDeviceManager.applicationUnbindDevice(unbindQueryDTO);
|
||||
if (!CollectionUtils.isEmpty((Collection)applicationUnbindDeviceList)) {
|
||||
return applicationUnbindDeviceList.stream().map(ConferenceDeviceResultDTO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
private void addDeviceImageStoreRel(String imageStoreId, List<String> deviceIds, CloudwalkCallContext context) throws ServiceException {
|
||||
for (String deviceId : deviceIds) {
|
||||
DeviceImageStoreQueryParam storeQueryParam = new DeviceImageStoreQueryParam();
|
||||
storeQueryParam.setDeviceId(deviceId);
|
||||
storeQueryParam.setImageStoreId(imageStoreId);
|
||||
CloudwalkResult deviceQueryResult = this.deviceImageStoreService.list(storeQueryParam, context);
|
||||
if (CollectionUtils.isEmpty((Collection)((Collection)deviceQueryResult.getData()))) {
|
||||
DeviceImageStoreParam imageStoreSaveParam = new DeviceImageStoreParam();
|
||||
imageStoreSaveParam.setDeviceId(deviceId);
|
||||
imageStoreSaveParam.setImageStoreId(imageStoreId);
|
||||
CloudwalkResult saveDeviceResult = this.deviceImageStoreService.add(imageStoreSaveParam, context);
|
||||
if (saveDeviceResult.isSuccess()) continue;
|
||||
this.logger.error("\u4fdd\u5b58\u8bbe\u5907\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a{}", (Object)saveDeviceResult.getMessage());
|
||||
throw new ServiceException("\u4fdd\u5b58\u8bbe\u5907\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25,\u539f\u56e0\uff1a" + saveDeviceResult.getMessage());
|
||||
}
|
||||
this.logger.info("\u8bbe\u5907\uff1a{}\u4e0e\u56fe\u5e93\uff1a{}\u5173\u7cfb\u5df2\u7ecf\u5b58\u5728\u65e0\u987b\u6dfb\u52a0", (Object)deviceId, (Object)imageStoreId);
|
||||
}
|
||||
}
|
||||
|
||||
private void addDeviceApplicationRel(String applicationId, List<String> deviceIds, CloudwalkCallContext cloudwalkContext) throws ServiceException {
|
||||
for (String deviceId : deviceIds) {
|
||||
DeviceApplicationQueryParam applicationQueryParam = new DeviceApplicationQueryParam();
|
||||
applicationQueryParam.setDeviceId(deviceId);
|
||||
applicationQueryParam.setApplicationId(applicationId);
|
||||
CloudwalkResult applicationQueryResult = this.deviceApplicationService.list(applicationQueryParam, cloudwalkContext);
|
||||
if (CollectionUtils.isEmpty((Collection)((Collection)applicationQueryResult.getData()))) {
|
||||
DeviceApplicationParam applicationParam = new DeviceApplicationParam();
|
||||
applicationParam.setApplicationId(applicationId);
|
||||
applicationParam.setDeviceId(deviceId);
|
||||
CloudwalkResult addApplicationResult = this.deviceApplicationService.add(applicationParam, cloudwalkContext);
|
||||
if (addApplicationResult.isSuccess()) continue;
|
||||
this.logger.error("\u4fdd\u5b58\u5e94\u7528\u4e0e\u8bbe\u5907\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a{}", (Object)addApplicationResult.getMessage());
|
||||
throw new ServiceException("\u4fdd\u5b58\u5e94\u7528\u4e0e\u8bbe\u5907\u5173\u7cfb\u5931\u8d25,\u539f\u56e0\uff1a" + addApplicationResult.getMessage());
|
||||
}
|
||||
this.logger.info("\u8bbe\u5907:{}\u4e0e\u5e94\u7528\uff1a{}\u5173\u7cfb\u5df2\u7ecf\u5b58\u5728\u65e0\u987b\u6dfb\u52a0", (Object)deviceId, (Object)applicationId);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cancelCwos(ConferenceCancelParam param, String applicationId, CloudwalkCallContext context) throws ServiceException, DataAccessException {
|
||||
ConferenceDeviceQueryDTO deviceQueryDTO = new ConferenceDeviceQueryDTO();
|
||||
deviceQueryDTO.setConferenceId(param.getId());
|
||||
List deviceList = this.conferenceDeviceManager.query(deviceQueryDTO);
|
||||
ConferenceImageStoreGetDTO imageStoreGetDTO = new ConferenceImageStoreGetDTO();
|
||||
imageStoreGetDTO.setConferenceId(param.getId());
|
||||
List imageStoreList = this.conferenceImageStoreManager.gets(imageStoreGetDTO);
|
||||
List<String> deviceIds = deviceList.stream().map(ConferenceDeviceResultDTO::getDeviceId).collect(Collectors.toList());
|
||||
List<String> imagestoreIds = imageStoreList.stream().map(ConferenceImageStoreResultDTO::getImagestoreId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(deviceIds) && !CollectionUtils.isEmpty(imagestoreIds)) {
|
||||
for (String imageStoreId : imagestoreIds) {
|
||||
this.deleteDeviceImagestoreRel(deviceIds, imageStoreId, context);
|
||||
}
|
||||
this.deleteDeviceApplicationRel(param.getId(), applicationId, deviceIds, context);
|
||||
this.deleteAppImagestoreRel(applicationId, imagestoreIds, context);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteAppImagestoreRel(String applicationId, List<String> imagestoreIds, CloudwalkCallContext cloudwalkContext) throws ServiceException {
|
||||
for (String imagestoreId : imagestoreIds) {
|
||||
ApplicationImageStoreDelParam applicationImageStoreDelParam = new ApplicationImageStoreDelParam();
|
||||
applicationImageStoreDelParam.setApplicationId(applicationId);
|
||||
applicationImageStoreDelParam.setImageStoreId(imagestoreId);
|
||||
CloudwalkResult appImagestoreDeleteResult = this.applicationImageStoreService.delete(applicationImageStoreDelParam, cloudwalkContext);
|
||||
if (!appImagestoreDeleteResult.isSuccess()) {
|
||||
this.logger.error("\u5220\u9664\u5e94\u7528\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25\uff0c\u539f\u56e0\uff1a{}", (Object)appImagestoreDeleteResult.getMessage());
|
||||
throw new ServiceException("\u5220\u9664\u5e94\u7528\u4e0e\u56fe\u5e93\u5173\u7cfb\u5931\u8d25");
|
||||
}
|
||||
ImageStoreDelParam imageStoreDelParam = new ImageStoreDelParam();
|
||||
imageStoreDelParam.setId(imagestoreId);
|
||||
CloudwalkResult imagestoreDeleteResult = this.imageStoreService.delete(imageStoreDelParam, cloudwalkContext);
|
||||
if (imagestoreDeleteResult.isSuccess()) continue;
|
||||
this.logger.error("\u5220\u9664\u56fe\u5e93\u5931\u8d25\uff0c\u539f\u56e0\uff1a{}", (Object)imagestoreDeleteResult.getMessage());
|
||||
throw new ServiceException("\u5220\u9664\u56fe\u5e93\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.serial.UUIDSerial
|
||||
* cn.cloudwalk.cloud.utils.CloudwalkDateUtils
|
||||
* cn.cloudwalk.common.ninca.conference.em.SignResultEnum
|
||||
* org.slf4j.Logger
|
||||
* org.slf4j.LoggerFactory
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.context.MessageSource
|
||||
* org.springframework.context.i18n.LocaleContextHolder
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.common;
|
||||
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.serial.UUIDSerial;
|
||||
import cn.cloudwalk.cloud.utils.CloudwalkDateUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.em.SignResultEnum;
|
||||
import cn.cloudwalk.service.ninca.conference.cacheable.ConferenceApplicationCacheableService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
public abstract class AbstractService {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
@Autowired
|
||||
private MessageSource messageSource;
|
||||
@Autowired(required=false)
|
||||
private UUIDSerial uuidSerial;
|
||||
@Autowired
|
||||
private ConferenceApplicationCacheableService conferenceApplicationCacheableService;
|
||||
|
||||
protected String getMessage(String code) {
|
||||
return this.messageSource.getMessage(code, null, "", LocaleContextHolder.getLocale());
|
||||
}
|
||||
|
||||
protected String genUUID() {
|
||||
if (null != this.uuidSerial) {
|
||||
return this.uuidSerial.uuid();
|
||||
}
|
||||
return CloudwalkDateUtils.getUUID();
|
||||
}
|
||||
|
||||
protected String getApplicationId(String businessId) throws ServiceException {
|
||||
return this.conferenceApplicationCacheableService.getApplicationId(businessId);
|
||||
}
|
||||
|
||||
protected Integer getSignoffResult(Long recognitionTime, Long endTime) {
|
||||
if (recognitionTime >= endTime) {
|
||||
return SignResultEnum.NORMAL.getCode();
|
||||
}
|
||||
return SignResultEnum.TARDY.getCode();
|
||||
}
|
||||
|
||||
protected Integer getSigninResult(Long recognitionTime, Long beginTime) {
|
||||
if (recognitionTime <= beginTime) {
|
||||
return SignResultEnum.NORMAL.getCode();
|
||||
}
|
||||
return SignResultEnum.LATENESS.getCode();
|
||||
}
|
||||
}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* org.springframework.boot.context.properties.ConfigurationProperties
|
||||
* org.springframework.stereotype.Component
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.common;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ConfigurationProperties(prefix="cloudwalk.conference-attn")
|
||||
@Component
|
||||
public class ConferenceProperties {
|
||||
private String cwosPicUrl;
|
||||
private double captureDeviceThreshold = 90.0;
|
||||
private boolean recordPush = false;
|
||||
private String recordPushServiceCode;
|
||||
|
||||
public String getCwosPicUrl() {
|
||||
return this.cwosPicUrl;
|
||||
}
|
||||
|
||||
public void setCwosPicUrl(String cwosPicUrl) {
|
||||
this.cwosPicUrl = cwosPicUrl;
|
||||
}
|
||||
|
||||
public double getCaptureDeviceThreshold() {
|
||||
return this.captureDeviceThreshold;
|
||||
}
|
||||
|
||||
public void setCaptureDeviceThreshold(double captureDeviceThreshold) {
|
||||
this.captureDeviceThreshold = captureDeviceThreshold;
|
||||
}
|
||||
|
||||
public boolean isRecordPush() {
|
||||
return this.recordPush;
|
||||
}
|
||||
|
||||
public void setRecordPush(boolean recordPush) {
|
||||
this.recordPush = recordPush;
|
||||
}
|
||||
|
||||
public String getRecordPushServiceCode() {
|
||||
return this.recordPushServiceCode;
|
||||
}
|
||||
|
||||
public void setRecordPushServiceCode(String recordPushServiceCode) {
|
||||
this.recordPushServiceCode = recordPushServiceCode;
|
||||
}
|
||||
}
|
||||
|
||||
+578
@@ -0,0 +1,578 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.biz.ninca.conference.conference.ConferenceManager
|
||||
* cn.cloudwalk.biz.ninca.conference.device.ConferenceDeviceManager
|
||||
* cn.cloudwalk.biz.ninca.conference.imagestore.ConferenceImageStoreManager
|
||||
* cn.cloudwalk.biz.ninca.conference.person.ConferencePersonManager
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceAddParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceCancelParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceDetailParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceEditParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceImageStoreCleanParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.param.ConferenceQueryParam
|
||||
* cn.cloudwalk.client.ninca.conference.conference.result.ConferenceDetailResult
|
||||
* cn.cloudwalk.client.ninca.conference.conference.result.ConferenceDeviceResult
|
||||
* cn.cloudwalk.client.ninca.conference.conference.result.ConferenceImageStoreCleanResult
|
||||
* cn.cloudwalk.client.ninca.conference.conference.result.ConferencePersonResult
|
||||
* cn.cloudwalk.client.ninca.conference.conference.result.ConferenceResult
|
||||
* cn.cloudwalk.client.ninca.conference.conference.service.ConferenceService
|
||||
* cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.entity.CloudwalkBaseIdentify
|
||||
* cn.cloudwalk.cloud.entity.CloudwalkBaseTimes
|
||||
* cn.cloudwalk.cloud.exception.DataAccessException
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageAble
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageInfo
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceEditDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceGetsDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceImageStoreExpiredDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceImageStoreExpiredResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceDelDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceEditDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.imagestore.dto.ConferenceImageStoreEditDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonCountQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonCountResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonDelDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonEditDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.em.ConferenceCancelStatusEnum
|
||||
* cn.cloudwalk.common.ninca.conference.em.ConferenceStatusEnum
|
||||
* cn.cloudwalk.common.ninca.conference.em.SignoffSettingEnum
|
||||
* cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum
|
||||
* cn.cloudwalk.common.ninca.conference.exception.BeginTimeLaterThanEndTimeException
|
||||
* cn.cloudwalk.common.ninca.conference.exception.ConferenceEditAfterBeginningException
|
||||
* cn.cloudwalk.common.ninca.conference.exception.ConferenceNotExistsException
|
||||
* cn.cloudwalk.common.ninca.conference.exception.SignTimeLaterThanBeginTimeException
|
||||
* cn.cloudwalk.common.ninca.conference.exception.SignoffDeadlineRequiredException
|
||||
* cn.cloudwalk.common.ninca.conference.exception.SignoffTimeEarlierThanEndTimeException
|
||||
* com.google.common.collect.Lists
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.stereotype.Service
|
||||
* org.springframework.transaction.annotation.Propagation
|
||||
* org.springframework.transaction.annotation.Transactional
|
||||
* org.springframework.util.CollectionUtils
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.conference;
|
||||
|
||||
import cn.cloudwalk.biz.ninca.conference.conference.ConferenceManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.device.ConferenceDeviceManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.imagestore.ConferenceImageStoreManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.person.ConferencePersonManager;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceAddParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceCancelParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceDetailParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceEditParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceImageStoreCleanParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.param.ConferenceQueryParam;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.result.ConferenceDetailResult;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.result.ConferenceDeviceResult;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.result.ConferenceImageStoreCleanResult;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.result.ConferencePersonResult;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.result.ConferenceResult;
|
||||
import cn.cloudwalk.client.ninca.conference.conference.service.ConferenceService;
|
||||
import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.entity.CloudwalkBaseIdentify;
|
||||
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
|
||||
import cn.cloudwalk.cloud.exception.DataAccessException;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceEditDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceGetsDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceImageStoreExpiredDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceImageStoreExpiredResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceDelDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceEditDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.device.dto.ConferenceDeviceResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.imagestore.dto.ConferenceImageStoreEditDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonCountQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonCountResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonDelDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonEditDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.em.ConferenceCancelStatusEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.em.ConferenceStatusEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.em.SignoffSettingEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.exception.BeginTimeLaterThanEndTimeException;
|
||||
import cn.cloudwalk.common.ninca.conference.exception.ConferenceEditAfterBeginningException;
|
||||
import cn.cloudwalk.common.ninca.conference.exception.ConferenceNotExistsException;
|
||||
import cn.cloudwalk.common.ninca.conference.exception.SignTimeLaterThanBeginTimeException;
|
||||
import cn.cloudwalk.common.ninca.conference.exception.SignoffDeadlineRequiredException;
|
||||
import cn.cloudwalk.common.ninca.conference.exception.SignoffTimeEarlierThanEndTimeException;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractConferenceService;
|
||||
import cn.cloudwalk.service.ninca.conference.common.ConferenceProperties;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
public class ConferenceServiceImpl
|
||||
extends AbstractConferenceService
|
||||
implements ConferenceService {
|
||||
@Autowired
|
||||
private ConferenceManager conferenceManager;
|
||||
@Autowired
|
||||
private ConferenceDeviceManager conferenceDeviceManager;
|
||||
@Autowired
|
||||
private ConferencePersonManager conferencePersonManager;
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@Autowired
|
||||
private PersonService personService;
|
||||
@Autowired
|
||||
private ConferenceProperties conferenceProperties;
|
||||
@Autowired
|
||||
private ConferenceImageStoreManager conferenceImageStoreManager;
|
||||
|
||||
@Transactional(propagation=Propagation.REQUIRED, rollbackFor={Exception.class})
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<String> add(ConferenceAddParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
String conferenceId = this.genUUID();
|
||||
String applicationId = this.getApplicationId(context.getCompany().getCompanyId());
|
||||
this.conferenceAddValidate(param, context);
|
||||
this.addConference(conferenceId, param, context);
|
||||
this.saveConferenceDevice(conferenceId, applicationId, param.getDeviceIds(), context);
|
||||
this.addConferencePerson(conferenceId, param, applicationId, context);
|
||||
String imageStoreId = super.addCwos(param, applicationId, conferenceId, context);
|
||||
try {
|
||||
ConferenceImageStoreEditDTO imageStoreEditDTO = new ConferenceImageStoreEditDTO();
|
||||
imageStoreEditDTO.setConferenceId(conferenceId);
|
||||
imageStoreEditDTO.setImageStoreId(imageStoreId);
|
||||
this.conferenceImageStoreManager.add(imageStoreEditDTO);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u65b0\u589e\u56fe\u5e93\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
return CloudwalkResult.success((Object)conferenceId);
|
||||
}
|
||||
|
||||
@Transactional(propagation=Propagation.REQUIRED, rollbackFor={Exception.class})
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<Boolean> edit(ConferenceEditParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
String applicationId = this.getApplicationId(context.getCompany().getCompanyId());
|
||||
this.conferenceEditValidate(param, context);
|
||||
this.editConference(param, context);
|
||||
List<ConferenceDeviceResultDTO> deviceResultList = this.editConferenceDevice(param, applicationId, context);
|
||||
this.editConferencePerson(param, applicationId, context);
|
||||
List<String> oldDeviceIds = deviceResultList.stream().map(ConferenceDeviceResultDTO::getDeviceId).collect(Collectors.toList());
|
||||
super.editCwos(param, oldDeviceIds, applicationId, context);
|
||||
return CloudwalkResult.success((Object)true);
|
||||
}
|
||||
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<CloudwalkPageAble<ConferenceResult>> page(ConferenceQueryParam param, CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException {
|
||||
ConferenceQueryDTO dto = (ConferenceQueryDTO)BeanCopyUtils.copyProperties((Object)param, ConferenceQueryDTO.class);
|
||||
dto.setBusinessId(context.getCompany().getCompanyId());
|
||||
Long now = System.currentTimeMillis();
|
||||
if (param.getStatus() != null) {
|
||||
switch (ConferenceStatusEnum.getEnumByCode((Integer)param.getStatus())) {
|
||||
case NOT_STARTED: {
|
||||
dto.setBeginTimeGreaterThan(now);
|
||||
dto.setCancelStatus(ConferenceCancelStatusEnum.NOT_CANCELLED.getCode());
|
||||
break;
|
||||
}
|
||||
case IN_PROGRESS: {
|
||||
dto.setBeginTimeLessEqual(now);
|
||||
dto.setEndTimeGreaterEqual(now);
|
||||
dto.setCancelStatus(ConferenceCancelStatusEnum.NOT_CANCELLED.getCode());
|
||||
break;
|
||||
}
|
||||
case OVER: {
|
||||
dto.setEndTimeLessThan(now);
|
||||
dto.setCancelStatus(ConferenceCancelStatusEnum.NOT_CANCELLED.getCode());
|
||||
break;
|
||||
}
|
||||
case CANCELLED: {
|
||||
dto.setCancelStatus(ConferenceCancelStatusEnum.CANCELLED.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
CloudwalkPageAble pageAble = null;
|
||||
try {
|
||||
pageAble = this.conferenceManager.page(page, dto);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.logger.error("\u5206\u9875\u67e5\u8be2\u4f1a\u8bae\u5217\u8868\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty((Collection)pageAble.getDatas())) {
|
||||
ConferencePersonCountQueryDTO conferencePersonCountQueryDTO = new ConferencePersonCountQueryDTO();
|
||||
conferencePersonCountQueryDTO.setConferenceIds(pageAble.getDatas().stream().map(CloudwalkBaseIdentify::getId).collect(Collectors.toList()));
|
||||
List countResultDTOList = null;
|
||||
try {
|
||||
countResultDTOList = this.conferencePersonManager.personCount(conferencePersonCountQueryDTO);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.logger.error("\u67e5\u8be2\u53c2\u4f1a\u4eba\u6570\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
Map<String, Integer> confenreceParticipantsMap = countResultDTOList.stream().collect(Collectors.toMap(ConferencePersonCountResultDTO::getConferenceId, ConferencePersonCountResultDTO::getParticipantsCount));
|
||||
List result = pageAble.getDatas().stream().map(conferenceResultDTO -> {
|
||||
ConferenceResult conferenceResult = (ConferenceResult)BeanCopyUtils.copyProperties((Object)conferenceResultDTO, ConferenceResult.class);
|
||||
try {
|
||||
List<ConferenceDeviceResult> devices = this.queryConferenceDevice(conferenceResultDTO.getId(), context);
|
||||
if (!CollectionUtils.isEmpty(devices)) {
|
||||
conferenceResult.setDevices(devices);
|
||||
}
|
||||
}
|
||||
catch (ServiceException e) {
|
||||
throw new RuntimeException("\u67e5\u8be2\u4f1a\u8bae\u8bbe\u5907\u5931\u8d25\uff0c\u539f\u56e0\uff1a", e);
|
||||
}
|
||||
Integer personCount = (Integer)confenreceParticipantsMap.get(conferenceResultDTO.getId());
|
||||
conferenceResult.setParticipantsCount(Integer.valueOf(personCount == null ? 0 : personCount));
|
||||
if (YesNoTypeEnum.N.getCode().equals(conferenceResultDTO.getIsSignoff())) {
|
||||
conferenceResultDTO.setSignoffDeadline(conferenceResultDTO.getEndTime());
|
||||
conferenceResult.setSignoffDeadline(null);
|
||||
}
|
||||
if (conferenceResultDTO.getCancelStatus().equals(ConferenceCancelStatusEnum.NOT_CANCELLED.getCode())) {
|
||||
if (conferenceResultDTO.getSignBeginTime() > now) {
|
||||
conferenceResult.setStatus(ConferenceStatusEnum.NOT_STARTED.getCode());
|
||||
} else if (conferenceResultDTO.getSignBeginTime() <= now && conferenceResultDTO.getSignoffDeadline() >= now) {
|
||||
conferenceResult.setStatus(ConferenceStatusEnum.IN_PROGRESS.getCode());
|
||||
} else {
|
||||
conferenceResult.setStatus(ConferenceStatusEnum.OVER.getCode());
|
||||
}
|
||||
} else {
|
||||
conferenceResult.setStatus(ConferenceStatusEnum.CANCELLED.getCode());
|
||||
}
|
||||
return conferenceResult;
|
||||
}).collect(Collectors.toList());
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(result, page, pageAble.getTotalRows()));
|
||||
}
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble((Collection)Collections.EMPTY_LIST, page, pageAble.getTotalRows()));
|
||||
}
|
||||
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<ConferenceDetailResult> detail(ConferenceDetailParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
ConferenceGetsDTO conferenceGetsDTO = new ConferenceGetsDTO();
|
||||
conferenceGetsDTO.setBusinessId(context.getCompany().getCompanyId());
|
||||
conferenceGetsDTO.setIds(Collections.singletonList(param.getId()));
|
||||
try {
|
||||
List conferenceResultDTOS = this.conferenceManager.gets(conferenceGetsDTO);
|
||||
if (CollectionUtils.isEmpty((Collection)conferenceResultDTOS)) {
|
||||
return CloudwalkResult.fail((String)"76280105", (String)this.getMessage("76280105"));
|
||||
}
|
||||
ConferenceDetailResult conferenceDetailResult = (ConferenceDetailResult)BeanCopyUtils.copyProperties(conferenceResultDTOS.get(0), ConferenceDetailResult.class);
|
||||
List<ConferenceDeviceResult> devices = this.queryConferenceDevice(param.getId(), context);
|
||||
if (!CollectionUtils.isEmpty(devices)) {
|
||||
conferenceDetailResult.setDevices(devices);
|
||||
}
|
||||
ConferencePersonQueryDTO conferencePersonQueryDTO = new ConferencePersonQueryDTO();
|
||||
conferencePersonQueryDTO.setConferenceId(param.getId());
|
||||
List personResultDTOS = this.conferencePersonManager.query(conferencePersonQueryDTO);
|
||||
if (!CollectionUtils.isEmpty((Collection)personResultDTOS)) {
|
||||
PersonQueryParam personQueryParam = new PersonQueryParam();
|
||||
personQueryParam.setIds(personResultDTOS.stream().map(ConferencePersonResultDTO::getPersonId).collect(Collectors.toList()));
|
||||
CloudwalkResult personResultListResult = this.personService.list(personQueryParam, context);
|
||||
if (!personResultListResult.isSuccess()) {
|
||||
this.logger.error("\u67e5\u8be2\u4eba\u5458\u5217\u8868\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Object)personResultListResult.getMessage());
|
||||
throw new ServiceException("\u67e5\u8be2\u4eba\u5458\u5217\u8868\u5931\u8d25");
|
||||
}
|
||||
List personResultList = (List)personResultListResult.getData();
|
||||
if (!CollectionUtils.isEmpty((Collection)personResultList)) {
|
||||
List persons = personResultList.stream().map(personResult -> {
|
||||
ConferencePersonResult conferencePersonResult = new ConferencePersonResult();
|
||||
conferencePersonResult.setPersonId(personResult.getId());
|
||||
conferencePersonResult.setPersonName(personResult.getName());
|
||||
String cwosPicUrl = this.conferenceProperties.getCwosPicUrl();
|
||||
conferencePersonResult.setRegFaceUrl(cwosPicUrl + personResult.getComparePicture());
|
||||
return conferencePersonResult;
|
||||
}).collect(Collectors.toList());
|
||||
conferenceDetailResult.setPersons(persons);
|
||||
}
|
||||
}
|
||||
if (YesNoTypeEnum.N.getCode().equals(conferenceDetailResult.getIsSignoff())) {
|
||||
conferenceDetailResult.setSignoffDeadline(null);
|
||||
}
|
||||
return CloudwalkResult.success((Object)conferenceDetailResult);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u67e5\u8be2\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u67e5\u8be2\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor={Exception.class})
|
||||
public CloudwalkResult<Boolean> cancel(ConferenceCancelParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
ConferenceEditDTO conferenceEditDTO = new ConferenceEditDTO();
|
||||
conferenceEditDTO.setId(param.getId());
|
||||
conferenceEditDTO.setBusinessId(context.getCompany().getCompanyId());
|
||||
conferenceEditDTO.setCancelStatus(ConferenceCancelStatusEnum.CANCELLED.getCode());
|
||||
try {
|
||||
this.conferenceManager.edit(conferenceEditDTO);
|
||||
String applicationId = this.getApplicationId(context.getCompany().getCompanyId());
|
||||
super.cancelCwos(param, applicationId, context);
|
||||
return CloudwalkResult.success((Object)true);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u53d6\u6d88\u4f1a\u8bae\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u53d6\u6d88\u4f1a\u8bae\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
public CloudwalkResult<CloudwalkPageAble<ConferenceImageStoreCleanResult>> expiredPage(ConferenceImageStoreCleanParam cleanParam, CloudwalkPageInfo page) throws ServiceException {
|
||||
ConferenceImageStoreExpiredDTO dto = (ConferenceImageStoreExpiredDTO)BeanCopyUtils.copyProperties((Object)cleanParam, ConferenceImageStoreExpiredDTO.class);
|
||||
CloudwalkPageAble pageAble = null;
|
||||
try {
|
||||
pageAble = this.conferenceManager.expiredPage(page, dto);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.logger.error("\u5206\u9875\u67e5\u8be2\u5931\u6548\u4f1a\u8bae\u56fe\u5e93\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty((Collection)pageAble.getDatas())) {
|
||||
ArrayList<ConferenceImageStoreCleanResult> resultList = new ArrayList<ConferenceImageStoreCleanResult>(16);
|
||||
for (ConferenceImageStoreExpiredResultDTO resultDTO : pageAble.getDatas()) {
|
||||
ConferenceImageStoreCleanResult result = new ConferenceImageStoreCleanResult();
|
||||
result.setConferenceId(resultDTO.getConferenceId());
|
||||
result.setBusinessId(resultDTO.getBusinessId());
|
||||
result.setImageStoreId(resultDTO.getImageStoreId());
|
||||
ConferenceDeviceQueryDTO deviceQueryDTO = new ConferenceDeviceQueryDTO();
|
||||
deviceQueryDTO.setConferenceId(resultDTO.getConferenceId());
|
||||
try {
|
||||
List deviceResultDTOS = this.conferenceDeviceManager.query(deviceQueryDTO);
|
||||
if (!CollectionUtils.isEmpty((Collection)deviceResultDTOS)) {
|
||||
List deviceIds = deviceResultDTOS.stream().map(ConferenceDeviceResultDTO::getDeviceId).collect(Collectors.toList());
|
||||
result.setDeviceIds(deviceIds);
|
||||
}
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u4f1a\u8bae\u8bbe\u5907\u67e5\u8be2\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
resultList.add(result);
|
||||
}
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(resultList, page, pageAble.getTotalRows()));
|
||||
}
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble((Collection)Collections.EMPTY_LIST, page, pageAble.getTotalRows()));
|
||||
}
|
||||
|
||||
private void conferenceAddValidate(ConferenceAddParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
if (param.getIsSignoff().equals(SignoffSettingEnum.YES.getCode()) && param.getSignoffDeadline() == null) {
|
||||
throw new SignoffDeadlineRequiredException("\u8bbe\u7f6e\u4e3a\u9700\u8981\u7b7e\u9000\uff0c\u7b7e\u9000\u622a\u6b62\u65f6\u95f4\u5fc5\u586b");
|
||||
}
|
||||
if (param.getSignBeginTime().compareTo(param.getBeginTime()) > 0) {
|
||||
throw new SignTimeLaterThanBeginTimeException("\u7b7e\u5230\u5f00\u59cb\u65f6\u95f4\u665a\u4e8e\u4f1a\u8bae\u5f00\u59cb\u65f6\u95f4\u5f02\u5e38");
|
||||
}
|
||||
if (param.getBeginTime().compareTo(param.getEndTime()) > 0) {
|
||||
throw new BeginTimeLaterThanEndTimeException("\u4f1a\u8bae\u5f00\u59cb\u65f6\u95f4\u665a\u4e8e\u4f1a\u8bae\u7ed3\u675f\u65f6\u95f4\u5f02\u5e38");
|
||||
}
|
||||
if (param.getSignoffDeadline() != null && param.getEndTime().compareTo(param.getSignoffDeadline()) > 0) {
|
||||
throw new SignoffTimeEarlierThanEndTimeException("\u4f1a\u8bae\u7b7e\u9000\u65f6\u95f4\u65e9\u4e8e\u4f1a\u8bae\u7ed3\u675f\u65f6\u95f4\u5f02\u5e38");
|
||||
}
|
||||
}
|
||||
|
||||
private void conferenceEditValidate(ConferenceEditParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
ConferenceGetsDTO getsDTO = new ConferenceGetsDTO();
|
||||
getsDTO.setIds(Collections.singletonList(param.getId()));
|
||||
getsDTO.setBusinessId(context.getCompany().getCompanyId());
|
||||
List conferenceResultDTOS = this.conferenceManager.gets(getsDTO);
|
||||
if (CollectionUtils.isEmpty((Collection)conferenceResultDTOS)) {
|
||||
throw new ConferenceNotExistsException("\u4f1a\u8bae\u4e0d\u5b58\u5728");
|
||||
}
|
||||
if (((ConferenceResultDTO)conferenceResultDTOS.get(0)).getSignBeginTime().compareTo(System.currentTimeMillis()) <= 0) {
|
||||
throw new ConferenceEditAfterBeginningException("\u4f1a\u8bae\u5f00\u59cb\u540e\u4e0d\u5141\u8bb8\u7f16\u8f91");
|
||||
}
|
||||
if (param.getIsSignoff().equals(SignoffSettingEnum.YES.getCode()) && param.getSignoffDeadline() == null) {
|
||||
throw new SignoffDeadlineRequiredException("\u8bbe\u7f6e\u4e3a\u9700\u8981\u7b7e\u9000\uff0c\u7b7e\u9000\u622a\u6b62\u65f6\u95f4\u5fc5\u586b");
|
||||
}
|
||||
if (param.getSignBeginTime().compareTo(param.getBeginTime()) > 0) {
|
||||
throw new SignTimeLaterThanBeginTimeException("\u7b7e\u5230\u5f00\u59cb\u65f6\u95f4\u665a\u4e8e\u4f1a\u8bae\u5f00\u59cb\u65f6\u95f4\u5f02\u5e38");
|
||||
}
|
||||
if (param.getBeginTime().compareTo(param.getEndTime()) > 0) {
|
||||
throw new BeginTimeLaterThanEndTimeException("\u4f1a\u8bae\u5f00\u59cb\u65f6\u95f4\u665a\u4e8e\u4f1a\u8bae\u7ed3\u675f\u65f6\u95f4\u5f02\u5e38");
|
||||
}
|
||||
if (param.getSignoffDeadline() != null && param.getEndTime().compareTo(param.getSignoffDeadline()) > 0) {
|
||||
throw new SignoffTimeEarlierThanEndTimeException("\u4f1a\u8bae\u7b7e\u9000\u65f6\u95f4\u65e9\u4e8e\u4f1a\u8bae\u7ed3\u675f\u65f6\u95f4\u5f02\u5e38");
|
||||
}
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u67e5\u8be2\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u67e5\u8be2\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private void saveConferenceDevice(String conferenceId, String applicationId, List<String> deviceIds, CloudwalkCallContext context) throws ServiceException {
|
||||
if (CollectionUtils.isEmpty(deviceIds)) {
|
||||
return;
|
||||
}
|
||||
ArrayList deviceEditDTOList = Lists.newArrayListWithCapacity((int)deviceIds.size());
|
||||
for (String deviceId : deviceIds) {
|
||||
ConferenceDeviceEditDTO conferenceDeviceEditDTO = new ConferenceDeviceEditDTO();
|
||||
conferenceDeviceEditDTO.setConferenceId(conferenceId);
|
||||
conferenceDeviceEditDTO.setDeviceId(deviceId);
|
||||
BeanCopyUtils.copyProperties((Object)conferenceDeviceEditDTO, (Object)context);
|
||||
deviceEditDTOList.add(conferenceDeviceEditDTO);
|
||||
}
|
||||
try {
|
||||
this.conferenceDeviceManager.add((List)deviceEditDTOList);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u4fdd\u5b58\u4f1a\u8bae\u7b7e\u5230\u8bbe\u5907\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u4fdd\u5b58\u4f1a\u8bae\u7b7e\u5230\u8bbe\u5907\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private void addConference(String conferenceId, ConferenceAddParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
ConferenceEditDTO conferenceEditDTO = new ConferenceEditDTO();
|
||||
conferenceEditDTO.setId(conferenceId);
|
||||
BeanCopyUtils.copyProperties((Object)param, (CloudwalkCallContext)context, (Object)conferenceEditDTO);
|
||||
if (YesNoTypeEnum.N.getCode().equals(param.getIsSignoff())) {
|
||||
conferenceEditDTO.setSignoffDeadline(param.getEndTime());
|
||||
}
|
||||
conferenceEditDTO.setBusinessId(context.getCompany().getCompanyId());
|
||||
conferenceEditDTO.setCancelStatus(ConferenceCancelStatusEnum.NOT_CANCELLED.getCode());
|
||||
this.conferenceManager.add(conferenceEditDTO);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u4fdd\u5b58\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u4fdd\u5b58\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private void editConference(ConferenceEditParam param, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
ConferenceEditDTO conferenceEditDTO = new ConferenceEditDTO();
|
||||
BeanCopyUtils.copyProperties((Object)param, (CloudwalkCallContext)context, (Object)conferenceEditDTO);
|
||||
if (YesNoTypeEnum.N.getCode().equals(param.getIsSignoff())) {
|
||||
conferenceEditDTO.setSignoffDeadline(param.getEndTime());
|
||||
}
|
||||
conferenceEditDTO.setBusinessId(context.getCompany().getCompanyId());
|
||||
this.conferenceManager.edit(conferenceEditDTO);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u7f16\u8f91\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u7f16\u8f91\u4f1a\u8bae\u4fe1\u606f\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private List<ConferenceDeviceResultDTO> editConferenceDevice(ConferenceEditParam param, String applicationId, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
ConferenceDeviceQueryDTO deviceQueryDTO = new ConferenceDeviceQueryDTO();
|
||||
deviceQueryDTO.setConferenceId(param.getId());
|
||||
List deviceList = this.conferenceDeviceManager.query(deviceQueryDTO);
|
||||
ConferenceDeviceDelDTO deviceDelDTO = new ConferenceDeviceDelDTO();
|
||||
deviceDelDTO.setConferenceId(param.getId());
|
||||
this.conferenceDeviceManager.delete(deviceDelDTO);
|
||||
this.saveConferenceDevice(param.getId(), applicationId, param.getDeviceIds(), context);
|
||||
return deviceList;
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u7f16\u8f91\u4f1a\u8bae\u7b7e\u5230\u8bbe\u5907\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u7f16\u8f91\u4f1a\u8bae\u7b7e\u5230\u8bbe\u5907\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private void addConferencePerson(String conferenceId, ConferenceAddParam param, String applicationId, CloudwalkCallContext context) throws ServiceException {
|
||||
if (!CollectionUtils.isEmpty((Collection)param.getPersonIds())) {
|
||||
try {
|
||||
ArrayList personEditDTOList = Lists.newArrayListWithCapacity((int)param.getPersonIds().size());
|
||||
for (String personId : param.getPersonIds()) {
|
||||
ConferencePersonEditDTO conferencePersonEditDTO = new ConferencePersonEditDTO();
|
||||
conferencePersonEditDTO.setConferenceId(conferenceId);
|
||||
conferencePersonEditDTO.setPersonId(personId);
|
||||
BeanCopyUtils.copyProperties((CloudwalkBaseTimes)conferencePersonEditDTO, (CloudwalkCallContext)context);
|
||||
personEditDTOList.add(conferencePersonEditDTO);
|
||||
}
|
||||
this.conferencePersonManager.add((List)personEditDTOList);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u4fdd\u5b58\u4f1a\u8bae\u53c2\u4f1a\u4eba\u5458\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u4fdd\u5b58\u4f1a\u8bae\u53c2\u4f1a\u4eba\u5458\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void editConferencePerson(ConferenceEditParam param, String applicationId, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
ConferencePersonDelDTO personDelDTO = new ConferencePersonDelDTO();
|
||||
personDelDTO.setConferenceId(param.getId());
|
||||
this.conferencePersonManager.delete(personDelDTO);
|
||||
if (!CollectionUtils.isEmpty((Collection)param.getPersonIds())) {
|
||||
List list = param.getPersonIds().stream().map(personId -> {
|
||||
ConferencePersonEditDTO conferencePersonEditDTO = new ConferencePersonEditDTO();
|
||||
conferencePersonEditDTO.setConferenceId(param.getId());
|
||||
conferencePersonEditDTO.setPersonId(personId);
|
||||
return conferencePersonEditDTO;
|
||||
}).collect(Collectors.toList());
|
||||
this.conferencePersonManager.add(list);
|
||||
}
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u7f16\u8f91\u4f1a\u8bae\u4eba\u5458\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u7f16\u8f91\u4f1a\u8bae\u4eba\u5458\u5931\u8d25");
|
||||
}
|
||||
}
|
||||
|
||||
private List<ConferenceDeviceResult> queryConferenceDevice(String conferenceId, CloudwalkCallContext context) throws ServiceException {
|
||||
List<Object> devices = new ArrayList<ConferenceDeviceResult>();
|
||||
ConferenceDeviceQueryDTO conferenceDeviceQueryDTO = new ConferenceDeviceQueryDTO();
|
||||
conferenceDeviceQueryDTO.setConferenceId(conferenceId);
|
||||
List deviceResultDTOS = null;
|
||||
try {
|
||||
deviceResultDTOS = this.conferenceDeviceManager.query(conferenceDeviceQueryDTO);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u67e5\u8be2\u4f1a\u8bae\u8bbe\u5907\u4fe1\u606f\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException("\u67e5\u8be2\u4f1a\u8bae\u8bbe\u5907\u4fe1\u606f\u5931\u8d25");
|
||||
}
|
||||
if (!CollectionUtils.isEmpty((Collection)deviceResultDTOS)) {
|
||||
DeviceQueryParam deviceQueryParam = new DeviceQueryParam();
|
||||
deviceQueryParam.setIds(deviceResultDTOS.stream().map(ConferenceDeviceResultDTO::getDeviceId).collect(Collectors.toList()));
|
||||
CloudwalkResult deviceResultListResult = this.deviceService.list(deviceQueryParam, context);
|
||||
if (!deviceResultListResult.isSuccess()) {
|
||||
this.logger.error("\u67e5\u8be2\u8bbe\u5907\u5217\u8868\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Object)deviceResultListResult.getMessage());
|
||||
throw new ServiceException("\u67e5\u8be2\u8bbe\u5907\u5217\u8868\u5931\u8d25");
|
||||
}
|
||||
List deviceResultList = (List)deviceResultListResult.getData();
|
||||
if (!CollectionUtils.isEmpty((Collection)deviceResultList)) {
|
||||
devices = deviceResultList.stream().map(deviceResult -> {
|
||||
ConferenceDeviceResult conferenceDeviceResult = new ConferenceDeviceResult();
|
||||
conferenceDeviceResult.setDeviceId(deviceResult.getId());
|
||||
conferenceDeviceResult.setDeviceName(deviceResult.getDeviceName());
|
||||
return conferenceDeviceResult;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService
|
||||
* cn.cloudwalk.client.ninca.conference.device.param.ConferenceDeviceNewPageParam
|
||||
* cn.cloudwalk.client.ninca.conference.device.result.ConferenceDeviceResult
|
||||
* cn.cloudwalk.client.ninca.conference.device.service.ConferenceDeviceService
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageAble
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageInfo
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.util.CollectionUtils
|
||||
* cn.cloudwalk.common.ninca.conference.util.StringUtils
|
||||
* javax.annotation.Resource
|
||||
* org.springframework.stereotype.Service
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.device;
|
||||
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService;
|
||||
import cn.cloudwalk.client.ninca.conference.device.param.ConferenceDeviceNewPageParam;
|
||||
import cn.cloudwalk.client.ninca.conference.device.result.ConferenceDeviceResult;
|
||||
import cn.cloudwalk.client.ninca.conference.device.service.ConferenceDeviceService;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.util.CollectionUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ConferenceDeviceServiceImpl
|
||||
implements ConferenceDeviceService {
|
||||
@Resource
|
||||
private DeviceService deviceService;
|
||||
|
||||
public CloudwalkResult<CloudwalkPageAble<ConferenceDeviceResult>> page(ConferenceDeviceNewPageParam param, CloudwalkPageInfo pageInfo, CloudwalkCallContext cloudwalkContext) throws ServiceException {
|
||||
ArrayList<ConferenceDeviceResult> result = new ArrayList();
|
||||
DeviceQueryParam deviceQueryParam = new DeviceQueryParam();
|
||||
deviceQueryParam.setDistrictId(param.getDistrictId());
|
||||
deviceQueryParam.setDistrictIds(param.getDistrictIds());
|
||||
if (StringUtils.isNotEmpty((String)param.getAreaId())) {
|
||||
deviceQueryParam.setAreaIds(Collections.singletonList(param.getAreaId()));
|
||||
}
|
||||
deviceQueryParam.setDeviceName(param.getDeviceName());
|
||||
CloudwalkResult deviceResult = this.deviceService.filterList(Integer.valueOf(1), deviceQueryParam, cloudwalkContext);
|
||||
if (!deviceResult.isSuccess() || CollectionUtils.isEmpty((Collection)((Collection)deviceResult.getData()))) {
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(result, pageInfo, 0L));
|
||||
}
|
||||
result = ((List)deviceResult.getData()).stream().map(s -> (ConferenceDeviceResult)BeanCopyUtils.copyProperties((Object)s, ConferenceDeviceResult.class)).collect(Collectors.toList());
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(this.page(result, pageInfo.getPageSize(), pageInfo.getCurrentPage()), pageInfo, (long)result.size()));
|
||||
}
|
||||
|
||||
private List<ConferenceDeviceResult> page(List<ConferenceDeviceResult> dataList, int pageSize, int currentPage) {
|
||||
ArrayList<ConferenceDeviceResult> currentPageList = new ArrayList<ConferenceDeviceResult>();
|
||||
if (dataList != null && dataList.size() > 0) {
|
||||
int currIdx = currentPage > 1 ? (currentPage - 1) * pageSize : 0;
|
||||
for (int i = 0; i < pageSize && i < dataList.size() - currIdx; ++i) {
|
||||
ConferenceDeviceResult data = dataList.get(currIdx + i);
|
||||
currentPageList.add(data);
|
||||
}
|
||||
}
|
||||
return currentPageList;
|
||||
}
|
||||
}
|
||||
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.file.param.FileFinishParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.file.param.FileGetParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.file.param.FileInitParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.file.result.FileDetail
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.file.service.FileService
|
||||
* cn.cloudwalk.client.ninca.conference.downloadcenter.param.ConferenceFileFinishParam
|
||||
* cn.cloudwalk.client.ninca.conference.downloadcenter.service.ConferenceDownloadCenterService
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.em.FileStatusEnum
|
||||
* cn.cloudwalk.common.ninca.conference.util.FeignThreadLocalUtil
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.stereotype.Service
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.downloadcenter;
|
||||
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.file.param.FileFinishParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.file.param.FileGetParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.file.param.FileInitParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.file.result.FileDetail;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.file.service.FileService;
|
||||
import cn.cloudwalk.client.ninca.conference.downloadcenter.param.ConferenceFileFinishParam;
|
||||
import cn.cloudwalk.client.ninca.conference.downloadcenter.service.ConferenceDownloadCenterService;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.em.FileStatusEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.util.FeignThreadLocalUtil;
|
||||
import cn.cloudwalk.service.ninca.conference.cacheable.ConferenceApplicationCacheableService;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ConferenceDownloadCenterServiceImpl
|
||||
extends AbstractService
|
||||
implements ConferenceDownloadCenterService {
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
@Autowired
|
||||
private ConferenceApplicationCacheableService conferenceApplicationCacheableService;
|
||||
|
||||
public String createDownload(String fileName, CloudwalkCallContext context) {
|
||||
try {
|
||||
FileInitParam fileInitParam = new FileInitParam();
|
||||
fileInitParam.setFileName(fileName);
|
||||
context.setApplicationId(this.conferenceApplicationCacheableService.getApplicationId(context.getCompany().getCompanyId()));
|
||||
fileInitParam.setApplicationId(context.getApplicationId());
|
||||
FeignThreadLocalUtil.setRequestHeader((CloudwalkCallContext)context);
|
||||
CloudwalkResult result = this.fileService.init(fileInitParam, context);
|
||||
if ("00000000".equals(result.getCode())) {
|
||||
String string = (String)result.getData();
|
||||
return string;
|
||||
}
|
||||
try {
|
||||
this.logger.error("\u4e0b\u8f7d\u4efb\u52a1\u521d\u59cb\u5316\u5931\u8d25\uff1acode={},message={}", (Object)result.getCode(), (Object)result.getMessage());
|
||||
throw new RuntimeException("\u4e0b\u8f7d\u4efb\u52a1\u521b\u5efa\u5931\u8d25\uff01");
|
||||
}
|
||||
catch (ServiceException e) {
|
||||
this.logger.error("\u4e0b\u8f7d\u4efb\u52a1\u521d\u59cb\u5316\u63a5\u53e3\u9519\u8bef", (Throwable)e);
|
||||
throw new RuntimeException("\u4e0b\u8f7d\u4efb\u52a1\u521b\u5efa\u5931\u8d25\uff01");
|
||||
}
|
||||
}
|
||||
finally {
|
||||
FeignThreadLocalUtil.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public boolean finishDownload(ConferenceFileFinishParam param, CloudwalkCallContext context) {
|
||||
try {
|
||||
FeignThreadLocalUtil.setRequestHeader((CloudwalkCallContext)context);
|
||||
FileFinishParam fileFinishParam = (FileFinishParam)BeanCopyUtils.copyProperties((Object)param, FileFinishParam.class);
|
||||
CloudwalkResult result = this.fileService.finish(fileFinishParam, context);
|
||||
if ("00000000".equals(result.getCode())) {
|
||||
boolean bl = true;
|
||||
return bl;
|
||||
}
|
||||
this.logger.error("\u4e0b\u8f7d\u4efb\u52a1\u5b8c\u6210\u5931\u8d25\uff1acode={},message={}", (Object)result.getCode(), (Object)result.getMessage());
|
||||
}
|
||||
catch (ServiceException e) {
|
||||
this.logger.error("\u4e0b\u8f7d\u4efb\u52a1\u5b8c\u6210\u63a5\u53e3\u9519\u8bef", (Throwable)e);
|
||||
}
|
||||
finally {
|
||||
FeignThreadLocalUtil.remove();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int queryDownloadStatus(String fileId, CloudwalkCallContext context) {
|
||||
try {
|
||||
FileGetParam fileGetParam = new FileGetParam();
|
||||
fileGetParam.setFileId(fileId);
|
||||
CloudwalkResult result = this.fileService.get(fileGetParam, context);
|
||||
if ("00000000".equals(result.getCode())) {
|
||||
return ((FileDetail)result.getData()).getStatus();
|
||||
}
|
||||
this.logger.error("\u4e0b\u8f7d\u4efb\u52a1\u521d\u59cb\u5316\u5931\u8d25\uff1acode={},message={}", (Object)result.getCode(), (Object)result.getMessage());
|
||||
}
|
||||
catch (ServiceException e) {
|
||||
this.logger.error("\u4e0b\u8f7d\u4efb\u52a1\u5b8c\u6210\u63a5\u53e3\u9519\u8bef", (Throwable)e);
|
||||
}
|
||||
return FileStatusEnum.PRODUCING.getCode();
|
||||
}
|
||||
}
|
||||
|
||||
+373
@@ -0,0 +1,373 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.biz.ninca.conference.export.ConferenceParallelismDownloadManager
|
||||
* cn.cloudwalk.client.davinci.portal.file.param.part.FilePartAppendParam
|
||||
* cn.cloudwalk.client.davinci.portal.file.param.part.FilePartFinishParam
|
||||
* cn.cloudwalk.client.davinci.portal.file.param.part.FilePartInitParam
|
||||
* cn.cloudwalk.client.davinci.portal.file.result.FilePartResult
|
||||
* cn.cloudwalk.client.ninca.conference.downloadcenter.param.ConferenceFileFinishParam
|
||||
* cn.cloudwalk.client.ninca.conference.downloadcenter.service.ConferenceDownloadCenterService
|
||||
* cn.cloudwalk.client.ninca.conference.storage.service.ConferenceFileStorageService
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageAble
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageInfo
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.common.ninca.conference.common.ExcelCallback
|
||||
* cn.cloudwalk.common.ninca.conference.em.FileStatusEnum
|
||||
* cn.cloudwalk.common.ninca.conference.util.ExcelUtil
|
||||
* cn.cloudwalk.common.ninca.conference.util.FeignThreadLocalUtil
|
||||
* cn.cloudwalk.common.ninca.conference.util.StringUtils
|
||||
* cn.cloudwalk.intelligent.lock.annotation.RequiredLock
|
||||
* com.google.common.collect.Lists
|
||||
* javax.annotation.Resource
|
||||
* org.apache.commons.io.IOUtils
|
||||
* org.slf4j.Logger
|
||||
* org.slf4j.LoggerFactory
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.beans.factory.annotation.Value
|
||||
* org.springframework.data.redis.core.RedisTemplate
|
||||
* org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.export;
|
||||
|
||||
import cn.cloudwalk.biz.ninca.conference.export.ConferenceParallelismDownloadManager;
|
||||
import cn.cloudwalk.client.davinci.portal.file.param.part.FilePartAppendParam;
|
||||
import cn.cloudwalk.client.davinci.portal.file.param.part.FilePartFinishParam;
|
||||
import cn.cloudwalk.client.davinci.portal.file.param.part.FilePartInitParam;
|
||||
import cn.cloudwalk.client.davinci.portal.file.result.FilePartResult;
|
||||
import cn.cloudwalk.client.ninca.conference.downloadcenter.param.ConferenceFileFinishParam;
|
||||
import cn.cloudwalk.client.ninca.conference.downloadcenter.service.ConferenceDownloadCenterService;
|
||||
import cn.cloudwalk.client.ninca.conference.storage.service.ConferenceFileStorageService;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.common.ninca.conference.common.ExcelCallback;
|
||||
import cn.cloudwalk.common.ninca.conference.em.FileStatusEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.util.ExcelUtil;
|
||||
import cn.cloudwalk.common.ninca.conference.util.FeignThreadLocalUtil;
|
||||
import cn.cloudwalk.common.ninca.conference.util.StringUtils;
|
||||
import cn.cloudwalk.intelligent.lock.annotation.RequiredLock;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
public abstract class ConferenceAbstractExportAsyncService<T, R>
|
||||
extends AbstractService {
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ConferenceAbstractExportAsyncService.class);
|
||||
private static final Integer FILE_PART_BATCH_SIZE = 0x500001;
|
||||
@Value(value="${cloudwalk.conference-attendance.export-max-record:65000}")
|
||||
private int EXPORT_MAX_RECORD;
|
||||
@Autowired
|
||||
private ConferenceParallelismDownloadManager conferenceParallelismDownloadManager;
|
||||
@Autowired
|
||||
private ConferenceFileStorageService conferenceFileStorageService;
|
||||
@Autowired
|
||||
private ConferenceDownloadCenterService conferenceDownloadCenterService;
|
||||
@Resource
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@RequiredLock(name="T(cn.cloudwalk.common.ninca.conference.cons.ConferenceConstants).LOCK_EXPORT_BUSINESSID_PREFIX.concat(#context.company.companyId)", lockWaitTime=5000L)
|
||||
public CloudwalkResult<Boolean> startExportTask(T param, Class<R> clazz, String fileName, CloudwalkCallContext context) throws ServiceException {
|
||||
String cacheKey = "conference_export_prefix:#" + context.getCompany().getCompanyId();
|
||||
try {
|
||||
String taskId = (String)this.redisTemplate.opsForValue().get((Object)cacheKey);
|
||||
if (StringUtils.isNotBlank((String)taskId)) {
|
||||
return CloudwalkResult.fail((String)"76240308", (String)this.getMessage("76240308"));
|
||||
}
|
||||
String exportFileName = StringUtils.isNotBlank((String)fileName) ? fileName : this.getDefaultFileName();
|
||||
ExportRecordContext.Builder builder = new ExportRecordContext.Builder();
|
||||
ExportRecordContext exportRecordContext = builder.withFileName(exportFileName).withTaskStatus(FileStatusEnum.PRODUCING.getCode()).build();
|
||||
((CompletableFuture)CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
String fileId = this.conferenceDownloadCenterService.createDownload(exportFileName, context);
|
||||
this.redisTemplate.opsForValue().set((Object)cacheKey, (Object)fileId, 5L, TimeUnit.MINUTES);
|
||||
exportRecordContext.setFileId(fileId);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOGGER.info("\u5bfc\u51fa\u65f6\uff0c\u521d\u59cb\u5316\u5bfc\u51fa\u4efb\u52a1\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
this.redisTemplate.delete((Object)cacheKey);
|
||||
throw new CompletionException(e);
|
||||
}
|
||||
}).thenAccept(n -> {
|
||||
try {
|
||||
this.export(param, clazz, context, exportRecordContext);
|
||||
}
|
||||
catch (Exception e) {
|
||||
ServiceException serviceException = (ServiceException)e.getCause();
|
||||
LOGGER.info("\u5bfc\u51fa\u65f6\u5f02\u5e38\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
ConferenceFileFinishParam fileFinishParam = new ConferenceFileFinishParam();
|
||||
fileFinishParam.setFileId(exportRecordContext.getFileId());
|
||||
fileFinishParam.setErrorCode("76240307");
|
||||
fileFinishParam.setFileStatus(FileStatusEnum.FAIL.getCode());
|
||||
fileFinishParam.setErrorMessage(serviceException.getMessage());
|
||||
this.conferenceDownloadCenterService.finishDownload(fileFinishParam, context);
|
||||
throw new CompletionException(e);
|
||||
}
|
||||
finally {
|
||||
FeignThreadLocalUtil.remove();
|
||||
this.redisTemplate.delete((Object)cacheKey);
|
||||
}
|
||||
})).whenComplete((n, e) -> {
|
||||
if (null != e) {
|
||||
ServiceException serviceException = (ServiceException)e.getCause();
|
||||
LOGGER.error("\u5f02\u6b65\u5bfc\u51fa\u4efb\u52a1\u8fd0\u884c\u5931\u8d25\uff0c\u539f\u56e0\uff1a", e);
|
||||
ConferenceFileFinishParam fileFinishParam = new ConferenceFileFinishParam();
|
||||
fileFinishParam.setFileId(exportRecordContext.getFileId());
|
||||
fileFinishParam.setErrorCode(serviceException.getCode());
|
||||
fileFinishParam.setErrorMessage(serviceException.getMessage());
|
||||
fileFinishParam.setFileStatus(FileStatusEnum.FAIL.getCode());
|
||||
this.conferenceDownloadCenterService.finishDownload(fileFinishParam, context);
|
||||
} else if (FileStatusEnum.CANCELED.getCode().intValue() != exportRecordContext.getTaskStatus()) {
|
||||
LOGGER.info("\u5f02\u6b65\u5bfc\u51fa\u6210\u529f\u3002[{}]", (Object)exportRecordContext.toString());
|
||||
ConferenceFileFinishParam fileFinishParam = new ConferenceFileFinishParam();
|
||||
fileFinishParam.setFileId(exportRecordContext.getFileId());
|
||||
fileFinishParam.setFilePath(exportRecordContext.getFilePath());
|
||||
fileFinishParam.setFileSize(exportRecordContext.getFileSize());
|
||||
fileFinishParam.setFileStatus(FileStatusEnum.FINISH.getCode());
|
||||
this.conferenceDownloadCenterService.finishDownload(fileFinishParam, context);
|
||||
}
|
||||
});
|
||||
return CloudwalkResult.success((Object)true);
|
||||
}
|
||||
catch (Exception e2) {
|
||||
this.logger.error("\u5f02\u6b65\u5bfc\u51fa\u4efb\u52a1\u5f02\u5e38\uff0c\u539f\u56e0\uff1a", (Throwable)e2);
|
||||
throw new ServiceException((Throwable)e2);
|
||||
}
|
||||
}
|
||||
|
||||
private void export(T param, Class<R> clazz, CloudwalkCallContext context, ExportRecordContext exportRecordContext) throws Exception {
|
||||
ByteArrayInputStream inputStream;
|
||||
ByteArrayOutputStream outputStream;
|
||||
block3: {
|
||||
int taskStatus;
|
||||
FeignThreadLocalUtil.setRequestHeader((CloudwalkCallContext)context);
|
||||
int startPage = 1;
|
||||
int pageSize = 100;
|
||||
int maxPageSize = this.EXPORT_MAX_RECORD / 100;
|
||||
outputStream = new ByteArrayOutputStream();
|
||||
inputStream = null;
|
||||
do {
|
||||
CloudwalkPageInfo pageInfo = new CloudwalkPageInfo(startPage, 100);
|
||||
CloudwalkPageAble<R> dataPage = this.queryPage(param, pageInfo, context);
|
||||
ArrayList dataList = Lists.newArrayList((Iterable)dataPage.getDatas());
|
||||
this.conferenceParallelismDownloadManager.parallelResolve((List)dataList, clazz);
|
||||
if (startPage == 1) {
|
||||
ExcelCallback callback = this.getExcelCallback(param);
|
||||
ExcelUtil.getListToExcel((List)dataList, (String)this.getDefaultFileTitleName(), (OutputStream)outputStream, clazz, (Integer)this.getStartRow(), (ExcelCallback)callback);
|
||||
} else {
|
||||
outputStream = new ByteArrayOutputStream();
|
||||
ExcelUtil.appendListToExcel((InputStream)inputStream, (List)dataList, (int)0, (OutputStream)outputStream, clazz, (Integer)((startPage - 1) * 100 + this.getStartRow() + 1));
|
||||
}
|
||||
inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
if ((long)(++startPage) > dataPage.getTotalPages() || startPage > maxPageSize + 1) break block3;
|
||||
taskStatus = this.conferenceDownloadCenterService.queryDownloadStatus(exportRecordContext.getFileId(), context);
|
||||
} while (FileStatusEnum.PRODUCING.getCode() == taskStatus);
|
||||
this.logger.info("\u5bfc\u51fa\u4efb\u52a1\u5df2\u53d6\u6d88");
|
||||
exportRecordContext.setTaskStatus(taskStatus);
|
||||
IOUtils.closeQuietly((InputStream)inputStream);
|
||||
return;
|
||||
}
|
||||
IOUtils.closeQuietly((InputStream)inputStream);
|
||||
byte[] fileByte = outputStream.toByteArray();
|
||||
exportRecordContext.setFileSize(Long.valueOf(fileByte.length));
|
||||
String filePath = this.fileStore(exportRecordContext.getFileName() + ".xls", fileByte);
|
||||
exportRecordContext.setFilePath(filePath);
|
||||
}
|
||||
|
||||
private String fileStore(String fileName, byte[] bytes) throws ServiceException {
|
||||
int size = bytes.length;
|
||||
LOGGER.info("\u6587\u4ef6\u5927\u5c0f\u4e3a: {}", (Object)size);
|
||||
FilePartInitParam param = new FilePartInitParam();
|
||||
param.setFileName(fileName);
|
||||
LOGGER.info("\u6587\u4ef6\u5206\u7247\u521d\u59cb\u5316\u5f00\u59cb");
|
||||
CloudwalkResult result = this.conferenceFileStorageService.filePartInit(param);
|
||||
if (result.isSuccess()) {
|
||||
CloudwalkResult finishResult;
|
||||
LOGGER.info("\u6587\u4ef6\u5206\u7247\u521d\u59cb\u5316\u7ed3\u675f\uff0cuploadId = {}, filePath = {}", (Object)((FilePartResult)result.getData()).getUploadId(), (Object)((FilePartResult)result.getData()).getFilePath());
|
||||
FilePartResult filePartResult = (FilePartResult)result.getData();
|
||||
int times = 0;
|
||||
while (true) {
|
||||
int start;
|
||||
int end = (start = times++ * FILE_PART_BATCH_SIZE) + FILE_PART_BATCH_SIZE > size ? size : start + FILE_PART_BATCH_SIZE;
|
||||
byte[] trunk = Arrays.copyOfRange(bytes, start, end);
|
||||
LOGGER.info("\u7b2c{}\u4e2a\u5206\u7247\u5f00\u59cb\u8ffd\u52a0\uff0cuploadId = {}, filePath = {}, size ; {}", new Object[]{times, filePartResult.getUploadId(), filePartResult.getFilePath(), trunk.length});
|
||||
FilePartAppendParam appendParam = new FilePartAppendParam();
|
||||
appendParam.setFilePath(filePartResult.getFilePath());
|
||||
appendParam.setPartNumber(Integer.valueOf(times));
|
||||
appendParam.setUploadId(filePartResult.getUploadId());
|
||||
appendParam.setContent((Object)trunk);
|
||||
this.conferenceFileStorageService.filePartAppend(appendParam);
|
||||
LOGGER.info("\u7b2c{}\u4e2a\u5206\u7247\u5b8c\u6210\u8ffd\u52a0\uff0cuploadId = {}, filePath = {}", new Object[]{times, filePartResult.getUploadId(), filePartResult.getFilePath()});
|
||||
if (end < size) continue;
|
||||
LOGGER.info("\u8ffd\u52a0\u5b8c\u6210\uff0c\u51c6\u5907\u7ed3\u675f\uff0cuploadId = {}, filePath = {}", (Object)filePartResult.getUploadId(), (Object)filePartResult.getFilePath());
|
||||
FilePartFinishParam finishParam = new FilePartFinishParam();
|
||||
finishParam.setFilePath(filePartResult.getFilePath());
|
||||
finishParam.setUploadId(filePartResult.getUploadId());
|
||||
finishParam.setFileSize(Long.valueOf(size));
|
||||
finishParam.setReturnType(Integer.valueOf(1));
|
||||
finishResult = this.conferenceFileStorageService.filePartFinish(finishParam);
|
||||
LOGGER.info("\u7ed3\u675f\u5b8c\u6210\uff0cuploadId = {}, filePath = {}, finishFilePath = {}", new Object[]{filePartResult.getUploadId(), filePartResult.getFilePath(), finishResult.getData()});
|
||||
if (finishResult.isSuccess()) break;
|
||||
}
|
||||
return ((String)finishResult.getData()).split("=")[1];
|
||||
}
|
||||
throw new ServiceException(result.getCode(), result.getMessage());
|
||||
}
|
||||
|
||||
protected abstract CloudwalkPageAble<R> queryPage(T var1, CloudwalkPageInfo var2, CloudwalkCallContext var3) throws ServiceException;
|
||||
|
||||
protected abstract String getDefaultFileName();
|
||||
|
||||
protected abstract String getDefaultFileTitleName();
|
||||
|
||||
protected abstract ExcelCallback getExcelCallback(Object var1);
|
||||
|
||||
protected abstract Integer getStartRow();
|
||||
|
||||
protected ThreadPoolTaskExecutor getExportExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(5);
|
||||
executor.setMaxPoolSize(30);
|
||||
executor.setThreadNamePrefix("Export-Pool-Executor");
|
||||
executor.setQueueCapacity(25);
|
||||
executor.initialize();
|
||||
executor.setRejectedExecutionHandler((RejectedExecutionHandler)new ThreadPoolExecutor.AbortPolicy());
|
||||
return executor;
|
||||
}
|
||||
|
||||
public CloudwalkResult<Integer> exportMaxRecord() throws ServiceException {
|
||||
try {
|
||||
return CloudwalkResult.success((Object)this.EXPORT_MAX_RECORD);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.logger.error("\u83b7\u53d6\u6700\u5927\u5bfc\u51fa\u8bb0\u5f55\u5931\u8d25", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExportRecordContext {
|
||||
private String fileId;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private Long fileSize;
|
||||
private int taskStatus;
|
||||
|
||||
private ExportRecordContext() {
|
||||
}
|
||||
|
||||
public int getTaskStatus() {
|
||||
return this.taskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(int taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return this.fileId;
|
||||
}
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return this.fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return this.fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ExportRecordContext{fileId='" + this.fileId + '\'' + ", filePath='" + this.filePath + '\'' + ", fileName='" + this.fileName + '\'' + ", fileSize=" + this.fileSize + ", taskStatus=" + this.taskStatus + '}';
|
||||
}
|
||||
|
||||
private static class Builder {
|
||||
private String fileId;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private Long fileSize;
|
||||
private int taskStatus;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder withTaskStatus(int taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExportRecordContext build() {
|
||||
ExportRecordContext context = new ExportRecordContext();
|
||||
context.setFileId(this.fileId);
|
||||
context.setFileSize(this.fileSize);
|
||||
context.setFilePath(this.filePath);
|
||||
context.setFileName(this.fileName);
|
||||
context.setTaskStatus(this.taskStatus);
|
||||
return context;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultDetailQueryParam
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailExcelResult
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultPersonListQueryResult
|
||||
* cn.cloudwalk.client.ninca.conference.result.service.ConferenceResultQueryService
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageAble
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageInfo
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.common.ExcelCallback
|
||||
* cn.cloudwalk.common.ninca.conference.em.SignResultEnum
|
||||
* cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum
|
||||
* cn.cloudwalk.common.ninca.conference.util.CollectionUtils
|
||||
* cn.cloudwalk.common.ninca.conference.util.DateUtils
|
||||
* org.apache.poi.hssf.usermodel.HSSFRow
|
||||
* org.apache.poi.ss.util.CellRangeAddress
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.stereotype.Service
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.export;
|
||||
|
||||
import cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultDetailQueryParam;
|
||||
import cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailExcelResult;
|
||||
import cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultPersonListQueryResult;
|
||||
import cn.cloudwalk.client.ninca.conference.result.service.ConferenceResultQueryService;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.common.ExcelCallback;
|
||||
import cn.cloudwalk.common.ninca.conference.em.SignResultEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.util.CollectionUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.util.DateUtils;
|
||||
import cn.cloudwalk.service.ninca.conference.export.ConferenceAbstractExportAsyncService;
|
||||
import cn.cloudwalk.service.ninca.conference.export.ExcelExportUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ConferencePersonExportAsyncService
|
||||
extends ConferenceAbstractExportAsyncService<ConferenceResultDetailQueryParam, ConferenceResultDetailExcelResult> {
|
||||
private static final String DEFAULT_EXPORT_FILE_NAME = "\u4f1a\u8bae\u5bfc\u51fa";
|
||||
private static final String DEFAULT_EXPORT_FILE_TITLE_NAME = "\u4f1a\u8bae\u7b7e\u5230\u8bb0\u5f55";
|
||||
private static final int DEFAULT_EXPORT_START_ROW = 1;
|
||||
@Autowired
|
||||
private ConferenceResultQueryService conferenceResultQueryService;
|
||||
|
||||
@Override
|
||||
protected CloudwalkPageAble<ConferenceResultDetailExcelResult> queryPage(ConferenceResultDetailQueryParam param, CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
|
||||
CloudwalkResult result = this.conferenceResultQueryService.personList(param, pageInfo, context);
|
||||
if (result.isSuccess()) {
|
||||
ArrayList<ConferenceResultDetailExcelResult> excelResults = new ArrayList<ConferenceResultDetailExcelResult>();
|
||||
if (result.getData() == null || CollectionUtils.isEmpty((Collection)((CloudwalkPageAble)result.getData()).getDatas())) {
|
||||
return new CloudwalkPageAble(excelResults, pageInfo, 0L);
|
||||
}
|
||||
List resultList = (List)((CloudwalkPageAble)result.getData()).getDatas();
|
||||
for (ConferenceResultPersonListQueryResult personResult : resultList) {
|
||||
ConferenceResultDetailExcelResult excelResult = (ConferenceResultDetailExcelResult)BeanCopyUtils.copyProperties((Object)personResult, ConferenceResultDetailExcelResult.class);
|
||||
excelResult.setSignin(personResult.getSignin() != null ? DateUtils.formatDate((Date)new Date(personResult.getSignin()), (String)"yyyy-MM-dd HH:mm:ss") : null);
|
||||
excelResult.setSignoff(personResult.getSignoff() != null ? DateUtils.formatDate((Date)new Date(personResult.getSignoff()), (String)"yyyy-MM-dd HH:mm:ss") : null);
|
||||
if (SignResultEnum.LATENESS.getCode().equals(personResult.getSignResult())) {
|
||||
excelResult.setIsLateness(YesNoTypeEnum.Y.getMessage());
|
||||
} else if (SignResultEnum.TARDY.getCode().equals(personResult.getSignResult())) {
|
||||
excelResult.setIsTardy(YesNoTypeEnum.Y.getMessage());
|
||||
} else if (personResult.getSignResult() == null || SignResultEnum.ABSENCE.getCode().equals(personResult.getSignResult())) {
|
||||
excelResult.setIsAbsence(YesNoTypeEnum.Y.getMessage());
|
||||
}
|
||||
excelResults.add(excelResult);
|
||||
}
|
||||
return new CloudwalkPageAble(excelResults, pageInfo, ((CloudwalkPageAble)result.getData()).getTotalRows());
|
||||
}
|
||||
throw new ServiceException(result.getCode(), result.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFileName() {
|
||||
return DEFAULT_EXPORT_FILE_NAME + DateUtils.formatDate((Date)new Date(), (String)"yyyyMMddHHmmss") + ".xls";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFileTitleName() {
|
||||
return DEFAULT_EXPORT_FILE_TITLE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExcelCallback getExcelCallback(Object object) {
|
||||
return (workBook, sheet) -> {
|
||||
HSSFRow row1 = sheet.createRow(0);
|
||||
int columnSize = ExcelExportUtil.getColumnSize(ConferenceResultDetailExcelResult.class);
|
||||
for (int i = 0; i < columnSize; ++i) {
|
||||
row1.createCell(i);
|
||||
row1.setHeight((short)700);
|
||||
}
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, columnSize - 1));
|
||||
ExcelExportUtil.setRow1(workBook, sheet, DEFAULT_EXPORT_FILE_TITLE_NAME);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer getStartRow() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.common.ninca.conference.annotation.ExcelAttribute
|
||||
* cn.cloudwalk.common.ninca.conference.util.DateUtils
|
||||
* org.apache.poi.hssf.usermodel.HSSFCellStyle
|
||||
* org.apache.poi.hssf.usermodel.HSSFFont
|
||||
* org.apache.poi.hssf.usermodel.HSSFRichTextString
|
||||
* org.apache.poi.hssf.usermodel.HSSFSheet
|
||||
* org.apache.poi.hssf.usermodel.HSSFWorkbook
|
||||
* org.apache.poi.ss.usermodel.Font
|
||||
* org.apache.poi.ss.usermodel.HorizontalAlignment
|
||||
* org.apache.poi.ss.usermodel.RichTextString
|
||||
* org.apache.poi.ss.usermodel.VerticalAlignment
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.export;
|
||||
|
||||
import cn.cloudwalk.common.ninca.conference.annotation.ExcelAttribute;
|
||||
import cn.cloudwalk.common.ninca.conference.util.DateUtils;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFFont;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.RichTextString;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
|
||||
class ExcelExportUtil {
|
||||
ExcelExportUtil() {
|
||||
}
|
||||
|
||||
static void setRow1(HSSFWorkbook workBook, HSSFSheet sheet, String row1Str) {
|
||||
HSSFCellStyle cellStyle1 = workBook.createCellStyle();
|
||||
HSSFFont font1 = workBook.createFont();
|
||||
font1.setFontHeightInPoints((short)15);
|
||||
font1.setBold(Boolean.TRUE.booleanValue());
|
||||
cellStyle1.setAlignment(HorizontalAlignment.LEFT);
|
||||
cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFRichTextString row1String = new HSSFRichTextString(row1Str);
|
||||
row1String.applyFont(0, row1Str.length(), (Font)font1);
|
||||
sheet.getRow(0).getCell(0).setCellValue((RichTextString)row1String);
|
||||
sheet.getRow(0).getCell(0).setCellStyle(cellStyle1);
|
||||
}
|
||||
|
||||
static void setRow2(HSSFWorkbook workBook, HSSFSheet sheet, Long startDay, Long endDay) {
|
||||
HSSFCellStyle cellStyle2 = workBook.createCellStyle();
|
||||
HSSFFont font2 = workBook.createFont();
|
||||
font2.setFontHeightInPoints((short)10);
|
||||
font2.setBold(Boolean.TRUE.booleanValue());
|
||||
cellStyle2.setAlignment(HorizontalAlignment.LEFT);
|
||||
cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
String startStr = DateUtils.formatDate((Date)new Date(startDay), (String)"yyyy-MM-dd");
|
||||
String endStr = DateUtils.formatDate((Date)new Date(endDay), (String)"yyyy-MM-dd");
|
||||
String exportStr = DateUtils.formatDate((Date)new Date(), (String)"yyyy-MM-dd HH:mm:ss");
|
||||
String row2Str = "\u7edf\u8ba1\u65f6\u95f4\uff1a" + startStr + "~" + endStr + " \u5bfc\u51fa\u65f6\u95f4\uff1a" + exportStr;
|
||||
HSSFRichTextString row2String = new HSSFRichTextString(row2Str);
|
||||
row2String.applyFont(0, row2Str.length(), (Font)font2);
|
||||
sheet.getRow(1).getCell(0).setCellValue((RichTextString)row2String);
|
||||
sheet.getRow(1).getCell(0).setCellStyle(cellStyle2);
|
||||
}
|
||||
|
||||
static int getColumnSize(Class clazz) {
|
||||
Field[] allFields = clazz.getDeclaredFields();
|
||||
int size = 0;
|
||||
for (Field field : allFields) {
|
||||
ExcelAttribute attr = field.getAnnotation(ExcelAttribute.class);
|
||||
if (attr == null || !attr.isExport()) continue;
|
||||
++size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.cwos.client.event.event.CustomEvent
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.record.push;
|
||||
|
||||
import cn.cloudwalk.cwos.client.event.event.CustomEvent;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ConferenceRecordPushEvent
|
||||
extends CustomEvent {
|
||||
private String id;
|
||||
private String personId;
|
||||
private String personName;
|
||||
private String deviceCode;
|
||||
private String districtMergeName;
|
||||
private String deviceAreaName;
|
||||
private String deviceTypeId;
|
||||
private String deviceTypeName;
|
||||
private String registerImagePath;
|
||||
private String faceImagePath;
|
||||
private String panoramaImagePath;
|
||||
private BigDecimal score;
|
||||
private Integer recognitionResult;
|
||||
private Long recognitionTime;
|
||||
private BigDecimal threshold;
|
||||
|
||||
public String getTopic() {
|
||||
return "CONFERENCE_RECORD_TOPIC";
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPersonId() {
|
||||
return this.personId;
|
||||
}
|
||||
|
||||
public void setPersonId(String personId) {
|
||||
this.personId = personId;
|
||||
}
|
||||
|
||||
public String getPersonName() {
|
||||
return this.personName;
|
||||
}
|
||||
|
||||
public void setPersonName(String personName) {
|
||||
this.personName = personName;
|
||||
}
|
||||
|
||||
public String getDeviceCode() {
|
||||
return this.deviceCode;
|
||||
}
|
||||
|
||||
public void setDeviceCode(String deviceCode) {
|
||||
this.deviceCode = deviceCode;
|
||||
}
|
||||
|
||||
public String getDistrictMergeName() {
|
||||
return this.districtMergeName;
|
||||
}
|
||||
|
||||
public void setDistrictMergeName(String districtMergeName) {
|
||||
this.districtMergeName = districtMergeName;
|
||||
}
|
||||
|
||||
public String getDeviceAreaName() {
|
||||
return this.deviceAreaName;
|
||||
}
|
||||
|
||||
public void setDeviceAreaName(String deviceAreaName) {
|
||||
this.deviceAreaName = deviceAreaName;
|
||||
}
|
||||
|
||||
public String getDeviceTypeId() {
|
||||
return this.deviceTypeId;
|
||||
}
|
||||
|
||||
public void setDeviceTypeId(String deviceTypeId) {
|
||||
this.deviceTypeId = deviceTypeId;
|
||||
}
|
||||
|
||||
public String getDeviceTypeName() {
|
||||
return this.deviceTypeName;
|
||||
}
|
||||
|
||||
public void setDeviceTypeName(String deviceTypeName) {
|
||||
this.deviceTypeName = deviceTypeName;
|
||||
}
|
||||
|
||||
public String getRegisterImagePath() {
|
||||
return this.registerImagePath;
|
||||
}
|
||||
|
||||
public void setRegisterImagePath(String registerImagePath) {
|
||||
this.registerImagePath = registerImagePath;
|
||||
}
|
||||
|
||||
public String getFaceImagePath() {
|
||||
return this.faceImagePath;
|
||||
}
|
||||
|
||||
public void setFaceImagePath(String faceImagePath) {
|
||||
this.faceImagePath = faceImagePath;
|
||||
}
|
||||
|
||||
public String getPanoramaImagePath() {
|
||||
return this.panoramaImagePath;
|
||||
}
|
||||
|
||||
public void setPanoramaImagePath(String panoramaImagePath) {
|
||||
this.panoramaImagePath = panoramaImagePath;
|
||||
}
|
||||
|
||||
public BigDecimal getScore() {
|
||||
return this.score;
|
||||
}
|
||||
|
||||
public void setScore(BigDecimal score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public Integer getRecognitionResult() {
|
||||
return this.recognitionResult;
|
||||
}
|
||||
|
||||
public void setRecognitionResult(Integer recognitionResult) {
|
||||
this.recognitionResult = recognitionResult;
|
||||
}
|
||||
|
||||
public Long getRecognitionTime() {
|
||||
return this.recognitionTime;
|
||||
}
|
||||
|
||||
public void setRecognitionTime(Long recognitionTime) {
|
||||
this.recognitionTime = recognitionTime;
|
||||
}
|
||||
|
||||
public BigDecimal getThreshold() {
|
||||
return this.threshold;
|
||||
}
|
||||
|
||||
public void setThreshold(BigDecimal threshold) {
|
||||
this.threshold = threshold;
|
||||
}
|
||||
}
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.cloud.serial.UUIDSerial
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceRecordAddDTO
|
||||
* cn.cloudwalk.common.ninca.conference.util.StringUtils
|
||||
* cn.cloudwalk.cwos.client.event.event.BaseEvent
|
||||
* cn.cloudwalk.event.CloudwalkEventManager
|
||||
* javax.annotation.Resource
|
||||
* org.aspectj.lang.ProceedingJoinPoint
|
||||
* org.aspectj.lang.annotation.Around
|
||||
* org.aspectj.lang.annotation.Aspect
|
||||
* org.aspectj.lang.annotation.Pointcut
|
||||
* org.slf4j.Logger
|
||||
* org.slf4j.LoggerFactory
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.core.annotation.Order
|
||||
* org.springframework.stereotype.Component
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.record.push.aspect;
|
||||
|
||||
import cn.cloudwalk.cloud.serial.UUIDSerial;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceRecordAddDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.util.StringUtils;
|
||||
import cn.cloudwalk.cwos.client.event.event.BaseEvent;
|
||||
import cn.cloudwalk.event.CloudwalkEventManager;
|
||||
import cn.cloudwalk.service.ninca.conference.common.ConferenceProperties;
|
||||
import cn.cloudwalk.service.ninca.conference.record.push.ConferenceRecordPushEvent;
|
||||
import javax.annotation.Resource;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Aspect
|
||||
@Order(value=-999)
|
||||
@Component
|
||||
public class ConferenceRecordAddAspect {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConferenceRecordAddAspect.class);
|
||||
@Autowired
|
||||
private ConferenceProperties conferenceProperties;
|
||||
@Resource
|
||||
private CloudwalkEventManager cloudwalkEventManager;
|
||||
@Autowired
|
||||
private UUIDSerial uuidSerial;
|
||||
|
||||
@Pointcut(value="execution(* cn.cloudwalk.biz.ninca.conference.result.ConferenceRecordManager.add(..))")
|
||||
public void recogRecordAddPointcut() {
|
||||
}
|
||||
|
||||
@Around(value="recogRecordAddPointcut()")
|
||||
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object[] args = joinPoint.getArgs();
|
||||
ConferenceRecordAddDTO param = (ConferenceRecordAddDTO)args[0];
|
||||
Integer addResult = (Integer)joinPoint.proceed();
|
||||
try {
|
||||
if (addResult > 0 && this.conferenceProperties.isRecordPush()) {
|
||||
if (StringUtils.isNotBlank((String)this.conferenceProperties.getRecordPushServiceCode())) {
|
||||
ConferenceRecordPushEvent pushEvent = this.buildRecordPushEvent(param);
|
||||
this.cloudwalkEventManager.publish((BaseEvent)pushEvent);
|
||||
} else {
|
||||
logger.error("\u63a8\u9001\u4f1a\u8bae\u8bb0\u5f55\uff0c\u914d\u7f6eserviceCode\u4e3a\u7a7a\uff0c\u4e0d\u6267\u884c\u63a8\u9001");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("\u63a8\u9001\u4f1a\u8bae\u8bb0\u5f55\u5f02\u5e38,\u539f\u56e0\uff1a", (Throwable)e);
|
||||
}
|
||||
return addResult;
|
||||
}
|
||||
|
||||
private ConferenceRecordPushEvent buildRecordPushEvent(ConferenceRecordAddDTO param) {
|
||||
ConferenceRecordPushEvent event = (ConferenceRecordPushEvent)((Object)BeanCopyUtils.copyProperties((Object)param, ConferenceRecordPushEvent.class));
|
||||
event.setMessageId(this.uuidSerial.uuid());
|
||||
event.setRegisterImagePath(this.genFullPath(param.getRegisterImagePath()));
|
||||
event.setPanoramaImagePath(this.genFullPath(param.getPanoramaImagePath()));
|
||||
event.setFaceImagePath(this.genFullPath(param.getFaceImagePath()));
|
||||
event.setServiceCode(this.conferenceProperties.getRecordPushServiceCode());
|
||||
return event;
|
||||
}
|
||||
|
||||
private String genFullPath(String path) {
|
||||
return StringUtils.isNotBlank((String)path) ? this.conferenceProperties.getCwosPicUrl() + path : null;
|
||||
}
|
||||
}
|
||||
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.biz.ninca.conference.person.ConferencePersonManager
|
||||
* cn.cloudwalk.biz.ninca.conference.result.ConferenceRecordManager
|
||||
* cn.cloudwalk.biz.ninca.conference.result.ConferenceResultGenManager
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.result.PersonResult
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService
|
||||
* cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultSignParam
|
||||
* cn.cloudwalk.client.ninca.conference.result.service.ConferenceResultGenService
|
||||
* cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.exception.DataAccessException
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonEditDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceRecordAddDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultConferenceDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultConferenceQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultGenDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultPersonInfoDTO
|
||||
* cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum
|
||||
* cn.cloudwalk.common.ninca.conference.util.CollectionUtils
|
||||
* cn.cloudwalk.common.ninca.conference.util.FeignThreadLocalUtil
|
||||
* javax.annotation.Resource
|
||||
* org.springframework.stereotype.Service
|
||||
* org.springframework.transaction.annotation.Transactional
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.result;
|
||||
|
||||
import cn.cloudwalk.biz.ninca.conference.person.ConferencePersonManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.result.ConferenceRecordManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.result.ConferenceResultGenManager;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.result.PersonResult;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService;
|
||||
import cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultSignParam;
|
||||
import cn.cloudwalk.client.ninca.conference.result.service.ConferenceResultGenService;
|
||||
import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.exception.DataAccessException;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonEditDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceRecordAddDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultConferenceDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultConferenceQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultGenDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.gen.dto.ConferenceResultPersonInfoDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.util.CollectionUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.util.FeignThreadLocalUtil;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class ConferenceResultGenServiceImpl
|
||||
extends AbstractService
|
||||
implements ConferenceResultGenService {
|
||||
@Resource
|
||||
private PersonService personService;
|
||||
@Resource
|
||||
private ConferencePersonManager conferencePersonManager;
|
||||
@Resource
|
||||
private ConferenceRecordManager conferenceRecordManager;
|
||||
@Resource
|
||||
private ConferenceResultGenManager conferenceResultGenManager;
|
||||
|
||||
@Transactional(rollbackFor={Exception.class})
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<Boolean> gen(ConferenceResultSignParam signParam, CloudwalkCallContext context) throws ServiceException {
|
||||
try {
|
||||
HashMap<String, String> defaultRequestHeader = new HashMap<String, String>(1);
|
||||
defaultRequestHeader.put("businessid", signParam.getBusinessId());
|
||||
FeignThreadLocalUtil.setRequestHeader(defaultRequestHeader);
|
||||
ConferenceResultPersonInfoDTO personInfoDTO = this.getPersonInfo(signParam.getFaceId(), context);
|
||||
if (personInfoDTO == null) {
|
||||
this.logger.info("\u4eba\u5458\u4fe1\u606f\u4e0d\u5b58\u5728");
|
||||
return CloudwalkResult.fail((String)"76280206", (String)this.getMessage("76280206"));
|
||||
}
|
||||
List<ConferenceResultConferenceDTO> conferenceList = this.matchConference(signParam, personInfoDTO, context);
|
||||
if (CollectionUtils.isNotEmpty(conferenceList)) {
|
||||
for (ConferenceResultConferenceDTO conferenceDTO : conferenceList) {
|
||||
String recordId;
|
||||
ConferenceResultGenDTO genDTO = this.genResult(signParam, conferenceDTO, personInfoDTO, recordId = this.saveRecord(signParam, personInfoDTO, context), context);
|
||||
ConferencePersonEditDTO editDTO = (ConferencePersonEditDTO)BeanCopyUtils.copyProperties((Object)genDTO, ConferencePersonEditDTO.class);
|
||||
if (editDTO.getSignin() == null && editDTO.getSignoff() == null) continue;
|
||||
this.conferencePersonManager.edit(editDTO);
|
||||
}
|
||||
} else {
|
||||
this.logger.info("\u6ca1\u6709\u5339\u914d\u7684\u4f1a\u8bae\u4fe1\u606f");
|
||||
return CloudwalkResult.fail((String)"76280207", (String)this.getMessage("76280207"));
|
||||
}
|
||||
return CloudwalkResult.success((Object)true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.logger.error("\u4f1a\u8bae\u7ed3\u679c\u751f\u6210\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ConferenceResultConferenceDTO> matchConference(ConferenceResultSignParam signParam, ConferenceResultPersonInfoDTO personInfoDTO, CloudwalkCallContext context) throws DataAccessException {
|
||||
ConferenceResultConferenceQueryDTO queryDTO = new ConferenceResultConferenceQueryDTO();
|
||||
queryDTO.setPersonId(personInfoDTO.getId());
|
||||
queryDTO.setSignTime(signParam.getRecognitionTime());
|
||||
queryDTO.setDeviceId(signParam.getDeviceId());
|
||||
return this.conferenceResultGenManager.queryConference(queryDTO);
|
||||
}
|
||||
|
||||
private String saveRecord(ConferenceResultSignParam signParam, ConferenceResultPersonInfoDTO personInfoDTO, CloudwalkCallContext context) throws DataAccessException {
|
||||
ConferenceRecordAddDTO addDTO = new ConferenceRecordAddDTO();
|
||||
BeanCopyUtils.copyProperties((Object)signParam, (Object)addDTO);
|
||||
addDTO.setId(this.genUUID());
|
||||
addDTO.setCreateTime(Long.valueOf(System.currentTimeMillis()));
|
||||
addDTO.setCreateUserId(context.getUser().getCaller());
|
||||
addDTO.setDistrictMergeName(signParam.getDistrictMergeName());
|
||||
addDTO.setDeviceAreaName(signParam.getDeviceAreaName());
|
||||
addDTO.setPersonId(personInfoDTO.getId());
|
||||
addDTO.setPersonName(personInfoDTO.getName());
|
||||
addDTO.setDeviceTypeId(signParam.getDeviceType());
|
||||
this.conferenceRecordManager.add(addDTO);
|
||||
return addDTO.getId();
|
||||
}
|
||||
|
||||
private ConferenceResultGenDTO genResult(ConferenceResultSignParam signParam, ConferenceResultConferenceDTO conferenceDTO, ConferenceResultPersonInfoDTO personInfoDTO, String recordId, CloudwalkCallContext context) throws DataAccessException {
|
||||
ConferencePersonQueryDTO queryDTO = new ConferencePersonQueryDTO();
|
||||
queryDTO.setConferenceId(conferenceDTO.getId());
|
||||
queryDTO.setPersonId(personInfoDTO.getId());
|
||||
List queryList = this.conferencePersonManager.query(queryDTO);
|
||||
ConferencePersonResultDTO resultDTO = (ConferencePersonResultDTO)queryList.get(0);
|
||||
ConferenceResultGenDTO genDTO = new ConferenceResultGenDTO();
|
||||
if (resultDTO.getSignin() == null) {
|
||||
genDTO.setSignin(signParam.getRecognitionTime());
|
||||
genDTO.setSignResult(this.getSigninResult(signParam.getRecognitionTime(), conferenceDTO));
|
||||
genDTO.setSigninRecordId(recordId);
|
||||
} else if (signParam.getRecognitionTime() < resultDTO.getSignin()) {
|
||||
genDTO.setSignin(signParam.getRecognitionTime());
|
||||
genDTO.setSignResult(this.getSigninResult(signParam.getRecognitionTime(), conferenceDTO));
|
||||
genDTO.setSigninRecordId(recordId);
|
||||
if (YesNoTypeEnum.Y.getCode().equals(conferenceDTO.getIsSignoff()) && (resultDTO.getSignoff() == null || resultDTO.getSignoff() < signParam.getRecognitionTime())) {
|
||||
genDTO.setSignoff(resultDTO.getSignin());
|
||||
genDTO.setSignResult(this.getSignoffResult(resultDTO.getSignin(), conferenceDTO));
|
||||
genDTO.setSignoffRecordId(resultDTO.getSigninRecordId());
|
||||
}
|
||||
} else if ((resultDTO.getSignoff() == null || signParam.getRecognitionTime() > resultDTO.getSignoff()) && YesNoTypeEnum.Y.getCode().equals(conferenceDTO.getIsSignoff())) {
|
||||
genDTO.setSignoff(signParam.getRecognitionTime());
|
||||
genDTO.setSignResult(this.getSignoffResult(signParam.getRecognitionTime(), conferenceDTO));
|
||||
genDTO.setSignoffRecordId(recordId);
|
||||
}
|
||||
genDTO.setConferenceId(resultDTO.getConferenceId());
|
||||
genDTO.setPersonId(resultDTO.getPersonId());
|
||||
return genDTO;
|
||||
}
|
||||
|
||||
private Integer getSignoffResult(Long recognitionTime, ConferenceResultConferenceDTO conferenceDTO) {
|
||||
return this.getSignoffResult(recognitionTime, conferenceDTO.getEndTime());
|
||||
}
|
||||
|
||||
private Integer getSigninResult(Long recognitionTime, ConferenceResultConferenceDTO conferenceDTO) {
|
||||
return this.getSigninResult(recognitionTime, conferenceDTO.getBeginTime());
|
||||
}
|
||||
|
||||
private ConferenceResultPersonInfoDTO getPersonInfo(String imageId, CloudwalkCallContext context) throws ServiceException {
|
||||
PersonQueryParam personQueryParam = new PersonQueryParam();
|
||||
personQueryParam.setImageIds(Collections.singletonList(imageId));
|
||||
CloudwalkResult personListResult = this.personService.list(personQueryParam, context);
|
||||
if (!personListResult.isSuccess() || CollectionUtils.isEmpty((Collection)((Collection)personListResult.getData()))) {
|
||||
this.logger.error("\u751f\u6210\u4f1a\u8bae\u7ed3\u679c\u5931\u8d25,\u6839\u636eimageId\u67e5\u8be2cwos\u6ca1\u6709\u627e\u5230\u4eba\u5458\u4fe1\u606f\uff0cimageId\uff1a{}", (Object)imageId);
|
||||
throw new ServiceException("\u6839\u636eimageId\u67e5\u8be2cwos\u6ca1\u6709\u627e\u5230\u4eba\u5458\u4fe1\u606f");
|
||||
}
|
||||
PersonResult personResult = (PersonResult)((List)personListResult.getData()).get(0);
|
||||
return (ConferenceResultPersonInfoDTO)BeanCopyUtils.copyProperties((Object)personResult, ConferenceResultPersonInfoDTO.class);
|
||||
}
|
||||
}
|
||||
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.biz.ninca.conference.conference.ConferenceManager
|
||||
* cn.cloudwalk.biz.ninca.conference.person.ConferencePersonManager
|
||||
* cn.cloudwalk.biz.ninca.conference.result.ConferenceResultQueryManager
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonQueryParam
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.result.PersonResult
|
||||
* cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService
|
||||
* cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultDetailQueryParam
|
||||
* cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultPageQueryParam
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailQueryGroupResult
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailQueryResult
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailQueryResult$Person
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultPageQueryResult
|
||||
* cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultPersonListQueryResult
|
||||
* cn.cloudwalk.client.ninca.conference.result.service.ConferenceResultQueryService
|
||||
* cn.cloudwalk.cloud.context.CloudwalkCallContext
|
||||
* cn.cloudwalk.cloud.entity.CloudwalkBaseIdentify
|
||||
* cn.cloudwalk.cloud.exception.DataAccessException
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageAble
|
||||
* cn.cloudwalk.cloud.page.CloudwalkPageInfo
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceGetsDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceResultPageQueryDTO
|
||||
* cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceResultPageQueryResultDTO
|
||||
* cn.cloudwalk.common.ninca.conference.em.ConferenceStatusEnum
|
||||
* cn.cloudwalk.common.ninca.conference.em.SignResultEnum
|
||||
* cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum
|
||||
* cn.cloudwalk.common.ninca.conference.util.CollectionUtils
|
||||
* com.google.common.collect.Lists
|
||||
* com.google.common.collect.Maps
|
||||
* com.google.common.collect.Sets
|
||||
* javax.annotation.Resource
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.stereotype.Service
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.result;
|
||||
|
||||
import cn.cloudwalk.biz.ninca.conference.conference.ConferenceManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.person.ConferencePersonManager;
|
||||
import cn.cloudwalk.biz.ninca.conference.result.ConferenceResultQueryManager;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonQueryParam;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.result.PersonResult;
|
||||
import cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService;
|
||||
import cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultDetailQueryParam;
|
||||
import cn.cloudwalk.client.ninca.conference.result.param.ConferenceResultPageQueryParam;
|
||||
import cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailQueryGroupResult;
|
||||
import cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultDetailQueryResult;
|
||||
import cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultPageQueryResult;
|
||||
import cn.cloudwalk.client.ninca.conference.result.result.ConferenceResultPersonListQueryResult;
|
||||
import cn.cloudwalk.client.ninca.conference.result.service.ConferenceResultQueryService;
|
||||
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
|
||||
import cn.cloudwalk.cloud.entity.CloudwalkBaseIdentify;
|
||||
import cn.cloudwalk.cloud.exception.DataAccessException;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
|
||||
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceGetsDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.conference.dto.ConferenceResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.person.dto.ConferencePersonResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceResultPageQueryDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.bean.result.dto.ConferenceResultPageQueryResultDTO;
|
||||
import cn.cloudwalk.common.ninca.conference.em.ConferenceStatusEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.em.SignResultEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.em.YesNoTypeEnum;
|
||||
import cn.cloudwalk.common.ninca.conference.util.CollectionUtils;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import cn.cloudwalk.service.ninca.conference.common.ConferenceProperties;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ConferenceResultQueryServiceImpl
|
||||
extends AbstractService
|
||||
implements ConferenceResultQueryService {
|
||||
@Resource
|
||||
private ConferenceResultQueryManager conferenceResultQueryManager;
|
||||
@Resource
|
||||
private ConferencePersonManager conferencePersonManager;
|
||||
@Resource
|
||||
private PersonService personService;
|
||||
@Resource
|
||||
private ConferenceProperties conferenceProperties;
|
||||
@Autowired
|
||||
private ConferenceManager conferenceManager;
|
||||
|
||||
public CloudwalkResult<CloudwalkPageAble<ConferenceResultPageQueryResult>> page(ConferenceResultPageQueryParam param, CloudwalkPageInfo pageInfo, CloudwalkCallContext cloudwalkContext) throws ServiceException {
|
||||
try {
|
||||
ConferenceResultPageQueryDTO dto = (ConferenceResultPageQueryDTO)BeanCopyUtils.copyProperties((Object)param, ConferenceResultPageQueryDTO.class);
|
||||
dto.setBusinessId(cloudwalkContext.getCompany().getCompanyId());
|
||||
dto.setNowTime(Long.valueOf(System.currentTimeMillis()));
|
||||
CloudwalkPageAble pageResult = this.conferenceResultQueryManager.page(dto, pageInfo);
|
||||
if (CollectionUtils.isEmpty((Collection)pageResult.getDatas())) {
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(new ArrayList(), pageInfo, 0L));
|
||||
}
|
||||
List<ConferenceResultPageQueryResult> resultList = this.convertPageResult(pageResult.getDatas());
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(resultList, pageInfo, pageResult.getTotalRows()));
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u7b7e\u5230\u7ed3\u679c\u5206\u9875\u67e5\u8be2\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ConferenceResultPageQueryResult> convertPageResult(Collection<ConferenceResultPageQueryResultDTO> datas) {
|
||||
ArrayList<ConferenceResultPageQueryResult> resultList = new ArrayList<ConferenceResultPageQueryResult>(datas.size());
|
||||
long now = System.currentTimeMillis();
|
||||
for (ConferenceResultPageQueryResultDTO data : datas) {
|
||||
ConferenceResultPageQueryResult result = (ConferenceResultPageQueryResult)BeanCopyUtils.copyProperties((Object)data, ConferenceResultPageQueryResult.class);
|
||||
result.setParticipantsCount(Integer.valueOf(data.getNormalCount() + data.getNoSigCount() + data.getLatenessCount() + data.getTardyCount()));
|
||||
result.setAttendanceCount(Integer.valueOf(result.getParticipantsCount() - data.getNoSigCount()));
|
||||
BigDecimal rate = null;
|
||||
rate = result.getAttendanceCount() == null || result.getAttendanceCount() == 0 ? BigDecimal.valueOf(0L) : new BigDecimal(result.getAttendanceCount()).divide(new BigDecimal(result.getParticipantsCount()), 4, 0).multiply(BigDecimal.valueOf(100L));
|
||||
result.setAttendanceRate(rate);
|
||||
long nowTime = System.currentTimeMillis();
|
||||
if (YesNoTypeEnum.Y.getCode().equals(data.getCancelStatus())) {
|
||||
result.setStatus(ConferenceStatusEnum.CANCELLED.getCode());
|
||||
} else if (data.getBeginTime() > nowTime) {
|
||||
result.setStatus(ConferenceStatusEnum.NOT_STARTED.getCode());
|
||||
} else if (data.getBeginTime() <= nowTime && data.getEndTime() >= nowTime) {
|
||||
result.setStatus(ConferenceStatusEnum.IN_PROGRESS.getCode());
|
||||
} else {
|
||||
result.setStatus(ConferenceStatusEnum.OVER.getCode());
|
||||
}
|
||||
if (YesNoTypeEnum.N.getCode().equals(data.getIsSignoff())) {
|
||||
data.setSignoffDeadline(data.getEndTime());
|
||||
}
|
||||
if (data.getCancelStatus().equals(YesNoTypeEnum.N.getCode())) {
|
||||
if (data.getSignBeginTime() > now) {
|
||||
result.setStatus(ConferenceStatusEnum.NOT_STARTED.getCode());
|
||||
} else if (data.getSignBeginTime() <= now && data.getSignoffDeadline() >= now) {
|
||||
result.setStatus(ConferenceStatusEnum.IN_PROGRESS.getCode());
|
||||
} else {
|
||||
result.setStatus(ConferenceStatusEnum.OVER.getCode());
|
||||
}
|
||||
} else {
|
||||
result.setStatus(ConferenceStatusEnum.CANCELLED.getCode());
|
||||
}
|
||||
resultList.add(result);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public CloudwalkResult<ConferenceResultDetailQueryGroupResult> detail(ConferenceResultDetailQueryParam param, CloudwalkCallContext cloudwalkContext) throws ServiceException {
|
||||
try {
|
||||
ConferencePersonQueryDTO personQueryDTO = new ConferencePersonQueryDTO();
|
||||
personQueryDTO.setConferenceId(param.getId());
|
||||
List personList = this.conferencePersonManager.query(personQueryDTO);
|
||||
if (CollectionUtils.isEmpty((Collection)personList)) {
|
||||
return CloudwalkResult.success((Object)new ConferenceResultDetailQueryGroupResult());
|
||||
}
|
||||
ConferenceGetsDTO conferenceGetsDTO = new ConferenceGetsDTO();
|
||||
conferenceGetsDTO.setIds((List)Lists.newArrayList((Object[])new String[]{param.getId()}));
|
||||
conferenceGetsDTO.setBusinessId(cloudwalkContext.getCompany().getCompanyId());
|
||||
List conferenceResultDTOList = this.conferenceManager.gets(conferenceGetsDTO);
|
||||
ConferenceResultDTO conferenceInfo = null;
|
||||
if (CollectionUtils.isEmpty((Collection)conferenceResultDTOList)) {
|
||||
this.logger.error("\u4f1a\u8bae\u4fe1\u606f\u4e0d\u5b58\u5728\uff0c\u4f1a\u8baeid={}", (Object)param.getId());
|
||||
} else {
|
||||
conferenceInfo = (ConferenceResultDTO)conferenceResultDTOList.get(0);
|
||||
}
|
||||
List<String> personIds = personList.stream().map(ConferencePersonResultDTO::getPersonId).collect(Collectors.toList());
|
||||
Map<String, List<PersonResult>> personMap = this.queryPersonMap(personIds, cloudwalkContext);
|
||||
HashMap map = Maps.newHashMap();
|
||||
for (ConferencePersonResultDTO personResult : personList) {
|
||||
int signoff;
|
||||
if (personResult.getSignResult() == null) {
|
||||
this.getPersonListBySignResult(map, SignResultEnum.ABSENCE.getCode()).add(personResult);
|
||||
continue;
|
||||
}
|
||||
if (conferenceInfo == null) {
|
||||
this.getPersonListBySignResult(map, personResult.getSignResult()).add(personResult);
|
||||
continue;
|
||||
}
|
||||
int signin = this.getSigninResult(personResult.getSignin(), conferenceInfo.getBeginTime());
|
||||
int n = personResult.getSignoff() == null ? (System.currentTimeMillis() >= conferenceInfo.getEndTime() ? -1 : SignResultEnum.NORMAL.getCode()) : (signoff = this.getSignoffResult(personResult.getSignoff(), conferenceInfo.getEndTime()).intValue());
|
||||
if (signin == SignResultEnum.NORMAL.getCode() && signin == signoff) {
|
||||
this.getPersonListBySignResult(map, signin).add(personResult);
|
||||
continue;
|
||||
}
|
||||
if (signin == SignResultEnum.LATENESS.getCode()) {
|
||||
this.getPersonListBySignResult(map, SignResultEnum.LATENESS.getCode()).add(personResult);
|
||||
}
|
||||
if (signoff != SignResultEnum.TARDY.getCode() && signoff != -1) continue;
|
||||
this.getPersonListBySignResult(map, SignResultEnum.TARDY.getCode()).add(personResult);
|
||||
}
|
||||
ConferenceResultDetailQueryGroupResult returnResult = new ConferenceResultDetailQueryGroupResult();
|
||||
returnResult.setNormalPersons(new ConferenceResultDetailQueryResult());
|
||||
returnResult.setAbsencePersons(new ConferenceResultDetailQueryResult());
|
||||
returnResult.setLatenessPersons(new ConferenceResultDetailQueryResult());
|
||||
returnResult.setTardyPersons(new ConferenceResultDetailQueryResult());
|
||||
for (Integer key : map.keySet()) {
|
||||
List list = (List)map.get(key);
|
||||
HashSet tmpPersonSet = Sets.newHashSet();
|
||||
if (CollectionUtils.isNotEmpty((Collection)list)) {
|
||||
for (ConferencePersonResultDTO dto : list) {
|
||||
ConferenceResultDetailQueryResult.Person person = new ConferenceResultDetailQueryResult.Person();
|
||||
person.setPersonId(dto.getPersonId());
|
||||
if (personMap != null && personMap.get(dto.getPersonId()) != null) {
|
||||
PersonResult personResult = personMap.get(dto.getPersonId()).get(0);
|
||||
person.setPersonName(personResult.getName());
|
||||
String cwosPicUrl = this.conferenceProperties.getCwosPicUrl();
|
||||
person.setRegFaceUrl(cwosPicUrl + personResult.getComparePicture());
|
||||
}
|
||||
tmpPersonSet.add(person);
|
||||
}
|
||||
}
|
||||
ConferenceResultDetailQueryResult detailQueryResult = new ConferenceResultDetailQueryResult();
|
||||
detailQueryResult.setCount(Integer.valueOf(tmpPersonSet.size()));
|
||||
detailQueryResult.setPersons((List)Lists.newArrayList((Iterable)tmpPersonSet));
|
||||
if (SignResultEnum.NORMAL.getCode().equals(key)) {
|
||||
returnResult.setNormalPersons(detailQueryResult);
|
||||
continue;
|
||||
}
|
||||
if (SignResultEnum.ABSENCE.getCode().equals(key)) {
|
||||
returnResult.setAbsencePersons(detailQueryResult);
|
||||
continue;
|
||||
}
|
||||
if (SignResultEnum.LATENESS.getCode().equals(key)) {
|
||||
returnResult.setLatenessPersons(detailQueryResult);
|
||||
continue;
|
||||
}
|
||||
returnResult.setTardyPersons(detailQueryResult);
|
||||
}
|
||||
return CloudwalkResult.success((Object)returnResult);
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u7b7e\u5230\u7ed3\u679c\u8be6\u60c5\u67e5\u8be2\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ConferencePersonResultDTO> getPersonListBySignResult(Map<Integer, List<ConferencePersonResultDTO>> groupPersonBySignResult, int signResult) {
|
||||
ArrayList personResultDTOList = groupPersonBySignResult.get(signResult);
|
||||
if (personResultDTOList == null) {
|
||||
personResultDTOList = Lists.newArrayList();
|
||||
groupPersonBySignResult.put(signResult, personResultDTOList);
|
||||
}
|
||||
return personResultDTOList;
|
||||
}
|
||||
|
||||
public CloudwalkResult<CloudwalkPageAble<ConferenceResultPersonListQueryResult>> personList(ConferenceResultDetailQueryParam param, CloudwalkPageInfo pageInfo, CloudwalkCallContext cloudwalkContext) throws ServiceException {
|
||||
try {
|
||||
ConferencePersonQueryDTO personQueryDTO = new ConferencePersonQueryDTO();
|
||||
personQueryDTO.setConferenceId(param.getId());
|
||||
CloudwalkPageAble personListPage = this.conferencePersonManager.page(personQueryDTO, pageInfo);
|
||||
List personList = (List)personListPage.getDatas();
|
||||
if (CollectionUtils.isEmpty((Collection)personList)) {
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(new ArrayList(), pageInfo, 0L));
|
||||
}
|
||||
List<String> personIds = personList.stream().map(ConferencePersonResultDTO::getPersonId).collect(Collectors.toList());
|
||||
Map<String, List<PersonResult>> personMap = this.queryPersonMap(personIds, cloudwalkContext);
|
||||
ArrayList<ConferenceResultPersonListQueryResult> returnList = new ArrayList<ConferenceResultPersonListQueryResult>(personList.size());
|
||||
for (ConferencePersonResultDTO dto : personList) {
|
||||
ConferenceResultPersonListQueryResult result = (ConferenceResultPersonListQueryResult)BeanCopyUtils.copyProperties((Object)dto, ConferenceResultPersonListQueryResult.class);
|
||||
if (personMap != null && CollectionUtils.isNotEmpty((Collection)personMap.get(dto.getPersonId()))) {
|
||||
PersonResult personResult = personMap.get(dto.getPersonId()).get(0);
|
||||
if (CollectionUtils.isNotEmpty((Collection)personResult.getOrganizationNames())) {
|
||||
result.setOrgName((String)personResult.getOrganizationNames().get(0));
|
||||
}
|
||||
result.setPersonName(personResult.getName());
|
||||
}
|
||||
returnList.add(result);
|
||||
}
|
||||
return CloudwalkResult.success((Object)new CloudwalkPageAble(returnList, pageInfo, personListPage.getTotalRows()));
|
||||
}
|
||||
catch (DataAccessException e) {
|
||||
this.logger.error("\u4eba\u5458\u7b7e\u5230\u7ed3\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, List<PersonResult>> queryPersonMap(List<String> personIds, CloudwalkCallContext context) throws ServiceException {
|
||||
PersonQueryParam personQueryParam = new PersonQueryParam();
|
||||
personQueryParam.setIds(personIds);
|
||||
CloudwalkResult personListResult = this.personService.list(personQueryParam, context);
|
||||
if (personListResult.isSuccess() && CollectionUtils.isNotEmpty((Collection)((Collection)personListResult.getData()))) {
|
||||
return ((List)personListResult.getData()).stream().collect(Collectors.groupingBy(CloudwalkBaseIdentify::getId));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* cn.cloudwalk.client.davinci.portal.file.param.part.FilePartAppendParam
|
||||
* cn.cloudwalk.client.davinci.portal.file.param.part.FilePartFinishParam
|
||||
* cn.cloudwalk.client.davinci.portal.file.param.part.FilePartInitParam
|
||||
* cn.cloudwalk.client.davinci.portal.file.result.FilePartResult
|
||||
* cn.cloudwalk.client.ninca.conference.storage.service.ConferenceFileStorageService
|
||||
* cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate
|
||||
* cn.cloudwalk.cloud.exception.ServiceException
|
||||
* cn.cloudwalk.cloud.result.CloudwalkResult
|
||||
* cn.cloudwalk.cloud.utils.BeanCopyUtils
|
||||
* cn.cloudwalk.intelligent.davinci.common.exception.DavinciServiceException
|
||||
* cn.cloudwalk.intelligent.davinci.storage.bean.part.dto.PartFinishDTO
|
||||
* cn.cloudwalk.intelligent.davinci.storage.bean.part.dto.PartInitDTO
|
||||
* cn.cloudwalk.intelligent.davinci.storage.bean.part.dto.PartInitResultDTO
|
||||
* cn.cloudwalk.intelligent.davinci.storage.manager.FilePartManager
|
||||
* org.springframework.beans.factory.annotation.Autowired
|
||||
* org.springframework.stereotype.Component
|
||||
* org.springframework.util.FileCopyUtils
|
||||
* org.springframework.web.multipart.MultipartFile
|
||||
*/
|
||||
package cn.cloudwalk.service.ninca.conference.storage;
|
||||
|
||||
import cn.cloudwalk.client.davinci.portal.file.param.part.FilePartAppendParam;
|
||||
import cn.cloudwalk.client.davinci.portal.file.param.part.FilePartFinishParam;
|
||||
import cn.cloudwalk.client.davinci.portal.file.param.part.FilePartInitParam;
|
||||
import cn.cloudwalk.client.davinci.portal.file.result.FilePartResult;
|
||||
import cn.cloudwalk.client.ninca.conference.storage.service.ConferenceFileStorageService;
|
||||
import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate;
|
||||
import cn.cloudwalk.cloud.exception.ServiceException;
|
||||
import cn.cloudwalk.cloud.result.CloudwalkResult;
|
||||
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
|
||||
import cn.cloudwalk.intelligent.davinci.common.exception.DavinciServiceException;
|
||||
import cn.cloudwalk.intelligent.davinci.storage.bean.part.dto.PartFinishDTO;
|
||||
import cn.cloudwalk.intelligent.davinci.storage.bean.part.dto.PartInitDTO;
|
||||
import cn.cloudwalk.intelligent.davinci.storage.bean.part.dto.PartInitResultDTO;
|
||||
import cn.cloudwalk.intelligent.davinci.storage.manager.FilePartManager;
|
||||
import cn.cloudwalk.service.ninca.conference.common.AbstractService;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Component
|
||||
public class ConferenceFileStorageServiceImpl
|
||||
extends AbstractService
|
||||
implements ConferenceFileStorageService {
|
||||
@Autowired
|
||||
private FilePartManager filePartManager;
|
||||
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<FilePartResult> filePartInit(FilePartInitParam param) throws ServiceException {
|
||||
PartInitDTO dto = (PartInitDTO)BeanCopyUtils.copyProperties((Object)param, PartInitDTO.class);
|
||||
try {
|
||||
PartInitResultDTO partInitResultDTO = this.filePartManager.init(dto);
|
||||
return CloudwalkResult.success((Object)BeanCopyUtils.copyProperties((Object)partInitResultDTO, FilePartResult.class));
|
||||
}
|
||||
catch (DavinciServiceException e) {
|
||||
this.logger.error("\u5206\u7247\u4e0a\u4f20\u6587\u4ef6\u521d\u59cb\u5316\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<FilePartResult> filePartAppend(FilePartAppendParam param) throws ServiceException {
|
||||
try {
|
||||
String filePrefix = "partFile";
|
||||
PartInitResultDTO partInitResultDTO = this.filePartManager.append(param.getFilePath(), param.getPartNumber(), param.getUploadId(), this.buildMultipartFile("partFile" + param.getPartNumber(), (byte[])param.getContent()));
|
||||
return CloudwalkResult.success((Object)BeanCopyUtils.copyProperties((Object)partInitResultDTO, FilePartResult.class));
|
||||
}
|
||||
catch (DavinciServiceException e) {
|
||||
this.logger.error("\u5206\u7247\u4e0a\u4f20\u6587\u4ef6\u8ffd\u52a0\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
@CloudwalkParamsValidate
|
||||
public CloudwalkResult<String> filePartFinish(FilePartFinishParam param) throws ServiceException {
|
||||
PartFinishDTO dto = (PartFinishDTO)BeanCopyUtils.copyProperties((Object)param, PartFinishDTO.class);
|
||||
try {
|
||||
return CloudwalkResult.success((Object)this.filePartManager.finish(dto));
|
||||
}
|
||||
catch (DavinciServiceException e) {
|
||||
this.logger.error("\u5206\u7247\u4e0a\u4f20\u6587\u4ef6\u7ed3\u675f\u5931\u8d25\uff0c\u539f\u56e0\uff1a", (Throwable)e);
|
||||
throw new ServiceException((Throwable)e);
|
||||
}
|
||||
}
|
||||
|
||||
private MultipartFile buildMultipartFile(final String fileName, final byte[] bytes) {
|
||||
MultipartFile file = new MultipartFile(){
|
||||
|
||||
public String getName() {
|
||||
return "file";
|
||||
}
|
||||
|
||||
public String getOriginalFilename() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return bytes.length == 0;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return bytes.length;
|
||||
}
|
||||
|
||||
public byte[] getBytes() throws IOException {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(bytes);
|
||||
}
|
||||
|
||||
public void transferTo(File dest) throws IOException, IllegalStateException {
|
||||
FileCopyUtils.copy((byte[])bytes, (File)dest);
|
||||
}
|
||||
};
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Summary for /tmp/crk_lib_extract_6o_f40r3/ninca-crk-conference-attendance-service-2.9.1_210630-SNAPSHOT.jar
|
||||
Decompiled with CFR 0.152
|
||||
Reference in New Issue
Block a user