Initial commit: five Maven reactors and docs only

Track maven-cloudwalk-cloud, maven-cw-elevator-application,
maven-intelligent-cwoscomponent, maven-ninca-crk, maven-ninca-qk-alarm,
and docs/. Other workspace paths ignored via .gitignore.

Made-with: Cursor
This commit is contained in:
反编译工作区
2026-04-24 10:35:31 +08:00
commit e2ac14719b
653 changed files with 50372 additions and 0 deletions
@@ -0,0 +1,68 @@
package cn.cloudwalk.elevator;
import cn.cloudwalk.cloud.context.CloudwalkSessionContextHolder;
import cn.cloudwalk.cloud.context.CloudwalkSessionObject;
import cn.cloudwalk.elevator.config.FeignThreadLocalUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@Configuration
public class AcsFeignConfiguration implements RequestInterceptor {
protected final Logger logger = LoggerFactory.getLogger(AcsFeignConfiguration.class);
@Autowired
private CloudwalkSessionContextHolder cloudwalkSessionContextHolder;
public void apply(RequestTemplate requestTemplate) {
Map<String, String> map = FeignThreadLocalUtil.get();
if (map != null && !map.isEmpty()) {
requestTemplate.header("platformuserid", new String[] {map.get("platformuserid")});
requestTemplate.header("loginid", new String[] {map.get("loginid")});
requestTemplate.header("businessid", new String[] {map.get("businessid")});
requestTemplate.header("username", new String[] {map.get("username")});
requestTemplate.header("applicationid", new String[] {map.get("applicationid")});
requestTemplate.header("authorization", new String[] {map.get("authorization")});
this.logger.info("feign调用配置header参数, businessId={}, threadId={}",
requestTemplate.headers().get("businessid"), Long.valueOf(Thread.currentThread().getId()));
} else {
Map<String, Collection<String>> headerMap = requestTemplate.headers();
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if (null != attributes) {
HttpServletRequest request = attributes.getRequest();
if (!headerMap.containsKey("platformuserid")) {
requestTemplate.header("platformuserid", new String[] {request.getHeader("platformuserid")});
}
if (!headerMap.containsKey("loginid")) {
requestTemplate.header("loginid", new String[] {request.getHeader("loginid")});
}
if (!headerMap.containsKey("businessid")) {
requestTemplate.header("businessid", new String[] {request.getHeader("businessid")});
}
if (!headerMap.containsKey("username")) {
requestTemplate.header("username", new String[] {request.getHeader("username")});
}
if (!headerMap.containsKey("applicationid")) {
requestTemplate.header("applicationid", new String[] {request.getHeader("applicationid")});
}
if (!headerMap.containsKey("authorization")) {
requestTemplate.header("authorization", new String[] {request.getHeader("authorization")});
}
CloudwalkSessionObject session = this.cloudwalkSessionContextHolder.getSession();
if (StringUtils.isBlank(request.getHeader("businessid")) && session != null) {
requestTemplate.header("businessid", new String[] {session.getCompany().getCompanyId()});
}
if (StringUtils.isBlank(request.getHeader("applicationid")) && session != null)
requestTemplate.header("applicationid", new String[] {session.getApplicationId()});
}
}
}
}
@@ -0,0 +1,23 @@
package cn.cloudwalk.elevator.cacheable;
import cn.cloudwalk.client.cwoscomponent.intelligent.sysetting.param.DeviceAreaTreeParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.sysetting.result.AreaTreeResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.sysetting.service.SysettingAreaService;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@Service
public class AcsAreaTreeCacheableService {
@Resource
private SysettingAreaService sysettingAreaService;
@Cacheable(cacheNames = {"ACS_AreaTreeCache"},
key = "T(cn.cloudwalk.elevator.cache.CacheOverrideConfig).CACHE_KEY_ACS_AREA_TREE_PREFIX + #param.businessId")
public CloudwalkResult<List<AreaTreeResult>> tree(DeviceAreaTreeParam param, CloudwalkCallContext context) {
return this.sysettingAreaService.tree(param, context);
}
}
@@ -0,0 +1,49 @@
package cn.cloudwalk.elevator.codeElevatorArea.impl;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
import cn.cloudwalk.elevator.codeElevatorArea.dao.AcsElevatorCodeDao;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeDTO;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO;
import cn.cloudwalk.elevator.codeElevatorArea.param.AcsElevatorCodeParam;
import cn.cloudwalk.elevator.codeElevatorArea.service.AcsElevatorCodeService;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.util.ObjectUtils;
@Repository
public class AcsElevatorCodeServiceImpl implements AcsElevatorCodeService {
@Resource
private AcsElevatorCodeDao acsElevatorCodeDao;
protected final Logger logger = LoggerFactory.getLogger(getClass());
public Integer insertNew(AcsElevatorCodeParam param) throws ServiceException {
AcsElevatorCodeDTO dto = (AcsElevatorCodeDTO)BeanCopyUtils.copyProperties(param, AcsElevatorCodeDTO.class);
Long createTime = Long.valueOf(System.currentTimeMillis());
dto.setCreateTime(createTime);
dto.setLastUpdateTime(createTime);
return this.acsElevatorCodeDao.insertNew(dto);
}
public Integer updateOld(AcsElevatorCodeParam param) throws ServiceException {
AcsElevatorCodeDTO dto = (AcsElevatorCodeDTO)BeanCopyUtils.copyProperties(param, AcsElevatorCodeDTO.class);
Long nowTime = Long.valueOf(System.currentTimeMillis());
dto.setLastUpdateTime(nowTime);
return this.acsElevatorCodeDao.updateOld(dto);
}
public AcsElevatorCodeResultDTO get(AcsElevatorCodeParam param) throws ServiceException {
AcsElevatorCodeDTO dto = (AcsElevatorCodeDTO)BeanCopyUtils.copyProperties(param, AcsElevatorCodeDTO.class);
AcsElevatorCodeResultDTO result = this.acsElevatorCodeDao.get(dto);
if (!ObjectUtils.isEmpty(result)) {
return result;
}
return null;
}
public AcsElevatorCodeResultDTO getFirstByParentId(String parentId) throws ServiceException {
return this.acsElevatorCodeDao.getFirstByParentId(parentId);
}
}
@@ -0,0 +1,43 @@
package cn.cloudwalk.elevator.codeElevatorArea.param;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorCodeParam extends CloudwalkBaseTimes implements Serializable {
private String zoneId;
private String parentId;
private String code;
private Integer isFirst;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getIsFirst() {
return this.isFirst;
}
public void setIsFirst(Integer isFirst) {
this.isFirst = isFirst;
}
}
@@ -0,0 +1,31 @@
package cn.cloudwalk.elevator.codeElevatorArea.result;
public class AcsElevatorCodeResult {
private String zoneId;
private String code;
private Integer isFirst;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getIsFirst() {
return this.isFirst;
}
public void setIsFirst(Integer isFirst) {
this.isFirst = isFirst;
}
}
@@ -0,0 +1,15 @@
package cn.cloudwalk.elevator.codeElevatorArea.service;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO;
import cn.cloudwalk.elevator.codeElevatorArea.param.AcsElevatorCodeParam;
public interface AcsElevatorCodeService {
Integer insertNew(AcsElevatorCodeParam paramAcsElevatorCodeParam) throws ServiceException;
Integer updateOld(AcsElevatorCodeParam paramAcsElevatorCodeParam) throws ServiceException;
AcsElevatorCodeResultDTO get(AcsElevatorCodeParam paramAcsElevatorCodeParam) throws ServiceException;
AcsElevatorCodeResultDTO getFirstByParentId(String paramString) throws ServiceException;
}
@@ -0,0 +1,40 @@
package cn.cloudwalk.elevator.common;
import cn.cloudwalk.client.cwoscomponent.intelligent.sysetting.result.AreaTreeResult;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.session.company.CompanyContext;
import cn.cloudwalk.cloud.session.user.UserContext;
import cn.cloudwalk.cloud.utils.CloudwalkDateUtils;
import cn.cloudwalk.elevator.config.FeignThreadLocalUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AbstractAcsDeviceService extends AbstractCloudwalkService {
protected void getAreaMap(List<AreaTreeResult> areaTreeResultList, Map<String, String> areaMap) {
for (AreaTreeResult areaTree : areaTreeResultList) {
areaMap.put(areaTree.getId(), areaTree.getName());
if (areaTree.getChildren() != null) {
getAreaMap(areaTree.getChildren(), areaMap);
}
}
}
public CloudwalkCallContext getCloudwalkContext(String businessId) {
CloudwalkCallContext context = new CloudwalkCallContext();
CompanyContext companyContext = new CompanyContext();
companyContext.setCompanyId(businessId);
context.setCompany(companyContext);
UserContext userContext = new UserContext();
userContext.setCaller("defaultUserId");
userContext.setCallerName("defaultUserName");
context.setUser(userContext);
context.setCallTime(CloudwalkDateUtils.getCurrentDate());
Map<String, String> feignThreadLoaclMap = new HashMap<>(3);
feignThreadLoaclMap.put("businessid", businessId);
feignThreadLoaclMap.put("platformuserid", "defaultUserId");
feignThreadLoaclMap.put("username", "defaultUserName");
FeignThreadLocalUtil.set(feignThreadLoaclMap);
return context;
}
}
@@ -0,0 +1,39 @@
package cn.cloudwalk.elevator.common;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService;
import cn.cloudwalk.cloud.serial.UUIDSerial;
import cn.cloudwalk.cloud.utils.CloudwalkDateUtils;
import cn.cloudwalk.serial.code.AbstractGeneralCode;
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 class AbstractCloudwalkService {
@Autowired
protected DeviceService deviceService;
protected final Logger logger = LoggerFactory.getLogger(getClass());
private static final int GENGRAL_CODE_LENGTH = 8;
@Autowired
private MessageSource messageSource;
@Autowired
protected AbstractGeneralCode generalCode;
@Autowired(required = false)
private UUIDSerial uuidSerial;
public String getMessage(String code) {
return this.messageSource.getMessage(code, null, "", LocaleContextHolder.getLocale());
}
public String createGeneralCode() {
return this.generalCode.generalCode(CloudwalkDateUtils.getDate8YMD(), Integer.valueOf(8));
}
public String genUUID() {
if (null != this.uuidSerial) {
return this.uuidSerial.uuid();
}
return CloudwalkDateUtils.getUUID();
}
}
@@ -0,0 +1,41 @@
package cn.cloudwalk.elevator.common;
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 cn.cloudwalk.elevator.common.service.AcsApplicationService;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@Service
public class AcsApplicationServiceImpl implements AcsApplicationService {
private static final Logger logger = LoggerFactory.getLogger(AcsApplicationServiceImpl.class);
@Resource
private ApplicationService applicationService;
@Cacheable(cacheNames = {"ACS_Applicationids"},
key = "T(cn.cloudwalk.biz.ninca.accesscontrol.cache.CacheOverrideConfig).CACHE_KEY_APPLICATION_IDS_PREFIX + #businessId")
public String getApplicationId(String businessId) throws ServiceException {
ApplicationQueryParam param = new ApplicationQueryParam();
param.setBusinessId(businessId);
param.setServiceCode("elevator-app");
CloudwalkResult<List<ApplicationResult>> cloudwalkResult = this.applicationService.query(param);
if (cloudwalkResult.isSuccess()) {
if (CollectionUtils.isNotEmpty((Collection)cloudwalkResult.getData())) {
return ((ApplicationResult)((List<ApplicationResult>)cloudwalkResult.getData()).get(0)).getId();
}
logger.info("未查到applicationId");
throw new ServiceException("76260005", "未查到applicationId");
}
logger.info("查询applicationId失败");
throw new ServiceException("76260006", "查询applicationId失败");
}
}
@@ -0,0 +1,54 @@
package cn.cloudwalk.elevator.common;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "ninca.update.floor.pool")
public class UpdateFloorsPoolProperties {
private int corePoolSize = 3;
private int maxPoolSize = 5;
private int keepAliveSeconds = 150;
private int queueCapacity = 100;
private boolean allowCoreThreadTimeOut = true;
public int getCorePoolSize() {
return this.corePoolSize;
}
public void setCorePoolSize(int corePoolSize) {
this.corePoolSize = corePoolSize;
}
public int getMaxPoolSize() {
return this.maxPoolSize;
}
public void setMaxPoolSize(int maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
public int getKeepAliveSeconds() {
return this.keepAliveSeconds;
}
public void setKeepAliveSeconds(int keepAliveSeconds) {
this.keepAliveSeconds = keepAliveSeconds;
}
public int getQueueCapacity() {
return this.queueCapacity;
}
public void setQueueCapacity(int queueCapacity) {
this.queueCapacity = queueCapacity;
}
public boolean isAllowCoreThreadTimeOut() {
return this.allowCoreThreadTimeOut;
}
public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
}
}
@@ -0,0 +1,26 @@
package cn.cloudwalk.elevator.common;
import java.util.concurrent.ThreadPoolExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Configuration
public class UpdateFloorsTaskExecutor {
@Autowired
private UpdateFloorsPoolProperties updateFloorsPoolProperties;
@Bean(name = {"updateFloorsExecutor"})
public ThreadPoolTaskExecutor pictureRevisionTaskExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(this.updateFloorsPoolProperties.getCorePoolSize());
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(this.updateFloorsPoolProperties.isAllowCoreThreadTimeOut());
threadPoolTaskExecutor.setMaxPoolSize(this.updateFloorsPoolProperties.getMaxPoolSize());
threadPoolTaskExecutor.setQueueCapacity(this.updateFloorsPoolProperties.getQueueCapacity());
threadPoolTaskExecutor.setThreadNamePrefix("update-floors-pool-");
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
threadPoolTaskExecutor.initialize();
return threadPoolTaskExecutor;
}
}
@@ -0,0 +1,6 @@
/**
* 电梯应用业务编排层中的公共抽象与基础服务实现(与 common 模块中的“工具型 common”区分)。
* <p>
* 放置跨领域的服务基类、模板方法等,供本模块内各子包复用。
*/
package cn.cloudwalk.elevator.common;
@@ -0,0 +1,7 @@
package cn.cloudwalk.elevator.common.service;
import cn.cloudwalk.cloud.exception.ServiceException;
public interface AcsApplicationService {
String getApplicationId(String paramString) throws ServiceException;
}
@@ -0,0 +1,127 @@
package cn.cloudwalk.elevator.device.impl;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.elevator.common.AbstractAcsDeviceService;
import cn.cloudwalk.elevator.device.dao.AcsDeviceTaskDao;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskAddDto;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskDTO;
import cn.cloudwalk.elevator.device.param.AcsRestructureBindingParam;
import cn.cloudwalk.elevator.device.service.AcsDeviceTaskService;
import cn.cloudwalk.elevator.passrule.dao.ImageRuleRefDao;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleDeleteDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageResultDto;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleDeleteParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleNewParam;
import cn.cloudwalk.elevator.passrule.service.ImageRuleRefService;
import cn.cloudwalk.elevator.person.param.AcsPersonAddParam;
import cn.cloudwalk.elevator.person.param.AcsPersonDeleteParam;
import cn.cloudwalk.elevator.person.service.PersonRuleService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@Service
public class AcsDeviceTaskServiceImpl extends AbstractAcsDeviceService implements AcsDeviceTaskService {
@Autowired
private PersonRuleService personRuleService;
@Autowired
private ImageRuleRefService imageRuleRefService;
@Resource
private AcsDeviceTaskDao acsDeviceTaskDao;
@Resource
private ImageRuleRefDao imageRuleRefDao;
@Async("updateFloorsExecutor")
public void updateFloors(AcsRestructureBindingParam param, List<AcsPassRuleImageResultDto> addFloors,
List<String> delFloorIds, CloudwalkCallContext context) throws ServiceException {
try {
if (!CollectionUtils.isEmpty(addFloors)) {
for (AcsPassRuleImageResultDto addFloor : addFloors) {
AcsDeviceTaskDTO task = this.acsDeviceTaskDao.getById(param.getTaskId());
if (task.getIsStop().intValue() == 0) {
if (!ObjectUtils.isEmpty(param.getPersonId())) {
AcsPersonAddParam addParam = new AcsPersonAddParam();
addParam.setPersonIds(Collections.singletonList(param.getPersonId()));
addParam.setParentId(param.getParentId());
addParam.setZoneId(addFloor.getZoneId());
addParam.setZoneName(addFloor.getZoneName());
this.personRuleService.add(addParam, context);
} else {
AcsPassRuleNewParam ruleParam = new AcsPassRuleNewParam();
ruleParam.setParentId(param.getParentId());
ruleParam.setZoneId(addFloor.getZoneId());
ruleParam.setZoneName(addFloor.getZoneName());
if (!ObjectUtils.isEmpty(param.getLabelId())) {
ruleParam.setIncludeLabels(Collections.singletonList(param.getLabelId()));
ruleParam.setRuleName(addFloor.getZoneName() + param.getLabelName());
}
if (!ObjectUtils.isEmpty(param.getOrgId())) {
ruleParam.setIncludeOrganizations(Collections.singletonList(param.getOrgId()));
ruleParam.setRuleName(addFloor.getZoneName() + param.getOrgName());
}
this.imageRuleRefService.addOnlyRule(ruleParam, context);
}
AcsDeviceTaskAddDto addDto = new AcsDeviceTaskAddDto();
addDto.setId(task.getId());
addDto.setBindDevices(Integer.valueOf(task.getBindDevices().intValue() + 1));
this.acsDeviceTaskDao.updateBingDevices(addDto);
}
}
}
if (!CollectionUtils.isEmpty(delFloorIds)) {
List<AcsPassRuleImageResultDto> ruleList = this.imageRuleRefDao.listZoneInfoByIds(delFloorIds);
Map<String, String> ruleMap = new HashMap<>();
ruleList.forEach(rule -> (String)ruleMap.put(rule.getZoneId(), rule.getZoneName()));
for (String delFloorId : delFloorIds) {
AcsDeviceTaskDTO task = this.acsDeviceTaskDao.getById(param.getTaskId());
if (task.getIsStop().intValue() == 0) {
if (!ObjectUtils.isEmpty(param.getPersonId())) {
AcsPersonDeleteParam delParam = new AcsPersonDeleteParam();
delParam.setParentId(param.getParentId());
delParam.setZoneId(delFloorId);
delParam.setPersonIds(Collections.singletonList(param.getPersonId()));
this.personRuleService.delete(delParam, context);
} else {
String ruleName = "";
if (!ObjectUtils.isEmpty(param.getLabelName())) {
ruleName = (String)ruleMap.get(delFloorId) + param.getLabelName();
}
if (!ObjectUtils.isEmpty(param.getOrgName())) {
ruleName = (String)ruleMap.get(delFloorId) + param.getOrgName();
}
String ruleId = this.imageRuleRefDao.getByRuleName(ruleName, delFloorId);
if (!ObjectUtils.isEmpty(ruleId)) {
AcsPassRuleDeleteParam deleteParam = new AcsPassRuleDeleteParam();
deleteParam.setIds(Collections.singletonList(ruleId));
deleteParam.setZoneId(delFloorId);
deleteParam.setParentId(param.getParentId());
this.imageRuleRefService.delete(deleteParam, context);
} else {
AcsPassRuleDeleteDto dto = new AcsPassRuleDeleteDto();
dto.setZoneId(delFloorId);
dto.setLabelId(param.getLabelId());
dto.setOrgId(param.getOrgId());
this.imageRuleRefDao.deleteByOrgAndLabel(dto);
}
}
AcsDeviceTaskAddDto addDto = new AcsDeviceTaskAddDto();
addDto.setId(task.getId());
addDto.setBindDevices(Integer.valueOf(task.getBindDevices().intValue() + 1));
this.acsDeviceTaskDao.updateBingDevices(addDto);
}
}
}
} catch (Exception e) {
this.logger.error("处理设备任务失败,失败原因:{}", e);
throw new ServiceException(e.getMessage());
}
}
}
@@ -0,0 +1,929 @@
package cn.cloudwalk.elevator.device.impl;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceService;
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.service.ImageStoreService;
import cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonDetailParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.person.result.PersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService;
import cn.cloudwalk.client.cwoscomponent.intelligent.sysetting.param.DeviceAreaTreeParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.sysetting.result.AreaTreeResult;
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.elevator.cacheable.AcsAreaTreeCacheableService;
import cn.cloudwalk.elevator.common.service.AcsApplicationService;
import cn.cloudwalk.elevator.device.dao.AcsDeviceTaskDao;
import cn.cloudwalk.elevator.device.dao.AcsElevatorDeviceDao;
import cn.cloudwalk.elevator.device.dao.DeviceImageStoreDao;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskAddDto;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceAddDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceEditDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryByIdDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryFoDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.device.param.AcsDeviceQueryParam;
import cn.cloudwalk.elevator.device.param.AcsDeviceRestructureTaskParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceAddParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceEditParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceQueryByIdParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceQueryParam;
import cn.cloudwalk.elevator.device.param.AcsRestructureBindingParam;
import cn.cloudwalk.elevator.device.param.AcsRestructureQueryParam;
import cn.cloudwalk.elevator.device.result.AcsDeviceNewResult;
import cn.cloudwalk.elevator.device.result.AcsDeviceRestructureResult;
import cn.cloudwalk.elevator.device.result.AcsLabelElevatorResult;
import cn.cloudwalk.elevator.device.service.AcsDeviceTaskService;
import cn.cloudwalk.elevator.device.service.AcsElevatorDeviceService;
import cn.cloudwalk.elevator.device.setting.impl.AcsDeviceImageStoreAppBindServiceImpl;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppBindParam;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppUnbindParam;
import cn.cloudwalk.elevator.device.setting.service.AcsDeviceImageStoreAppBindService;
import cn.cloudwalk.elevator.passrule.dao.AcsPassRuleDao;
import cn.cloudwalk.elevator.passrule.dao.ImageRuleRefDao;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageResultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleLabelResultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleQueryDto;
import cn.cloudwalk.elevator.passrule.impl.AbstractAcsPassService;
import cn.cloudwalk.elevator.passrule.service.AcsPassRuleService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
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.stereotype.Repository;
import org.springframework.util.ObjectUtils;
@Repository
public class AcsElevatorDeviceServiceImpl extends AbstractAcsPassService implements AcsElevatorDeviceService {
@Value("${floor.building.id}")
private String floorBuildingId;
@Resource
private ImageStoreService imageStoreService;
@Resource
private AcsElevatorDeviceDao acsElevatorDeviceDao;
@Resource
private AcsPassRuleDao acsPassRuleDao;
@Resource
private ImageRuleRefDao imageRuleRefDao;
@Autowired
private AcsDeviceTaskService acsDeviceTaskService;
@Resource
private AcsDeviceTaskDao acsDeviceTaskDao;
@Resource
private DeviceImageStoreDao deviceImageStoreDao;
@Resource
private PersonService personService;
@Resource
private AcsDeviceImageStoreAppBindService acsDeviceImageStoreAppBindService;
@Resource
private AcsDeviceImageStoreAppBindServiceImpl acsDeviceImageStoreAppBindServiceImpl;
@Resource
private DeviceService deviceService;
@Autowired
private AcsApplicationService acsApplicationService;
@Resource
private AcsPassRuleService acsPassRuleService;
@Resource
private AcsAreaTreeCacheableService acsAreaTreeCacheableService;
protected final Logger logger = LoggerFactory.getLogger(getClass());
public Integer add(AcsElevatorDeviceAddParam param, CloudwalkCallContext context) throws ServiceException {
AcsElevatorDeviceAddDTO dto =
(AcsElevatorDeviceAddDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceAddDTO.class);
try {
Long createTime = Long.valueOf(System.currentTimeMillis());
dto.setCreateTime(createTime);
dto.setLastUpdateTime(createTime);
String currentBuildingId = dto.getCurrentBuildingId();
if (dto.getDeleteFlag() == null) {
dto.setDeleteFlag(Integer.valueOf(1));
}
if (StringUtils.isNotBlank(currentBuildingId)) {
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(currentBuildingId);
if (ObjectUtils.isEmpty(imageStoreId)) {
String bigImageStoreId = addImageStore(param, context);
this.deviceImageStoreDao.save(currentBuildingId, bigImageStoreId);
} else {
String applicationId =
this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId());
DeviceImageStoreAppBindParam bindParam = new DeviceImageStoreAppBindParam();
bindParam.setImageStoreId(imageStoreId);
bindParam.setDeviceId(param.getDeviceId());
bindParam.setApplicationId(applicationId);
this.acsDeviceImageStoreAppBindService.bindDeviceAndImageStore(bindParam, context);
}
}
return this.acsElevatorDeviceDao.add(dto);
} catch (Exception e) {
this.logger.error("保存派梯设备信息失败,原因:", e);
throw new ServiceException(e);
}
}
public Integer edit(AcsElevatorDeviceEditParam param, CloudwalkCallContext context) throws ServiceException {
AcsElevatorDeviceEditDTO dto =
(AcsElevatorDeviceEditDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceEditDTO.class);
try {
AcsElevatorDeviceQueryByIdDTO deviceQueryByIdDTO = new AcsElevatorDeviceQueryByIdDTO();
deviceQueryByIdDTO.setId(param.getId());
AcsElevatorDeviceResultDTO deviceResultDTO = this.acsElevatorDeviceDao.getById(deviceQueryByIdDTO);
String oldImageStoreId = this.deviceImageStoreDao.getByBuildingId(deviceResultDTO.getCurrentBuildingId());
if (deviceResultDTO != null && StringUtils.isNotBlank(deviceResultDTO.getCurrentFloorId())) {
if (!deviceResultDTO.getCurrentBuildingId().equals(param.getCurrentBuildingId())) {
String applicationId =
this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId());
DeviceImageStoreAppUnbindParam unbindParam = new DeviceImageStoreAppUnbindParam();
unbindParam.setApplicationId(applicationId);
unbindParam.setImageStoreId(oldImageStoreId);
unbindParam.setDeviceId(deviceResultDTO.getDeviceId());
unbindParam.setDeviceCode(deviceResultDTO.getDeviceCode());
this.acsDeviceImageStoreAppBindService.unbindAppImageStoreDeviceNotDeleteImage(unbindParam,
context);
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getCurrentBuildingId());
if (ObjectUtils.isEmpty(imageStoreId)) {
AcsElevatorDeviceAddParam addParam = (AcsElevatorDeviceAddParam)BeanCopyUtils
.copyProperties(param, AcsElevatorDeviceAddParam.class);
String bigImageStoreId = addImageStore(addParam, context);
this.deviceImageStoreDao.save(param.getCurrentBuildingId(), bigImageStoreId);
} else {
DeviceImageStoreAppBindParam bindParam = new DeviceImageStoreAppBindParam();
bindParam.setImageStoreId(imageStoreId);
bindParam.setDeviceId(deviceResultDTO.getDeviceId());
bindParam.setApplicationId(applicationId);
this.acsDeviceImageStoreAppBindService.bindDeviceAndImageStore(bindParam, context);
}
}
}
Long nowTime = Long.valueOf(System.currentTimeMillis());
dto.setLastUpdateTime(nowTime);
return this.acsElevatorDeviceDao.edit(dto);
} catch (Exception e) {
this.logger.error("更新派梯设备信息失败,原因:", e);
throw new ServiceException(e);
}
}
public Integer delete(List<String> ids, CloudwalkCallContext context) throws ServiceException {
try {
String applicationId = this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId());
for (String id : ids) {
AcsElevatorDeviceQueryByIdDTO byIdDTO = new AcsElevatorDeviceQueryByIdDTO();
byIdDTO.setId(id);
AcsElevatorDeviceResultDTO deviceResultDTO = this.acsElevatorDeviceDao.getById(byIdDTO);
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(deviceResultDTO.getCurrentBuildingId());
DeviceImageStoreAppUnbindParam unbindParam = new DeviceImageStoreAppUnbindParam();
unbindParam.setApplicationId(applicationId);
unbindParam.setImageStoreId(imageStoreId);
unbindParam.setDeviceId(deviceResultDTO.getDeviceId());
unbindParam.setDeviceCode(deviceResultDTO.getDeviceCode());
this.acsDeviceImageStoreAppBindService.unbindAppImageStoreDeviceNotDeleteImage(unbindParam, context);
}
int result = this.acsElevatorDeviceDao.delete(ids).intValue();
return Integer.valueOf(1);
} catch (Exception e) {
this.logger.error("更新派梯设备信息失败,原因:", e);
throw new ServiceException(e);
}
}
public String getBuildingId(AcsElevatorDeviceQueryParam param) throws ServiceException {
AcsElevatorDeviceQueryDTO dto =
(AcsElevatorDeviceQueryDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceQueryDTO.class);
return this.acsElevatorDeviceDao.getBuildingId(dto);
}
public String getBusinessId(AcsElevatorDeviceQueryParam param) throws ServiceException {
AcsElevatorDeviceQueryDTO dto =
(AcsElevatorDeviceQueryDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceQueryDTO.class);
return this.acsElevatorDeviceDao.getBusinessId(dto);
}
public CloudwalkResult<CloudwalkPageAble<AcsElevatorDeviceResultDTO>> get(AcsElevatorDeviceQueryParam param,
CloudwalkCallContext context) throws ServiceException {
AcsElevatorDeviceQueryDTO dto =
(AcsElevatorDeviceQueryDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceQueryDTO.class);
dto.setBusinessId(context.getCompany().getCompanyId());
CloudwalkPageInfo page = new CloudwalkPageInfo(param.getCurrentPage(), param.getRowsOfPage());
try {
CloudwalkPageAble<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.page(dto, page);
return CloudwalkResult.success(deviceList);
} catch (Exception e) {
this.logger.error("分页查询派梯设备失败,失败原因:", e);
throw new ServiceException("76260108", getMessage("76260108"));
}
}
public CloudwalkResult<CloudwalkPageAble<DeviceResult>> devicePage(AcsDeviceQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
try {
DeviceQueryParam queryParam = new DeviceQueryParam();
if (!ObjectUtils.isEmpty(param.getDeviceName())) {
queryParam.setDeviceName(param.getDeviceName());
}
if (!ObjectUtils.isEmpty(param.getAreaId())) {
queryParam.setAreaIds(Collections.singletonList(param.getAreaId()));
}
if (!ObjectUtils.isEmpty(param.getDeviceCategoryId())) {
queryParam.setDeviceTypeCategoryId(param.getDeviceCategoryId());
}
queryParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<List<DeviceResult>> pageResult = this.deviceService.list(queryParam, context);
List<DeviceResult> result = new ArrayList<>();
if (!pageResult.isSuccess() || CollectionUtils.isEmpty((Collection)pageResult.getData())) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
List<DeviceResult> deviceResult = deviceFilter((List<DeviceResult>)pageResult.getData(), context);
if (CollectionUtils.isEmpty(deviceResult)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
Map<String, String> areaMap = getAllAreaMap(context);
result =
page(convertDeviceNewResult(deviceResult, areaMap), pageInfo.getPageSize(), pageInfo.getCurrentPage());
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, deviceResult.size()));
} catch (Exception e) {
this.logger.error("分页查询设备异常,原因:", e);
throw new ServiceException(e);
}
}
public List<AcsElevatorDeviceQueryFoDTO> getFo(AcsElevatorDeviceQueryParam param) throws ServiceException {
AcsElevatorDeviceQueryDTO dto =
(AcsElevatorDeviceQueryDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceQueryDTO.class);
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.get(dto);
List<AcsElevatorDeviceQueryFoDTO> deviceFoList = new ArrayList<>();
for (AcsElevatorDeviceResultDTO resultDTO : deviceList) {
AcsElevatorDeviceQueryFoDTO foDto =
(AcsElevatorDeviceQueryFoDTO)BeanCopyUtils.copyProperties(resultDTO, AcsElevatorDeviceQueryFoDTO.class);
deviceFoList.add(foDto);
}
return deviceFoList;
}
public AcsElevatorDeviceResultDTO getById(AcsElevatorDeviceQueryByIdParam param, CloudwalkCallContext var2)
throws ServiceException {
AcsElevatorDeviceQueryByIdDTO dto =
(AcsElevatorDeviceQueryByIdDTO)BeanCopyUtils.copyProperties(param, AcsElevatorDeviceQueryByIdDTO.class);
AcsElevatorDeviceResultDTO resultDTO = this.acsElevatorDeviceDao.getById(dto);
if (resultDTO != null && StringUtils.isNotBlank(resultDTO.getDeviceId())) {
DeviceQueryParam deviceQueryParam = new DeviceQueryParam();
deviceQueryParam.setId(resultDTO.getId());
CloudwalkResult<List<DeviceResult>> result = this.deviceService.list(deviceQueryParam, var2);
List<DeviceResult> list = (List<DeviceResult>)result.getData();
if (list != null && list.size() > 0) {
DeviceResult deviceResult = list.get(0);
if (deviceResult != null) {
String id = deviceResult.getId();
Long lastHeartbeatTime = deviceResult.getLastHeartbeatTime();
String status = deviceResult.getOnlineStatus();
resultDTO.setStatusString(status);
resultDTO.setLastHeartbeatTime(lastHeartbeatTime);
}
}
}
return resultDTO;
}
public AcsElevatorDeviceResultDTO getByDeciveCode(String deviceCode) throws ServiceException {
return this.acsElevatorDeviceDao.getByDeciveCode(deviceCode);
}
public CloudwalkResult listUnbindFloors(AcsRestructureQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
List<AcsPassRuleImageResultDto> floorList;
List<AcsDeviceRestructureResult> results = new ArrayList<>();
if (!ObjectUtils.isEmpty(param.getPersonId())) {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
dto.setPersonId(param.getPersonId());
PersonDetailParam detailParam = new PersonDetailParam();
detailParam.setId(param.getPersonId());
detailParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<PersonResult> detail = this.personService.detail(detailParam, context);
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getLabelIds())) {
dto.setIncludeLabels(((PersonResult)detail.getData()).getLabelIds());
}
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getOrganizationIds())) {
dto.setIncludeOrganizations(((PersonResult)detail.getData()).getOrganizationIds());
}
floorList = this.imageRuleRefDao.listByPersonInfo(dto);
} else {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
if (!ObjectUtils.isEmpty(param.getLabelId())) {
dto.setIncludeLabels(Collections.singletonList(param.getLabelId()));
}
if (!ObjectUtils.isEmpty(param.getOrgId())) {
dto.setIncludeOrganizations(Collections.singletonList(param.getOrgId()));
}
floorList = this.imageRuleRefDao.listByRestructure(dto);
}
List<String> floorIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(floorList)) {
floorList.forEach(floor -> floorIds.add(floor.getZoneId()));
}
AcsPassRuleQueryDto queryDto = new AcsPassRuleQueryDto();
queryDto.setZoneIds(floorIds);
return CloudwalkResult.success(this.imageRuleRefDao.listByNotZoneIds(queryDto));
} catch (Exception e) {
this.logger.error("查询未绑定的派梯楼层异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult listFloors(AcsRestructureQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
List<AcsPassRuleImageResultDto> floorList, unBindFloors;
List<AcsDeviceRestructureResult> results = new ArrayList<>();
if (!ObjectUtils.isEmpty(param.getPersonId())) {
AcsPassRuleImageDto acsPassRuleImageDto = new AcsPassRuleImageDto();
acsPassRuleImageDto.setPersonId(param.getPersonId());
PersonDetailParam detailParam = new PersonDetailParam();
detailParam.setId(param.getPersonId());
detailParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<PersonResult> detail = this.personService.detail(detailParam, context);
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getLabelIds())) {
acsPassRuleImageDto.setIncludeLabels(((PersonResult)detail.getData()).getLabelIds());
}
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getOrganizationIds())) {
acsPassRuleImageDto.setIncludeOrganizations(((PersonResult)detail.getData()).getOrganizationIds());
}
floorList = this.imageRuleRefDao.listByPersonInfo(acsPassRuleImageDto);
} else {
AcsPassRuleImageDto acsPassRuleImageDto = new AcsPassRuleImageDto();
if (!ObjectUtils.isEmpty(param.getLabelId())) {
acsPassRuleImageDto.setIncludeLabels(Collections.singletonList(param.getLabelId()));
}
if (!ObjectUtils.isEmpty(param.getOrgId())) {
acsPassRuleImageDto.setIncludeOrganizations(Collections.singletonList(param.getOrgId()));
}
floorList = this.imageRuleRefDao.listByRestructure(acsPassRuleImageDto);
}
AcsElevatorDeviceListDto dto = new AcsElevatorDeviceListDto();
List<String> floorIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(floorList)) {
floorList.forEach(floor -> floorIds.add(floor.getZoneId()));
}
AcsPassRuleQueryDto queryDto = new AcsPassRuleQueryDto();
if (!ObjectUtils.isEmpty(param.getZoneId())) {
if (floorIds.contains(param.getZoneId())) {
return CloudwalkResult.success(results);
}
queryDto.setZoneId(param.getZoneId());
unBindFloors = this.imageRuleRefDao.listByNotZoneIds(queryDto);
} else {
queryDto.setZoneIds(floorIds);
unBindFloors = this.imageRuleRefDao.listByNotZoneIds(queryDto);
}
List<String> unBindFloorIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(unBindFloors)) {
unBindFloors.forEach(floor -> unBindFloorIds.add(floor.getZoneId()));
} else {
return CloudwalkResult.success(results);
}
if (!ObjectUtils.isEmpty(param.getZoneId())) {
dto.setCurrentFloorId(param.getZoneId());
} else {
dto.setCurrentFloorIds(unBindFloorIds);
}
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.listByZoneIds(dto);
List<String> deviceIds = new ArrayList<>();
Map<String, DeviceResult> mapDevice = new HashMap<>();
if (!CollectionUtils.isEmpty(deviceList)) {
deviceList.forEach(device -> deviceIds.add(device.getDeviceId()));
DeviceQueryParam queryParam = new DeviceQueryParam();
queryParam.setBusinessId(context.getCompany().getCompanyId());
queryParam.setIds(deviceIds);
CloudwalkResult<List<DeviceResult>> resultList = this.deviceService.list(queryParam, context);
List<DeviceResult> list = (List<DeviceResult>)resultList.getData();
if (list != null && list.size() > 0) {
for (DeviceResult deviceResult : list) {
mapDevice.put(deviceResult.getId(), deviceResult);
}
}
}
for (AcsPassRuleImageResultDto floor : unBindFloors) {
AcsDeviceRestructureResult result = new AcsDeviceRestructureResult();
result.setZoneId(floor.getZoneId());
result.setZoneName(floor.getZoneName());
if (!CollectionUtils.isEmpty(deviceList)) {
result.setParentId(((AcsElevatorDeviceResultDTO)deviceList.get(0)).getCurrentBuildingId());
} else {
result.setParentId(this.floorBuildingId);
}
String online = "";
String offline = "";
if (!CollectionUtils.isEmpty(deviceList)) {
for (int i = 0; i < deviceList.size(); i++) {
if (floor.getZoneId()
.equals(((AcsElevatorDeviceResultDTO)deviceList.get(i)).getCurrentFloorId())) {
DeviceResult deviceResult =
mapDevice.get(((AcsElevatorDeviceResultDTO)deviceList.get(i)).getDeviceId());
if (!ObjectUtils.isEmpty(deviceResult)) {
if ("2".equals(deviceResult.getOnlineStatus())) {
if ("".equals(online)) {
online = online + deviceResult.getDeviceName();
} else {
online = online + "," + deviceResult.getDeviceName();
}
} else if ("".equals(offline)) {
offline = offline + deviceResult.getDeviceName();
} else {
offline = offline + ',' + deviceResult.getDeviceName();
}
}
}
}
}
result.setOnlineDevices(online);
result.setOfflineDevices(offline);
results.add(result);
}
return CloudwalkResult.success(results);
} catch (Exception e) {
this.logger.error("查询未绑定的派梯楼层异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult listCondition(AcsRestructureQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
List<AcsPassRuleImageResultDto> floorList;
List<AcsDeviceRestructureResult> results = new ArrayList<>();
if (!ObjectUtils.isEmpty(param.getBusinessId())) {
context.getCompany().setCompanyId(param.getBusinessId());
}
if (!ObjectUtils.isEmpty(param.getPersonId())) {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
dto.setPersonId(param.getPersonId());
PersonDetailParam detailParam = new PersonDetailParam();
detailParam.setId(param.getPersonId());
detailParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<PersonResult> detail = this.personService.detail(detailParam, context);
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getLabelIds())) {
dto.setIncludeLabels(((PersonResult)detail.getData()).getLabelIds());
}
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getOrganizationIds())) {
dto.setIncludeOrganizations(((PersonResult)detail.getData()).getOrganizationIds());
}
floorList = this.imageRuleRefDao.listByPersonInfo(dto);
} else {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
if (!ObjectUtils.isEmpty(param.getLabelId())) {
dto.setIncludeLabels(Collections.singletonList(param.getLabelId()));
}
if (!ObjectUtils.isEmpty(param.getOrgId())) {
dto.setIncludeOrganizations(Collections.singletonList(param.getOrgId()));
}
floorList = this.imageRuleRefDao.listByRestructure(dto);
}
if (!CollectionUtils.isEmpty(floorList)) {
AcsElevatorDeviceListDto dto = new AcsElevatorDeviceListDto();
List<String> floorIds = new ArrayList<>();
floorList.forEach(floor -> floorIds.add(floor.getZoneId()));
if (!ObjectUtils.isEmpty(param.getZoneId())) {
if (floorIds.contains(param.getZoneId())) {
dto.setCurrentFloorIds(Collections.singletonList(param.getZoneId()));
} else {
return CloudwalkResult.success(results);
}
} else {
dto.setCurrentFloorIds(floorIds);
}
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.listByZoneIds(dto);
if (!CollectionUtils.isEmpty(deviceList)) {
List<String> deviceIds = new ArrayList<>();
deviceList.forEach(device -> deviceIds.add(device.getDeviceId()));
Map<String, DeviceResult> mapDevice = new HashMap<>();
DeviceQueryParam queryParam = new DeviceQueryParam();
queryParam.setBusinessId(context.getCompany().getCompanyId());
queryParam.setIds(deviceIds);
CloudwalkResult<List<DeviceResult>> resultList = this.deviceService.list(queryParam, context);
List<DeviceResult> list = (List<DeviceResult>)resultList.getData();
if (list != null && list.size() > 0) {
for (DeviceResult deviceResult : list) {
mapDevice.put(deviceResult.getId(), deviceResult);
}
}
for (AcsPassRuleImageResultDto floor : floorList) {
if (!ObjectUtils.isEmpty(param.getZoneId()) && !param.getZoneId().equals(floor.getZoneId())) {
continue;
}
AcsDeviceRestructureResult result = new AcsDeviceRestructureResult();
result.setZoneId(floor.getZoneId());
result.setZoneName(floor.getZoneName());
result.setParentId(this.floorBuildingId);
String online = "";
String offline = "";
for (int i = 0; i < deviceList.size(); i++) {
if (floor.getZoneId()
.equals(((AcsElevatorDeviceResultDTO)deviceList.get(i)).getCurrentFloorId())) {
DeviceResult deviceResult =
mapDevice.get(((AcsElevatorDeviceResultDTO)deviceList.get(i)).getDeviceId());
result.setParentId(
((AcsElevatorDeviceResultDTO)deviceList.get(i)).getCurrentBuildingId());
if (!ObjectUtils.isEmpty(deviceResult)) {
if ("2".equals(deviceResult.getOnlineStatus())) {
if ("".equals(online)) {
online = online + deviceResult.getDeviceName();
} else {
online = online + "," + deviceResult.getDeviceName();
}
} else if ("".equals(offline)) {
offline = offline + deviceResult.getDeviceName();
} else {
offline = offline + ',' + deviceResult.getDeviceName();
}
}
}
}
result.setOnlineDevices(online);
result.setOfflineDevices(offline);
results.add(result);
}
} else if (!ObjectUtils.isEmpty(param.getZoneId())) {
for (AcsPassRuleImageResultDto floor : floorList) {
if (floor.getZoneId().equals(param.getZoneId())) {
AcsDeviceRestructureResult result = new AcsDeviceRestructureResult();
result.setZoneId(floor.getZoneId());
result.setZoneName(floor.getZoneName());
result.setParentId(this.floorBuildingId);
results.add(result);
break;
}
}
} else {
for (AcsPassRuleImageResultDto floor : floorList) {
AcsDeviceRestructureResult result = new AcsDeviceRestructureResult();
result.setZoneId(floor.getZoneId());
result.setZoneName(floor.getZoneName());
result.setParentId(this.floorBuildingId);
results.add(result);
}
}
}
return CloudwalkResult.success(results);
} catch (Exception e) {
this.logger.error("根据机构id、标签id、人员id查询派梯设备异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult listConditionByLabelIds(AcsRestructureQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
List<AcsLabelElevatorResult> results = new ArrayList<>();
if (CollectionUtils.isEmpty(param.getLabelIds())) {
return CloudwalkResult.success(null);
}
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
dto.setIncludeLabels(param.getLabelIds());
List<AcsPassRuleLabelResultDto> floorList = this.imageRuleRefDao.listFloorsByRestructure(dto);
Map<String, List<AcsPassRuleLabelResultDto>> maps = new HashMap<>();
if (CollectionUtils.isEmpty(floorList)) {
for (String label : param.getLabelIds()) {
AcsLabelElevatorResult result = new AcsLabelElevatorResult();
result.setLabelId(label);
result.setDetails(null);
results.add(result);
}
} else {
for (AcsPassRuleLabelResultDto resultDto : floorList) {
List<AcsPassRuleLabelResultDto> dtos = maps.get(resultDto.getLabelId());
if (!CollectionUtils.isEmpty(dtos)) {
dtos.add(resultDto);
maps.put(resultDto.getLabelId(), dtos);
continue;
}
List<AcsPassRuleLabelResultDto> dtoList = new ArrayList<>();
dtoList.add(resultDto);
maps.put(resultDto.getLabelId(), dtoList);
}
for (String label : param.getLabelIds()) {
List<AcsPassRuleLabelResultDto> dtoList = maps.get(label);
AcsLabelElevatorResult result = new AcsLabelElevatorResult();
result.setLabelId(label);
if (!CollectionUtils.isEmpty(dtoList)) {
result.setDetails(dtoList);
} else {
result.setDetails(null);
}
results.add(result);
}
}
return CloudwalkResult.success(results);
} catch (Exception e) {
this.logger.error("根据标签id集合查询派梯楼层权限异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult<String> bindingFloors(AcsRestructureBindingParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
if (!ObjectUtils.isEmpty(param.getLabelId())) {
dto.setIncludeLabels(Collections.singletonList(param.getLabelId()));
}
if (!ObjectUtils.isEmpty(param.getOrgId())) {
dto.setIncludeOrganizations(Collections.singletonList(param.getOrgId()));
}
List<AcsPassRuleImageResultDto> floorList = this.imageRuleRefDao.listByRestructure(dto);
List<String> floorIds = new ArrayList<>();
Map<String, AcsPassRuleImageResultDto> zoneMap = new HashMap<>();
for (AcsPassRuleImageResultDto resultDto : floorList) {
floorIds.add(resultDto.getZoneId());
zoneMap.put(resultDto.getZoneId(), resultDto);
}
List<AcsPassRuleImageResultDto> addFloors = new ArrayList<>();
List<String> delFloorIds = new ArrayList<>();
List<String> addFloorIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(floorList)) {
for (AcsPassRuleImageResultDto floor : floorList) {
if (!param.getZoneIds().contains(floor.getZoneId())) {
delFloorIds.add(floor.getZoneId());
}
}
for (String zoneId : param.getZoneIds()) {
if (!floorIds.contains(zoneId)) {
addFloorIds.add(zoneId);
}
}
if (!CollectionUtils.isEmpty(addFloorIds)) {
addFloors.addAll(this.imageRuleRefDao.listZoneInfoByIds(addFloorIds));
}
} else {
addFloors.addAll(this.imageRuleRefDao.listZoneInfoByIds(param.getZoneIds()));
}
if (!CollectionUtils.isEmpty(addFloors) || !CollectionUtils.isEmpty(delFloorIds)) {
String taskId = genUUID();
AcsDeviceTaskAddDto addDto = new AcsDeviceTaskAddDto();
addDto.setId(taskId);
addDto.setAllDevices(Integer.valueOf(addFloors.size() + delFloorIds.size()));
addDto.setBindDevices(Integer.valueOf(0));
addDto.setIsStop(Integer.valueOf(0));
this.acsDeviceTaskDao.insert(addDto);
param.setTaskId(taskId);
this.acsDeviceTaskService.updateFloors(param, addFloors, delFloorIds, context);
return CloudwalkResult.success(taskId);
}
return CloudwalkResult.success(null);
} catch (Exception e) {
this.logger.error("根据机构id、标签id、人员id查询派梯设备异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult<String> bindingPerson(AcsRestructureBindingParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
dto.setPersonId(param.getPersonId());
PersonDetailParam detailParam = new PersonDetailParam();
detailParam.setId(param.getPersonId());
detailParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<PersonResult> detail = this.personService.detail(detailParam, context);
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getLabelIds())) {
dto.setIncludeLabels(((PersonResult)detail.getData()).getLabelIds());
}
if (!CollectionUtils.isEmpty(((PersonResult)detail.getData()).getLabelIds())) {
dto.setIncludeOrganizations(((PersonResult)detail.getData()).getOrganizationIds());
}
List<AcsPassRuleImageResultDto> floorList = this.imageRuleRefDao.listByPersonInfo(dto);
List<String> floorIds = new ArrayList<>();
Map<String, AcsPassRuleImageResultDto> zoneMap = new HashMap<>();
floorList.forEach(floor -> floorIds.add(floor.getZoneId()));
for (AcsPassRuleImageResultDto resultDto : floorList) {
floorIds.add(resultDto.getZoneId());
zoneMap.put(resultDto.getZoneId(), resultDto);
}
List<AcsPassRuleImageResultDto> addFloors = new ArrayList<>();
List<String> delFloorIds = new ArrayList<>();
List<String> addFloorIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(floorList)) {
for (AcsPassRuleImageResultDto floor : floorList) {
if (!param.getZoneIds().contains(floor.getZoneId())) {
delFloorIds.add(floor.getZoneId());
}
}
for (String zoneId : param.getZoneIds()) {
if (!floorIds.contains(zoneId)) {
addFloorIds.add(zoneId);
}
}
if (!CollectionUtils.isEmpty(addFloorIds)) {
addFloors.addAll(this.imageRuleRefDao.listZoneInfoByIds(addFloorIds));
}
} else {
addFloors.addAll(this.imageRuleRefDao.listZoneInfoByIds(param.getZoneIds()));
}
if (!CollectionUtils.isEmpty(addFloors) || !CollectionUtils.isEmpty(delFloorIds)) {
String taskId = genUUID();
AcsDeviceTaskAddDto addDto = new AcsDeviceTaskAddDto();
addDto.setId(taskId);
addDto.setAllDevices(Integer.valueOf(addFloors.size() + delFloorIds.size()));
addDto.setBindDevices(Integer.valueOf(0));
addDto.setIsStop(Integer.valueOf(0));
this.acsDeviceTaskDao.insert(addDto);
param.setTaskId(taskId);
this.acsDeviceTaskService.updateFloors(param, addFloors, delFloorIds, context);
return CloudwalkResult.success(taskId);
}
return CloudwalkResult.success(null);
} catch (Exception e) {
this.logger.error("根人员批量绑定派梯楼层异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult<AcsDeviceTaskDTO> getTask(AcsDeviceRestructureTaskParam param, CloudwalkCallContext context)
throws ServiceException {
try {
return CloudwalkResult.success(this.acsDeviceTaskDao.getById(param.getTaskId()));
} catch (Exception e) {
this.logger.error("根据任务id查询任务详情异常,原因:", e);
throw new ServiceException(e);
}
}
public CloudwalkResult<Boolean> setTaskStop(AcsDeviceRestructureTaskParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsDeviceTaskAddDto dto = new AcsDeviceTaskAddDto();
dto.setId(param.getTaskId());
dto.setIsStop(Integer.valueOf(1));
this.acsDeviceTaskDao.updateIsStop(dto);
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (Exception e) {
this.logger.error("编辑任务进程异常,原因:", e);
throw new ServiceException(e);
}
}
private String addImageStore(AcsElevatorDeviceAddParam param, CloudwalkCallContext context)
throws ServiceException {
ImageStoreAddParam imageStoreAddParam = new ImageStoreAddParam();
String applicationId = this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId());
imageStoreAddParam.setName(param.getCurrentBuilding() + "-默认图库");
imageStoreAddParam.setType(Short.valueOf((short)1));
imageStoreAddParam.setSourceApplicationId(applicationId);
imageStoreAddParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<String> imageStoreId = this.imageStoreService.add(imageStoreAddParam, context);
if (!imageStoreId.isSuccess()) {
this.logger.info("远程调用新增图库失败,原因:" + imageStoreId.getMessage());
throw new ServiceException(imageStoreId.getCode(), imageStoreId.getMessage());
}
this.logger.info("远程调用新增图库出参:imageStoreId=[{}]", imageStoreId.getData());
DeviceImageStoreAppBindParam appBindParam = new DeviceImageStoreAppBindParam();
appBindParam.setImageStoreId((String)imageStoreId.getData());
appBindParam.setApplicationId(applicationId);
this.acsDeviceImageStoreAppBindService.bindAppImageStoreDevice(appBindParam, context);
try {
DeviceImageStoreAppBindParam bindParam = new DeviceImageStoreAppBindParam();
bindParam.setImageStoreId((String)imageStoreId.getData());
bindParam.setDeviceId(param.getDeviceId());
bindParam.setApplicationId(applicationId);
this.acsDeviceImageStoreAppBindService.bindDeviceAndImageStore(bindParam, context);
} catch (ServiceException e) {
this.logger.error("图库关联失败,图库id={},原因:{}", imageStoreId.getData(), e.getMessage());
ImageStoreDelParam delParam = new ImageStoreDelParam();
delParam.setId((String)imageStoreId.getData());
delParam.setBusinessId(context.getCompany().getCompanyId());
this.logger.info("回滚删除图库开始,delParam={},context={}", JSONObject.toJSON(delParam),
JSONObject.toJSON(context));
CloudwalkResult<Boolean> deleteResult = this.imageStoreService.delete(delParam, context);
this.logger.info("删除图库:图库id={},结果:{}", imageStoreId, deleteResult.getMessage());
throw new ServiceException(e.getCode(), e.getMessage());
}
return (String)imageStoreId.getData();
}
private List<DeviceResult> deviceFilter(List<DeviceResult> pageResult, CloudwalkCallContext context)
throws ServiceException {
List<AcsDeviceNewResult> acsDeviceNewResults = getAcsDeviceIds(context);
List<String> acsDeviceIds = (List<String>)acsDeviceNewResults.stream().map(AcsDeviceNewResult::getDeviceId)
.collect(Collectors.toList());
List<String> deviceIds =
(List<String>)pageResult.stream().map(DeviceResult::getId).collect(Collectors.toList());
List<String> newList = CollectionUtils.removeList(deviceIds, acsDeviceIds);
List<DeviceResult> newDeviceResultList = new ArrayList<>();
Map<String, DeviceResult> deviceResultMap =
(Map<String, DeviceResult>)pageResult.stream().collect(Collectors.toMap(DeviceResult::getId, d -> d));
for (String id : newList) {
newDeviceResultList.add(deviceResultMap.get(id));
}
return newDeviceResultList;
}
private List<AcsDeviceNewResult> getAcsDeviceIds(CloudwalkCallContext context) throws ServiceException {
List<AcsElevatorDeviceResultDTO> acsDeviceList;
List<AcsDeviceNewResult> acsDeviceNewResultList = new ArrayList<>();
AcsElevatorDeviceQueryDTO dto = new AcsElevatorDeviceQueryDTO();
dto.setBusinessId(context.getCompany().getCompanyId());
try {
acsDeviceList = this.acsElevatorDeviceDao.get(dto);
} catch (ServiceException e) {
throw new ServiceException("76260007", getMessage("76260007"));
}
Map<String, String> areaMap = getAllAreaMap(context);
if (CollectionUtils.isNotEmpty(acsDeviceList)) {
List<String> deviceIds = (List<String>)acsDeviceList.stream().map(AcsElevatorDeviceResultDTO::getDeviceId)
.collect(Collectors.toList());
DeviceQueryParam queryParam = new DeviceQueryParam();
queryParam.setIds(deviceIds);
queryParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<List<DeviceResult>> deviceResult = this.deviceService.list(queryParam, context);
if (deviceResult.isSuccess()) {
if (CollectionUtils.isNotEmpty((Collection)deviceResult.getData())) {
acsDeviceNewResultList =
convertDeviceNewResult((Collection<DeviceResult>)deviceResult.getData(), areaMap);
}
} else {
this.logger.error("查询设备信息列表失败,原因={}", deviceResult.getMessage());
throw new ServiceException("查询设备信息列表失败");
}
}
return acsDeviceNewResultList;
}
protected Map<String, String> getAllAreaMap(CloudwalkCallContext context) {
DeviceAreaTreeParam areaTreeParam = new DeviceAreaTreeParam();
areaTreeParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<List<AreaTreeResult>> areaTree = this.acsAreaTreeCacheableService.tree(areaTreeParam, context);
Map<String, String> areaMap = new HashMap<>();
getAreaMap((List<AreaTreeResult>)areaTree.getData(), areaMap);
return areaMap;
}
protected void getAreaMap(List<AreaTreeResult> areaTreeResultList, Map<String, String> areaMap) {
for (AreaTreeResult areaTree : areaTreeResultList) {
areaMap.put(areaTree.getId(), areaTree.getName());
if (areaTree.getChildren() != null) {
getAreaMap(areaTree.getChildren(), areaMap);
}
}
}
protected List<AcsDeviceNewResult> convertDeviceNewResult(Collection<DeviceResult> datas,
Map<String, String> areaMap) {
List<AcsDeviceNewResult> result = new ArrayList<>();
for (DeviceResult data : datas) {
AcsDeviceNewResult acsDeviceResult = new AcsDeviceNewResult();
BeanCopyUtils.copyProperties(data, acsDeviceResult);
acsDeviceResult.setId(data.getId());
acsDeviceResult.setDeviceId(data.getId());
acsDeviceResult.setDeviceStatus(Integer.valueOf(data.getStatus()));
acsDeviceResult.setDeviceOnlineStatus(Integer.valueOf(data.getOnlineStatus()));
acsDeviceResult.setAddress(getAddress(data));
acsDeviceResult.setAreaName(areaMap.get(data.getAreaId()));
result.add(acsDeviceResult);
}
return result;
}
protected String getAddress(DeviceResult data) {
StringBuffer sb = new StringBuffer();
if (StringUtils.isNotBlank(data.getDistrictMergeName())) {
sb.append(data.getDistrictMergeName());
}
if (StringUtils.isNotBlank(data.getAreaName())) {
sb.append(" ");
sb.append(data.getAreaName());
}
return sb.toString().trim();
}
private List<DeviceResult> page(List<AcsDeviceNewResult> dataList, int pageSize, int currentPage) {
List<DeviceResult> currentPageList = new ArrayList<>();
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++) {
AcsDeviceNewResult data = dataList.get(currIdx + i);
DeviceResult deviceResult = (DeviceResult)BeanCopyUtils.copyProperties(data, DeviceResult.class);
currentPageList.add(deviceResult);
}
}
return currentPageList;
}
}
@@ -0,0 +1,34 @@
package cn.cloudwalk.elevator.device.param;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
public class AcsDeviceQueryParam extends CloudwalkBasePageForm implements Serializable {
private String deviceName;
private String deviceCategoryId;
private String areaId;
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceCategoryId() {
return this.deviceCategoryId;
}
public void setDeviceCategoryId(String deviceCategoryId) {
this.deviceCategoryId = deviceCategoryId;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
}
@@ -0,0 +1,43 @@
package cn.cloudwalk.elevator.device.param;
import java.io.Serializable;
public class AcsDeviceRestructureTaskParam implements Serializable {
private static final long serialVersionUID = -7349123760464380004L;
private String taskId;
public String toString() {
return "AcsDeviceRestructureTaskParam(taskId=" + getTaskId() + ")";
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $taskId = getTaskId();
return result * 59 + (($taskId == null) ? 43 : $taskId.hashCode());
}
protected boolean canEqual(Object other) {
return other instanceof AcsDeviceRestructureTaskParam;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsDeviceRestructureTaskParam))
return false;
AcsDeviceRestructureTaskParam other = (AcsDeviceRestructureTaskParam)o;
if (!other.canEqual(this))
return false;
Object this$taskId = getTaskId(), other$taskId = other.getTaskId();
return !((this$taskId == null) ? (other$taskId != null) : !this$taskId.equals(other$taskId));
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTaskId() {
return this.taskId;
}
}
@@ -0,0 +1,157 @@
package cn.cloudwalk.elevator.device.param;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotEmpty;
public class AcsElevatorDeviceAddParam extends CloudwalkBaseTimes implements Serializable {
private String businessId;
@NotEmpty
private String deviceId;
@NotEmpty
private String deviceCode;
@NotNull
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
@NotNull
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaName;
private Integer status;
private Integer deleteFlag;
private String areaId;
private String elevatorFloorIdList;
public String getElevatorFloorIdList() {
return this.elevatorFloorIdList;
}
public void setElevatorFloorIdList(String elevatorFloorIdList) {
this.elevatorFloorIdList = elevatorFloorIdList;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDeleteFlag() {
return this.deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public String toString() {
return "AcsElevatorDeviceAddDTO{businessId='" + this.businessId + '\'' + ", deviceId='" + this.deviceId + '\''
+ ", deviceCode='" + this.deviceCode + '\'' + ", deviceName='" + this.deviceName + '\''
+ ", deviceTypeName='" + this.deviceTypeName + '\'' + ", elevatorFloorList='" + this.elevatorFloorList
+ '\'' + ", currentFloorId='" + this.currentFloorId + '\'' + ", currentFloor='" + this.currentFloor + '\''
+ ", currentBuilding='" + this.currentBuilding + '\'' + ", areaName='" + this.areaName + '\'' + ", status="
+ this.status + ", deleteFlag=" + this.deleteFlag + '}';
}
}
@@ -0,0 +1,123 @@
package cn.cloudwalk.elevator.device.param;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
public class AcsElevatorDeviceEditParam extends CloudwalkBaseTimes implements Serializable {
private String elevatorFloorList;
@NotNull
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaId;
private String elevatorFloorIdList;
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getElevatorFloorIdList() {
return this.elevatorFloorIdList;
}
public void setElevatorFloorIdList(String elevatorFloorIdList) {
this.elevatorFloorIdList = elevatorFloorIdList;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public String toString() {
return "AcsElevatorDeviceAddDTO{, elevatorFloorList='" + this.elevatorFloorList + '\'' + ", currentFloorId='"
+ this.currentFloorId + '\'' + ", currentFloor='" + this.currentFloor + '\'' + ", currentBuilding='"
+ this.currentBuilding + '\'' + '}';
}
}
@@ -0,0 +1,27 @@
package cn.cloudwalk.elevator.device.param;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
public class AcsElevatorDeviceListParam extends CloudwalkBaseTimes implements Serializable {
private String businessId;
@NotNull
private String currentFloorId;
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
}
@@ -0,0 +1,16 @@
package cn.cloudwalk.elevator.device.param;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
public class AcsElevatorDeviceQueryByIdParam extends CloudwalkBasePageForm implements Serializable {
private String id;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -0,0 +1,91 @@
package cn.cloudwalk.elevator.device.param;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.NotNull;
public class AcsElevatorDeviceQueryParam extends CloudwalkBasePageForm implements Serializable {
@NotNull
private String deviceName;
private String deviceTypeName;
private String areaName;
private String deviceId;
private String deviceCode;
private List<String> areaIds;
private Integer status;
private Integer onlineStatus;
private String ip;
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOnlineStatus() {
return this.onlineStatus;
}
public void setOnlineStatus(Integer onlineStatus) {
this.onlineStatus = onlineStatus;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public List<String> getAreaIds() {
return this.areaIds;
}
public void setAreaIds(List<String> areaIds) {
this.areaIds = areaIds;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
}
@@ -0,0 +1,143 @@
package cn.cloudwalk.elevator.device.param;
import java.io.Serializable;
import java.util.List;
public class AcsRestructureBindingParam implements Serializable {
private String parentId;
private String orgId;
private String orgName;
private String labelId;
private String labelName;
private String personId;
private List<String> zoneIds;
private String taskId;
public void setParentId(String parentId) {
this.parentId = parentId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public void setLabelId(String labelId) {
this.labelId = labelId;
}
public void setLabelName(String labelName) {
this.labelName = labelName;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public void setZoneIds(List<String> zoneIds) {
this.zoneIds = zoneIds;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsRestructureBindingParam))
return false;
AcsRestructureBindingParam other = (AcsRestructureBindingParam)o;
if (!other.canEqual(this))
return false;
Object this$parentId = getParentId(), other$parentId = other.getParentId();
if ((this$parentId == null) ? (other$parentId != null) : !this$parentId.equals(other$parentId))
return false;
Object this$orgId = getOrgId(), other$orgId = other.getOrgId();
if ((this$orgId == null) ? (other$orgId != null) : !this$orgId.equals(other$orgId))
return false;
Object this$orgName = getOrgName(), other$orgName = other.getOrgName();
if ((this$orgName == null) ? (other$orgName != null) : !this$orgName.equals(other$orgName))
return false;
Object this$labelId = getLabelId(), other$labelId = other.getLabelId();
if ((this$labelId == null) ? (other$labelId != null) : !this$labelId.equals(other$labelId))
return false;
Object this$labelName = getLabelName(), other$labelName = other.getLabelName();
if ((this$labelName == null) ? (other$labelName != null) : !this$labelName.equals(other$labelName))
return false;
Object this$personId = getPersonId(), other$personId = other.getPersonId();
if ((this$personId == null) ? (other$personId != null) : !this$personId.equals(other$personId))
return false;
Object<String> this$zoneIds = (Object<String>)getZoneIds(), other$zoneIds = (Object<String>)other.getZoneIds();
if ((this$zoneIds == null) ? (other$zoneIds != null) : !this$zoneIds.equals(other$zoneIds))
return false;
Object this$taskId = getTaskId(), other$taskId = other.getTaskId();
return !((this$taskId == null) ? (other$taskId != null) : !this$taskId.equals(other$taskId));
}
protected boolean canEqual(Object other) {
return other instanceof AcsRestructureBindingParam;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $parentId = getParentId();
result = result * 59 + (($parentId == null) ? 43 : $parentId.hashCode());
Object $orgId = getOrgId();
result = result * 59 + (($orgId == null) ? 43 : $orgId.hashCode());
Object $orgName = getOrgName();
result = result * 59 + (($orgName == null) ? 43 : $orgName.hashCode());
Object $labelId = getLabelId();
result = result * 59 + (($labelId == null) ? 43 : $labelId.hashCode());
Object $labelName = getLabelName();
result = result * 59 + (($labelName == null) ? 43 : $labelName.hashCode());
Object $personId = getPersonId();
result = result * 59 + (($personId == null) ? 43 : $personId.hashCode());
Object<String> $zoneIds = (Object<String>)getZoneIds();
result = result * 59 + (($zoneIds == null) ? 43 : $zoneIds.hashCode());
Object $taskId = getTaskId();
return result * 59 + (($taskId == null) ? 43 : $taskId.hashCode());
}
public String toString() {
return "AcsRestructureBindingParam(parentId=" + getParentId() + ", orgId=" + getOrgId() + ", orgName="
+ getOrgName() + ", labelId=" + getLabelId() + ", labelName=" + getLabelName() + ", personId="
+ getPersonId() + ", zoneIds=" + getZoneIds() + ", taskId=" + getTaskId() + ")";
}
public String getParentId() {
return this.parentId;
}
public String getOrgId() {
return this.orgId;
}
public String getOrgName() {
return this.orgName;
}
public String getLabelId() {
return this.labelId;
}
public String getLabelName() {
return this.labelName;
}
public String getPersonId() {
return this.personId;
}
public List<String> getZoneIds() {
return this.zoneIds;
}
public String getTaskId() {
return this.taskId;
}
}
@@ -0,0 +1,116 @@
package cn.cloudwalk.elevator.device.param;
import java.io.Serializable;
import java.util.List;
public class AcsRestructureQueryParam implements Serializable {
private String orgId;
private String labelId;
private List<String> labelIds;
private String personId;
private String zoneId;
private String businessId;
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public void setLabelId(String labelId) {
this.labelId = labelId;
}
public void setLabelIds(List<String> labelIds) {
this.labelIds = labelIds;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsRestructureQueryParam))
return false;
AcsRestructureQueryParam other = (AcsRestructureQueryParam)o;
if (!other.canEqual(this))
return false;
Object this$orgId = getOrgId(), other$orgId = other.getOrgId();
if ((this$orgId == null) ? (other$orgId != null) : !this$orgId.equals(other$orgId))
return false;
Object this$labelId = getLabelId(), other$labelId = other.getLabelId();
if ((this$labelId == null) ? (other$labelId != null) : !this$labelId.equals(other$labelId))
return false;
Object<String> this$labelIds = (Object<String>)getLabelIds(),
other$labelIds = (Object<String>)other.getLabelIds();
if ((this$labelIds == null) ? (other$labelIds != null) : !this$labelIds.equals(other$labelIds))
return false;
Object this$personId = getPersonId(), other$personId = other.getPersonId();
if ((this$personId == null) ? (other$personId != null) : !this$personId.equals(other$personId))
return false;
Object this$zoneId = getZoneId(), other$zoneId = other.getZoneId();
if ((this$zoneId == null) ? (other$zoneId != null) : !this$zoneId.equals(other$zoneId))
return false;
Object this$businessId = getBusinessId(), other$businessId = other.getBusinessId();
return !((this$businessId == null) ? (other$businessId != null) : !this$businessId.equals(other$businessId));
}
protected boolean canEqual(Object other) {
return other instanceof AcsRestructureQueryParam;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $orgId = getOrgId();
result = result * 59 + (($orgId == null) ? 43 : $orgId.hashCode());
Object $labelId = getLabelId();
result = result * 59 + (($labelId == null) ? 43 : $labelId.hashCode());
Object<String> $labelIds = (Object<String>)getLabelIds();
result = result * 59 + (($labelIds == null) ? 43 : $labelIds.hashCode());
Object $personId = getPersonId();
result = result * 59 + (($personId == null) ? 43 : $personId.hashCode());
Object $zoneId = getZoneId();
result = result * 59 + (($zoneId == null) ? 43 : $zoneId.hashCode());
Object $businessId = getBusinessId();
return result * 59 + (($businessId == null) ? 43 : $businessId.hashCode());
}
public String toString() {
return "AcsRestructureQueryParam(orgId=" + getOrgId() + ", labelId=" + getLabelId() + ", labelIds="
+ getLabelIds() + ", personId=" + getPersonId() + ", zoneId=" + getZoneId() + ", businessId="
+ getBusinessId() + ")";
}
public String getOrgId() {
return this.orgId;
}
public String getLabelId() {
return this.labelId;
}
public List<String> getLabelIds() {
return this.labelIds;
}
public String getPersonId() {
return this.personId;
}
public String getZoneId() {
return this.zoneId;
}
public String getBusinessId() {
return this.businessId;
}
}
@@ -0,0 +1,178 @@
package cn.cloudwalk.elevator.device.result;
import java.io.Serializable;
public class AcsDeviceNewResult implements Serializable {
private static final long serialVersionUID = -3535840233209237358L;
private String id;
private String deviceId;
private String deviceName;
private String deviceCode;
private String deviceTypeId;
private String deviceTypeCode;
private String deviceTypeName;
private Integer deviceStatus;
private Integer deviceOnlineStatus;
private String address;
private String imageStoreId;
private int identifyType;
private String areaId;
private String areaName;
private Long lastHeartbeatTime;
private Integer deviceOpenStatus;
private String deviceTypeCategoryId;
private String status;
private String onlineStatus;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceTypeId() {
return this.deviceTypeId;
}
public void setDeviceTypeId(String deviceTypeId) {
this.deviceTypeId = deviceTypeId;
}
public String getDeviceTypeCode() {
return this.deviceTypeCode;
}
public void setDeviceTypeCode(String deviceTypeCode) {
this.deviceTypeCode = deviceTypeCode;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public Integer getDeviceStatus() {
return this.deviceStatus;
}
public void setDeviceStatus(Integer deviceStatus) {
this.deviceStatus = deviceStatus;
}
public Integer getDeviceOnlineStatus() {
return this.deviceOnlineStatus;
}
public void setDeviceOnlineStatus(Integer deviceOnlineStatus) {
this.deviceOnlineStatus = deviceOnlineStatus;
}
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public int getIdentifyType() {
return this.identifyType;
}
public void setIdentifyType(int identifyType) {
this.identifyType = identifyType;
}
public Long getLastHeartbeatTime() {
return this.lastHeartbeatTime;
}
public void setLastHeartbeatTime(Long lastHeartbeatTime) {
this.lastHeartbeatTime = lastHeartbeatTime;
}
public Integer getDeviceOpenStatus() {
return this.deviceOpenStatus;
}
public void setDeviceOpenStatus(Integer deviceOpenStatus) {
this.deviceOpenStatus = deviceOpenStatus;
}
public String getDeviceTypeCategoryId() {
return this.deviceTypeCategoryId;
}
public void setDeviceTypeCategoryId(String deviceTypeCategoryId) {
this.deviceTypeCategoryId = deviceTypeCategoryId;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public String getOnlineStatus() {
return this.onlineStatus;
}
public void setOnlineStatus(String onlineStatus) {
this.onlineStatus = onlineStatus;
}
}
@@ -0,0 +1,99 @@
package cn.cloudwalk.elevator.device.result;
public class AcsDeviceRestructureResult {
private String parentId;
private String zoneId;
private String zoneName;
private String onlineDevices;
private String offlineDevices;
public void setParentId(String parentId) {
this.parentId = parentId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public void setOnlineDevices(String onlineDevices) {
this.onlineDevices = onlineDevices;
}
public void setOfflineDevices(String offlineDevices) {
this.offlineDevices = offlineDevices;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsDeviceRestructureResult))
return false;
AcsDeviceRestructureResult other = (AcsDeviceRestructureResult)o;
if (!other.canEqual(this))
return false;
Object this$parentId = getParentId(), other$parentId = other.getParentId();
if ((this$parentId == null) ? (other$parentId != null) : !this$parentId.equals(other$parentId))
return false;
Object this$zoneId = getZoneId(), other$zoneId = other.getZoneId();
if ((this$zoneId == null) ? (other$zoneId != null) : !this$zoneId.equals(other$zoneId))
return false;
Object this$zoneName = getZoneName(), other$zoneName = other.getZoneName();
if ((this$zoneName == null) ? (other$zoneName != null) : !this$zoneName.equals(other$zoneName))
return false;
Object this$onlineDevices = getOnlineDevices(), other$onlineDevices = other.getOnlineDevices();
if ((this$onlineDevices == null) ? (other$onlineDevices != null)
: !this$onlineDevices.equals(other$onlineDevices))
return false;
Object this$offlineDevices = getOfflineDevices(), other$offlineDevices = other.getOfflineDevices();
return !((this$offlineDevices == null) ? (other$offlineDevices != null)
: !this$offlineDevices.equals(other$offlineDevices));
}
protected boolean canEqual(Object other) {
return other instanceof AcsDeviceRestructureResult;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $parentId = getParentId();
result = result * 59 + (($parentId == null) ? 43 : $parentId.hashCode());
Object $zoneId = getZoneId();
result = result * 59 + (($zoneId == null) ? 43 : $zoneId.hashCode());
Object $zoneName = getZoneName();
result = result * 59 + (($zoneName == null) ? 43 : $zoneName.hashCode());
Object $onlineDevices = getOnlineDevices();
result = result * 59 + (($onlineDevices == null) ? 43 : $onlineDevices.hashCode());
Object $offlineDevices = getOfflineDevices();
return result * 59 + (($offlineDevices == null) ? 43 : $offlineDevices.hashCode());
}
public String toString() {
return "AcsDeviceRestructureResult(parentId=" + getParentId() + ", zoneId=" + getZoneId() + ", zoneName="
+ getZoneName() + ", onlineDevices=" + getOnlineDevices() + ", offlineDevices=" + getOfflineDevices() + ")";
}
public String getParentId() {
return this.parentId;
}
public String getZoneId() {
return this.zoneId;
}
public String getZoneName() {
return this.zoneName;
}
public String getOnlineDevices() {
return this.onlineDevices;
}
public String getOfflineDevices() {
return this.offlineDevices;
}
}
@@ -0,0 +1,208 @@
package cn.cloudwalk.elevator.device.result;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorDeviceListResult extends CloudwalkBaseTimes implements Serializable {
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaName;
private Integer status;
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public void setStatus(Integer status) {
this.status = status;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsElevatorDeviceListResult))
return false;
AcsElevatorDeviceListResult other = (AcsElevatorDeviceListResult)o;
if (!other.canEqual(this))
return false;
Object this$businessId = getBusinessId(), other$businessId = other.getBusinessId();
if ((this$businessId == null) ? (other$businessId != null) : !this$businessId.equals(other$businessId))
return false;
Object this$deviceId = getDeviceId(), other$deviceId = other.getDeviceId();
if ((this$deviceId == null) ? (other$deviceId != null) : !this$deviceId.equals(other$deviceId))
return false;
Object this$deviceCode = getDeviceCode(), other$deviceCode = other.getDeviceCode();
if ((this$deviceCode == null) ? (other$deviceCode != null) : !this$deviceCode.equals(other$deviceCode))
return false;
Object this$deviceName = getDeviceName(), other$deviceName = other.getDeviceName();
if ((this$deviceName == null) ? (other$deviceName != null) : !this$deviceName.equals(other$deviceName))
return false;
Object this$deviceTypeName = getDeviceTypeName(), other$deviceTypeName = other.getDeviceTypeName();
if ((this$deviceTypeName == null) ? (other$deviceTypeName != null)
: !this$deviceTypeName.equals(other$deviceTypeName))
return false;
Object this$elevatorFloorList = getElevatorFloorList(), other$elevatorFloorList = other.getElevatorFloorList();
if ((this$elevatorFloorList == null) ? (other$elevatorFloorList != null)
: !this$elevatorFloorList.equals(other$elevatorFloorList))
return false;
Object this$currentFloorId = getCurrentFloorId(), other$currentFloorId = other.getCurrentFloorId();
if ((this$currentFloorId == null) ? (other$currentFloorId != null)
: !this$currentFloorId.equals(other$currentFloorId))
return false;
Object this$currentFloor = getCurrentFloor(), other$currentFloor = other.getCurrentFloor();
if ((this$currentFloor == null) ? (other$currentFloor != null) : !this$currentFloor.equals(other$currentFloor))
return false;
Object this$currentBuilding = getCurrentBuilding(), other$currentBuilding = other.getCurrentBuilding();
if ((this$currentBuilding == null) ? (other$currentBuilding != null)
: !this$currentBuilding.equals(other$currentBuilding))
return false;
Object this$currentBuildingId = getCurrentBuildingId(), other$currentBuildingId = other.getCurrentBuildingId();
if ((this$currentBuildingId == null) ? (other$currentBuildingId != null)
: !this$currentBuildingId.equals(other$currentBuildingId))
return false;
Object this$areaName = getAreaName(), other$areaName = other.getAreaName();
if ((this$areaName == null) ? (other$areaName != null) : !this$areaName.equals(other$areaName))
return false;
Object this$status = getStatus(), other$status = other.getStatus();
return !((this$status == null) ? (other$status != null) : !this$status.equals(other$status));
}
protected boolean canEqual(Object other) {
return other instanceof AcsElevatorDeviceListResult;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $businessId = getBusinessId();
result = result * 59 + (($businessId == null) ? 43 : $businessId.hashCode());
Object $deviceId = getDeviceId();
result = result * 59 + (($deviceId == null) ? 43 : $deviceId.hashCode());
Object $deviceCode = getDeviceCode();
result = result * 59 + (($deviceCode == null) ? 43 : $deviceCode.hashCode());
Object $deviceName = getDeviceName();
result = result * 59 + (($deviceName == null) ? 43 : $deviceName.hashCode());
Object $deviceTypeName = getDeviceTypeName();
result = result * 59 + (($deviceTypeName == null) ? 43 : $deviceTypeName.hashCode());
Object $elevatorFloorList = getElevatorFloorList();
result = result * 59 + (($elevatorFloorList == null) ? 43 : $elevatorFloorList.hashCode());
Object $currentFloorId = getCurrentFloorId();
result = result * 59 + (($currentFloorId == null) ? 43 : $currentFloorId.hashCode());
Object $currentFloor = getCurrentFloor();
result = result * 59 + (($currentFloor == null) ? 43 : $currentFloor.hashCode());
Object $currentBuilding = getCurrentBuilding();
result = result * 59 + (($currentBuilding == null) ? 43 : $currentBuilding.hashCode());
Object $currentBuildingId = getCurrentBuildingId();
result = result * 59 + (($currentBuildingId == null) ? 43 : $currentBuildingId.hashCode());
Object $areaName = getAreaName();
result = result * 59 + (($areaName == null) ? 43 : $areaName.hashCode());
Object $status = getStatus();
return result * 59 + (($status == null) ? 43 : $status.hashCode());
}
public String toString() {
return "AcsElevatorDeviceListResult(businessId=" + getBusinessId() + ", deviceId=" + getDeviceId()
+ ", deviceCode=" + getDeviceCode() + ", deviceName=" + getDeviceName() + ", deviceTypeName="
+ getDeviceTypeName() + ", elevatorFloorList=" + getElevatorFloorList() + ", currentFloorId="
+ getCurrentFloorId() + ", currentFloor=" + getCurrentFloor() + ", currentBuilding=" + getCurrentBuilding()
+ ", currentBuildingId=" + getCurrentBuildingId() + ", areaName=" + getAreaName() + ", status="
+ getStatus() + ")";
}
public String getBusinessId() {
return this.businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public String getAreaName() {
return this.areaName;
}
public Integer getStatus() {
return this.status;
}
}
@@ -0,0 +1,115 @@
package cn.cloudwalk.elevator.device.result;
import java.io.Serializable;
public class AcsElevatorDeviceResult implements Serializable {
private static final long serialVersionUID = -90554404684210529L;
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaName;
private Integer status;
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
}
@@ -0,0 +1,58 @@
package cn.cloudwalk.elevator.device.result;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleLabelResultDto;
import java.util.List;
public class AcsLabelElevatorResult {
private String labelId;
private List<AcsPassRuleLabelResultDto> details;
public void setLabelId(String labelId) {
this.labelId = labelId;
}
public void setDetails(List<AcsPassRuleLabelResultDto> details) {
this.details = details;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsLabelElevatorResult))
return false;
AcsLabelElevatorResult other = (AcsLabelElevatorResult)o;
if (!other.canEqual(this))
return false;
Object this$labelId = getLabelId(), other$labelId = other.getLabelId();
if ((this$labelId == null) ? (other$labelId != null) : !this$labelId.equals(other$labelId))
return false;
Object<AcsPassRuleLabelResultDto> this$details = (Object<AcsPassRuleLabelResultDto>)getDetails(),
other$details = (Object<AcsPassRuleLabelResultDto>)other.getDetails();
return !((this$details == null) ? (other$details != null) : !this$details.equals(other$details));
}
protected boolean canEqual(Object other) {
return other instanceof AcsLabelElevatorResult;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $labelId = getLabelId();
result = result * 59 + (($labelId == null) ? 43 : $labelId.hashCode());
Object<AcsPassRuleLabelResultDto> $details = (Object<AcsPassRuleLabelResultDto>)getDetails();
return result * 59 + (($details == null) ? 43 : $details.hashCode());
}
public String toString() {
return "AcsLabelElevatorResult(labelId=" + getLabelId() + ", details=" + getDetails() + ")";
}
public String getLabelId() {
return this.labelId;
}
public List<AcsPassRuleLabelResultDto> getDetails() {
return this.details;
}
}
@@ -0,0 +1,68 @@
package cn.cloudwalk.elevator.device.result;
public class KeyValueResult {
private String key;
private Long time;
private String keyA;
public void setKey(String key) {
this.key = key;
}
public void setTime(Long time) {
this.time = time;
}
public void setKeyA(String keyA) {
this.keyA = keyA;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof KeyValueResult))
return false;
KeyValueResult other = (KeyValueResult)o;
if (!other.canEqual(this))
return false;
Object this$key = getKey(), other$key = other.getKey();
if ((this$key == null) ? (other$key != null) : !this$key.equals(other$key))
return false;
Object this$time = getTime(), other$time = other.getTime();
if ((this$time == null) ? (other$time != null) : !this$time.equals(other$time))
return false;
Object this$keyA = getKeyA(), other$keyA = other.getKeyA();
return !((this$keyA == null) ? (other$keyA != null) : !this$keyA.equals(other$keyA));
}
protected boolean canEqual(Object other) {
return other instanceof KeyValueResult;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $key = getKey();
result = result * 59 + (($key == null) ? 43 : $key.hashCode());
Object $time = getTime();
result = result * 59 + (($time == null) ? 43 : $time.hashCode());
Object $keyA = getKeyA();
return result * 59 + (($keyA == null) ? 43 : $keyA.hashCode());
}
public String toString() {
return "KeyValueResult(key=" + getKey() + ", time=" + getTime() + ", keyA=" + getKeyA() + ")";
}
public String getKey() {
return this.key;
}
public Long getTime() {
return this.time;
}
public String getKeyA() {
return this.keyA;
}
}
@@ -0,0 +1,13 @@
package cn.cloudwalk.elevator.device.service;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.elevator.device.param.AcsRestructureBindingParam;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageResultDto;
import java.util.List;
public interface AcsDeviceTaskService {
void updateFloors(AcsRestructureBindingParam paramAcsRestructureBindingParam,
List<AcsPassRuleImageResultDto> paramList, List<String> paramList1,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
}
@@ -0,0 +1,74 @@
package cn.cloudwalk.elevator.device.service;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceResult;
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.elevator.device.dto.AcsDeviceTaskDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryFoDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.device.param.AcsDeviceQueryParam;
import cn.cloudwalk.elevator.device.param.AcsDeviceRestructureTaskParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceAddParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceEditParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceQueryByIdParam;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceQueryParam;
import cn.cloudwalk.elevator.device.param.AcsRestructureBindingParam;
import cn.cloudwalk.elevator.device.param.AcsRestructureQueryParam;
import java.util.List;
public interface AcsElevatorDeviceService {
Integer add(AcsElevatorDeviceAddParam paramAcsElevatorDeviceAddParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
Integer edit(AcsElevatorDeviceEditParam paramAcsElevatorDeviceEditParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
Integer delete(List<String> paramList, CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
String getBuildingId(AcsElevatorDeviceQueryParam paramAcsElevatorDeviceQueryParam) throws ServiceException;
String getBusinessId(AcsElevatorDeviceQueryParam paramAcsElevatorDeviceQueryParam) throws ServiceException;
CloudwalkResult<CloudwalkPageAble<AcsElevatorDeviceResultDTO>> get(
AcsElevatorDeviceQueryParam paramAcsElevatorDeviceQueryParam, CloudwalkCallContext paramCloudwalkCallContext)
throws ServiceException;
CloudwalkResult<CloudwalkPageAble<DeviceResult>> devicePage(AcsDeviceQueryParam paramAcsDeviceQueryParam,
CloudwalkPageInfo paramCloudwalkPageInfo, CloudwalkCallContext paramCloudwalkCallContext)
throws ServiceException;
List<AcsElevatorDeviceQueryFoDTO> getFo(AcsElevatorDeviceQueryParam paramAcsElevatorDeviceQueryParam)
throws ServiceException;
AcsElevatorDeviceResultDTO getById(AcsElevatorDeviceQueryByIdParam paramAcsElevatorDeviceQueryByIdParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
AcsElevatorDeviceResultDTO getByDeciveCode(String paramString) throws ServiceException;
CloudwalkResult listUnbindFloors(AcsRestructureQueryParam paramAcsRestructureQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult listFloors(AcsRestructureQueryParam paramAcsRestructureQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult listCondition(AcsRestructureQueryParam paramAcsRestructureQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult listConditionByLabelIds(AcsRestructureQueryParam paramAcsRestructureQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<String> bindingFloors(AcsRestructureBindingParam paramAcsRestructureBindingParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<String> bindingPerson(AcsRestructureBindingParam paramAcsRestructureBindingParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<AcsDeviceTaskDTO> getTask(AcsDeviceRestructureTaskParam paramAcsDeviceRestructureTaskParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> setTaskStop(AcsDeviceRestructureTaskParam paramAcsDeviceRestructureTaskParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
}
@@ -0,0 +1,160 @@
package cn.cloudwalk.elevator.device.setting.impl;
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.DeviceImageStoreParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceImageStoreService;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreDelParam;
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.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.elevator.common.AbstractAcsDeviceService;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppBindParam;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppUnbindParam;
import cn.cloudwalk.elevator.device.setting.service.AcsDeviceImageStoreAppBindService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@Service
public class AcsDeviceImageStoreAppBindServiceImpl extends AbstractAcsDeviceService
implements AcsDeviceImageStoreAppBindService {
@Resource
private ApplicationImageStoreService applicationImageStoreService;
@Resource
private DeviceImageStoreService deviceImageStoreService;
@Resource
private ImageStoreService imageStoreService;
public CloudwalkResult<Boolean> bindAppImageStoreDevice(DeviceImageStoreAppBindParam param,
CloudwalkCallContext context) throws ServiceException {
bindApplicationImageStore(param, context);
return CloudwalkResult.success(Boolean.valueOf(true));
}
public CloudwalkResult<Boolean> bindDeviceAndImageStore(DeviceImageStoreAppBindParam param,
CloudwalkCallContext context) throws ServiceException {
try {
bindDeviceImageStore(param, context);
} catch (ServiceException e) {
this.logger.error("设备图库关联失败,图库id={},原因:{}", param.getImageStoreId(), e.getMessage());
throw new ServiceException("设备图库关联失败");
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
private void bindApplicationImageStore(DeviceImageStoreAppBindParam param, CloudwalkCallContext context)
throws ServiceException {
ApplicationImageStoreAddParam applicationImageStoreAddParam = new ApplicationImageStoreAddParam();
applicationImageStoreAddParam.setApplicationId(param.getApplicationId());
applicationImageStoreAddParam.setImageStoreId(param.getImageStoreId());
CloudwalkResult<Boolean> applicationImageStoreAddResult =
this.applicationImageStoreService.add(applicationImageStoreAddParam, context);
if (!applicationImageStoreAddResult.isSuccess()) {
this.logger.error("添加应用图库关联失败,原因:{}", applicationImageStoreAddResult.getMessage());
throw new ServiceException(applicationImageStoreAddResult.getCode(),
"添加应用图库关联失败,原因:" + applicationImageStoreAddResult.getMessage());
}
}
private void bindDeviceImageStore(DeviceImageStoreAppBindParam param, CloudwalkCallContext context)
throws ServiceException {
DeviceImageStoreParam imageStoreSaveParam = new DeviceImageStoreParam();
imageStoreSaveParam.setDeviceId(param.getDeviceId());
imageStoreSaveParam.setImageStoreId(param.getImageStoreId());
CloudwalkResult<Boolean> saveDeviceResult = this.deviceImageStoreService.add(imageStoreSaveParam, context);
if (!saveDeviceResult.isSuccess()) {
this.logger.error("绑定设备与图库失败,设备id={},图库id={},原因:{}",
new Object[] {param.getDeviceId(), param.getImageStoreId(), saveDeviceResult.getMessage()});
throw new ServiceException("绑定设备与图库失败");
}
}
public CloudwalkResult<Boolean> unbindAppImageStoreDevice(DeviceImageStoreAppUnbindParam param,
CloudwalkCallContext context) throws ServiceException {
deviceUnBindImageStore(context, param.getDeviceId(), param.getImageStoreId(), param.getDeviceCode());
applicationUnBindImageStore(param.getApplicationId(), param.getImageStoreId(), context);
List<ImageStoreListResult> imageStoreList =
getImageStoreResult(param.getImageStoreId(), param.getDeviceCode(), context);
if (!CollectionUtils.isEmpty(imageStoreList)) {
deleteImageStore(param.getImageStoreId(), context);
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
public CloudwalkResult<Boolean> deleteImageStore(DeviceImageStoreAppUnbindParam param, CloudwalkCallContext context)
throws ServiceException {
applicationUnBindImageStore(param.getApplicationId(), param.getImageStoreId(), context);
deleteImageStore(param.getImageStoreId(), context);
return CloudwalkResult.success(Boolean.valueOf(true));
}
public CloudwalkResult<Boolean> unbindAppImageStoreDeviceNotDeleteImage(DeviceImageStoreAppUnbindParam param,
CloudwalkCallContext context) throws ServiceException {
deviceUnBindImageStore(context, param.getDeviceId(), param.getImageStoreId(), param.getDeviceCode());
return CloudwalkResult.success(Boolean.valueOf(true));
}
private List<ImageStoreListResult> getImageStoreResult(String imageStoreId, String deviceCode,
CloudwalkCallContext context) throws ServiceException {
ImageStoreQueryParam imageStoreQueryParam = new ImageStoreQueryParam();
imageStoreQueryParam.setIds(Collections.singletonList(imageStoreId));
imageStoreQueryParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<List<ImageStoreListResult>> imageStoreList =
this.imageStoreService.list(imageStoreQueryParam, context);
if (!imageStoreList.isSuccess()) {
this.logger.error("查询设备图库失败,设备编号:{},图库id:{},原因:{}",
new Object[] {deviceCode, imageStoreId, imageStoreList.getMessage()});
throw new ServiceException("查询设备图库失败,设备编号:{}" + deviceCode);
}
return (List<ImageStoreListResult>)imageStoreList.getData();
}
private void deviceUnBindImageStore(CloudwalkCallContext context, String deviceId, String imageStoreId,
String deviceCode) throws ServiceException {
DeviceImageStoreParam deviceImageStoreParam = new DeviceImageStoreParam();
deviceImageStoreParam.setDeviceId(deviceId);
deviceImageStoreParam.setImageStoreId(imageStoreId);
CloudwalkResult<Boolean> deleteDeviceImageStoreResult =
this.deviceImageStoreService.delete(deviceImageStoreParam, context);
this.logger.info("删除设备图库关联:图库id={},结果:{}", imageStoreId, deleteDeviceImageStoreResult.getMessage());
if (!deleteDeviceImageStoreResult.isSuccess()) {
this.logger.error("删除设备图库关联失败,设备编号:{},图库id:{},原因:{}",
new Object[] {deviceCode, imageStoreId, deleteDeviceImageStoreResult.getMessage()});
throw new ServiceException("删除设备图库关联失败,设备编号:" + deviceCode);
}
}
private void deleteImageStore(String imageStoreId, CloudwalkCallContext context) throws ServiceException {
ImageStoreDelParam imageStoreDelParam = new ImageStoreDelParam();
imageStoreDelParam.setId(imageStoreId);
imageStoreDelParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<Boolean> deleteImageStoreResult = this.imageStoreService.delete(imageStoreDelParam, context);
if (!deleteImageStoreResult.isSuccess()) {
this.logger.error("删除图库失败,图库id:{},原因:{}", imageStoreId, deleteImageStoreResult.getMessage());
throw new ServiceException("删除图库失败");
}
}
public void applicationUnBindImageStore(String applicationId, String imageStoreId, CloudwalkCallContext context)
throws ServiceException {
ApplicationImageStoreDelParam applicationImageStoreDelParam = new ApplicationImageStoreDelParam();
applicationImageStoreDelParam.setApplicationId(applicationId);
applicationImageStoreDelParam.setImageStoreId(imageStoreId);
CloudwalkResult<Boolean> deleteApplicationImageStoreResult =
this.applicationImageStoreService.delete(applicationImageStoreDelParam, context);
this.logger.info("删除应用图库关联:图库id={},应用id={},结果:{}",
new Object[] {imageStoreId, applicationId, deleteApplicationImageStoreResult.getMessage()});
if (!deleteApplicationImageStoreResult.isSuccess()) {
this.logger.error("应用与图库解绑失败,应用id:{},图库id:{},原因:{}",
new Object[] {applicationId, imageStoreId, deleteApplicationImageStoreResult.getMessage()});
throw new ServiceException("应用与图库解绑失败");
}
}
}
@@ -0,0 +1,74 @@
package cn.cloudwalk.elevator.device.setting.impl;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.param.DeviceSettingQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceSettingResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.service.DeviceSettingService;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.elevator.common.AbstractAcsDeviceService;
import cn.cloudwalk.elevator.device.setting.param.AcsDeviceTemperatureSettingParam;
import cn.cloudwalk.elevator.device.setting.result.AcsDeviceSettingResult;
import cn.cloudwalk.elevator.device.setting.result.AcsSettingAttr;
import cn.cloudwalk.elevator.device.setting.service.AcsDeviceSettingService;
import cn.cloudwalk.elevator.em.AcsDeviceSettingEnum;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AcsDeviceSettingServiceImpl extends AbstractAcsDeviceService implements AcsDeviceSettingService {
@Autowired
private DeviceSettingService deviceSettingService;
public CloudwalkResult<AcsDeviceSettingResult> getTemperatureSetting(AcsDeviceTemperatureSettingParam param,
CloudwalkCallContext context) throws ServiceException {
AcsDeviceSettingResult result = new AcsDeviceSettingResult();
result.setDeviceId(param.getDeviceId());
DeviceSettingQueryParam deviceSettingQueryParam = new DeviceSettingQueryParam();
deviceSettingQueryParam.setDeviceIds(Lists.newArrayList((Object[])new String[] {param.getDeviceId()}));
deviceSettingQueryParam.setHasDefault(Short.valueOf((short)0));
CloudwalkResult<List<DeviceSettingResult>> deviceSettingQueryResult =
this.deviceSettingService.query(deviceSettingQueryParam);
if (deviceSettingQueryResult.isSuccess()) {
if (CollectionUtils.isNotEmpty((Collection)deviceSettingQueryResult.getData())) {
DeviceSettingResult deviceSettingResult =
((List<DeviceSettingResult>)deviceSettingQueryResult.getData()).get(0);
List<DeviceSettingResult.DeviceSettings> settingResult = deviceSettingResult.getSettings();
if (CollectionUtils.isNotEmpty(settingResult)) {
List<AcsSettingAttr> acsSettingAttrs = new ArrayList<>();
recursionSettingAttr(acsSettingAttrs, settingResult);
List<AcsSettingAttr> attrs = (List<AcsSettingAttr>)acsSettingAttrs.stream()
.filter(s -> (AcsDeviceSettingEnum.TEMP_MIN.getCode().equals(s.getCode())
|| AcsDeviceSettingEnum.TEMP_STATE.getCode().equals(s.getCode())
|| AcsDeviceSettingEnum.TEMP_THRESHOLD.getCode().equals(s.getCode())))
.collect(Collectors.toList());
result.setAttrs(attrs);
}
}
return CloudwalkResult.success(result);
}
return CloudwalkResult.fail(deviceSettingQueryResult.getCode(), deviceSettingQueryResult.getMessage());
}
private void recursionSettingAttr(List<AcsSettingAttr> acsSettingAttrs,
List<DeviceSettingResult.DeviceSettings> deviceSettings) {
if (CollectionUtils.isNotEmpty(deviceSettings))
for (DeviceSettingResult.DeviceSettings deviceSetting : deviceSettings) {
AcsSettingAttr acsSettingAttr = new AcsSettingAttr();
acsSettingAttr.setName(deviceSetting.getSettingAttrName());
acsSettingAttr.setValue(deviceSetting.getSettingAttrValue());
acsSettingAttr.setRemark(deviceSetting.getSettingAttrRemark());
acsSettingAttr.setCode(deviceSetting.getSettingAttrCode());
acsSettingAttr.setId(deviceSetting.getId());
acsSettingAttr.setParentId(deviceSetting.getSettingParentId());
acsSettingAttrs.add(acsSettingAttr);
recursionSettingAttr(acsSettingAttrs, deviceSetting.getChild());
}
}
}
@@ -0,0 +1,17 @@
package cn.cloudwalk.elevator.device.setting.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsDeviceTemperatureSettingParam implements Serializable {
@NotBlank(message = "76260003")
private String deviceId;
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
}
@@ -0,0 +1,34 @@
package cn.cloudwalk.elevator.device.setting.param;
import java.io.Serializable;
public class DeviceImageStoreAppBindParam implements Serializable {
private static final long serialVersionUID = -5165610910023828727L;
private String applicationId;
private String imageStoreId;
private String deviceId;
public String getApplicationId() {
return this.applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
}
@@ -0,0 +1,42 @@
package cn.cloudwalk.elevator.device.setting.param;
import java.io.Serializable;
public class DeviceImageStoreAppUnbindParam implements Serializable {
private String applicationId;
private String imageStoreId;
private String deviceId;
private String deviceCode;
public String getApplicationId() {
return this.applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
}
@@ -0,0 +1,26 @@
package cn.cloudwalk.elevator.device.setting.result;
import java.io.Serializable;
import java.util.List;
public class AcsDeviceSettingResult implements Serializable {
private static final long serialVersionUID = -6934487366934322212L;
private String deviceId;
private List<AcsSettingAttr> attrs;
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public List<AcsSettingAttr> getAttrs() {
return this.attrs;
}
public void setAttrs(List<AcsSettingAttr> attrs) {
this.attrs = attrs;
}
}
@@ -0,0 +1,61 @@
package cn.cloudwalk.elevator.device.setting.result;
import java.io.Serializable;
public class AcsSettingAttr implements Serializable {
private static final long serialVersionUID = 1670487736253830287L;
private String name;
private String value;
private String remark;
private String code;
private String id;
private String parentId;
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
public String getRemark() {
return this.remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
}
@@ -0,0 +1,26 @@
package cn.cloudwalk.elevator.device.setting.service;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppBindParam;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppUnbindParam;
public interface AcsDeviceImageStoreAppBindService {
CloudwalkResult<Boolean> bindAppImageStoreDevice(DeviceImageStoreAppBindParam paramDeviceImageStoreAppBindParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> bindDeviceAndImageStore(DeviceImageStoreAppBindParam paramDeviceImageStoreAppBindParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> unbindAppImageStoreDevice(
DeviceImageStoreAppUnbindParam paramDeviceImageStoreAppUnbindParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> deleteImageStore(DeviceImageStoreAppUnbindParam paramDeviceImageStoreAppUnbindParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> unbindAppImageStoreDeviceNotDeleteImage(
DeviceImageStoreAppUnbindParam paramDeviceImageStoreAppUnbindParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
}
@@ -0,0 +1,13 @@
package cn.cloudwalk.elevator.device.setting.service;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.elevator.device.setting.param.AcsDeviceTemperatureSettingParam;
import cn.cloudwalk.elevator.device.setting.result.AcsDeviceSettingResult;
public interface AcsDeviceSettingService {
CloudwalkResult<AcsDeviceSettingResult> getTemperatureSetting(
AcsDeviceTemperatureSettingParam paramAcsDeviceTemperatureSettingParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
}
@@ -0,0 +1,12 @@
package cn.cloudwalk.elevator.downloadcenter;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.elevator.downloadcenter.param.AcsFileFinishParam;
public interface AcsDownloadCenterService {
String createDownload(String paramString, CloudwalkCallContext paramCloudwalkCallContext);
boolean finishDownload(AcsFileFinishParam paramAcsFileFinishParam, CloudwalkCallContext paramCloudwalkCallContext);
int queryDownloadStatus(String paramString, CloudwalkCallContext paramCloudwalkCallContext);
}
@@ -0,0 +1,81 @@
package cn.cloudwalk.elevator.downloadcenter.impl;
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.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
import cn.cloudwalk.elevator.common.AbstractCloudwalkService;
import cn.cloudwalk.elevator.common.service.AcsApplicationService;
import cn.cloudwalk.elevator.config.FeignThreadLocalUtil;
import cn.cloudwalk.elevator.downloadcenter.AcsDownloadCenterService;
import cn.cloudwalk.elevator.downloadcenter.param.AcsFileFinishParam;
import cn.cloudwalk.elevator.export.AcsFileStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AcsDownloadCenterServiceImpl extends AbstractCloudwalkService implements AcsDownloadCenterService {
@Autowired
private FileService fileService;
@Autowired
private AcsApplicationService acsApplicationService;
public String createDownload(String fileName, CloudwalkCallContext context) {
try {
FileInitParam fileInitParam = new FileInitParam();
fileInitParam.setFileName(fileName);
context.setApplicationId(this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId()));
fileInitParam.setApplicationId(context.getApplicationId());
FeignThreadLocalUtil.setRequestHeader(context);
CloudwalkResult<String> result = this.fileService.init(fileInitParam, context);
if ("00000000".equals(result.getCode())) {
return (String)result.getData();
}
this.logger.error("下载任务初始化失败:code={},message={}", result.getCode(), result.getMessage());
throw new RuntimeException("下载任务创建失败!");
} catch (ServiceException e) {
this.logger.error("下载任务初始化接口错误", (Throwable)e);
throw new RuntimeException("下载任务创建失败!");
} finally {
FeignThreadLocalUtil.remove();
}
}
public boolean finishDownload(AcsFileFinishParam param, CloudwalkCallContext context) {
try {
FeignThreadLocalUtil.setRequestHeader(context);
FileFinishParam fileFinishParam =
(FileFinishParam)BeanCopyUtils.copyProperties(param, FileFinishParam.class);
CloudwalkResult<Boolean> result = this.fileService.finish(fileFinishParam, context);
if ("00000000".equals(result.getCode())) {
return true;
}
this.logger.error("下载任务完成失败:code={},message={}", result.getCode(), result.getMessage());
} catch (ServiceException e) {
this.logger.error("下载任务完成接口错误", (Throwable)e);
} finally {
FeignThreadLocalUtil.remove();
}
return false;
}
public int queryDownloadStatus(String fileId, CloudwalkCallContext context) {
try {
FileGetParam fileGetParam = new FileGetParam();
fileGetParam.setFileId(fileId);
CloudwalkResult<FileDetail> result = this.fileService.get(fileGetParam, context);
if ("00000000".equals(result.getCode())) {
return ((FileDetail)result.getData()).getStatus().intValue();
}
this.logger.error("下载任务初始化失败:code={},message={}", result.getCode(), result.getMessage());
} catch (ServiceException e) {
this.logger.error("下载任务完成接口错误", (Throwable)e);
}
return AcsFileStatusEnum.PRODUCING.getCode().intValue();
}
}
@@ -0,0 +1,61 @@
package cn.cloudwalk.elevator.downloadcenter.param;
import java.io.Serializable;
public class AcsFileFinishParam implements Serializable {
private static final long serialVersionUID = 4334332744642479052L;
private String fileId;
private Long fileSize;
private String filePath;
private Integer fileStatus;
private String errorCode;
private String errorMessage;
public String getFileId() {
return this.fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public Long getFileSize() {
return this.fileSize;
}
public void setFileSize(Long fileSize) {
this.fileSize = fileSize;
}
public String getFilePath() {
return this.filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public Integer getFileStatus() {
return this.fileStatus;
}
public void setFileStatus(Integer fileStatus) {
this.fileStatus = fileStatus;
}
public String getErrorCode() {
return this.errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return this.errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}
@@ -0,0 +1,539 @@
package cn.cloudwalk.elevator.export;
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.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.elevator.common.AbstractCloudwalkService;
import cn.cloudwalk.elevator.config.FeignThreadLocalUtil;
import cn.cloudwalk.elevator.downloadcenter.AcsDownloadCenterService;
import cn.cloudwalk.elevator.downloadcenter.param.AcsFileFinishParam;
import cn.cloudwalk.elevator.export.utils.ExcelUtil;
import cn.cloudwalk.elevator.storage.AcsFileStorageService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.util.DateUtils;
import cn.cloudwalk.elevator.util.StringUtils;
import cn.cloudwalk.intelligent.davinci.common.exception.DavinciServiceException;
import cn.cloudwalk.intelligent.davinci.storage.bean.file.dto.FileRemoveDTO;
import cn.cloudwalk.intelligent.davinci.storage.manager.FileStorageManager;
import cn.cloudwalk.intelligent.lock.annotation.RequiredLock;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
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;
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 AcsAbstractExportAsyncService<T, R> extends AbstractCloudwalkService {
protected static final Logger LOGGER = LoggerFactory.getLogger(AcsAbstractExportAsyncService.class);
private static final Integer FILE_PART_BATCH_SIZE = Integer.valueOf(5242881);
@Value("${cloudwalk.access-control.export-max-record:1000}")
private long EXPORT_MAX_RECORD;
@Autowired
private AcsFileStorageService acsFileStorageService;
@Autowired
private AcsDownloadCenterService acsDownloadCenterService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Autowired
private FileStorageManager fileStorageManager;
@RequiredLock(
name = "T(cn.cloudwalk.elevator.config.AcsLockConstants).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 = "acs_export_prefix:#" + context.getCompany().getCompanyId();
try {
String taskId = (String)this.redisTemplate.opsForValue().get(cacheKey);
if (StringUtils.isNotBlank(taskId)) {
return CloudwalkResult.fail("76260308", getMessage("76260308"));
}
String exportFileName = StringUtils.isNotBlank(fileName) ? fileName : getDefaultFileName();
ExportRecordContext.Builder builder = new ExportRecordContext.Builder();
ExportRecordContext exportRecordContext = builder.withFileName(exportFileName)
.withTaskStatus(AcsFileStatusEnum.PRODUCING.getCode().intValue()).build();
CompletableFuture.runAsync(() -> {
try {
String fileId = this.acsDownloadCenterService.createDownload(exportFileName, context);
this.redisTemplate.opsForValue().set(cacheKey, fileId, 5L, TimeUnit.MINUTES);
exportRecordContext.setFileId(fileId);
} catch (Exception e) {
LOGGER.info("导出时,初始化导出任务失败,原因:", e);
this.redisTemplate.delete(cacheKey);
throw new CompletionException(e);
}
}).thenAccept(n -> {
try {
export((T)param, clazz, exportRecordContext, (ExcelCallback)null, context);
} catch (Exception e) {
LOGGER.info("导出时异常,原因=[{}]", e.getMessage(), e);
throw new CompletionException(e);
} finally {
FeignThreadLocalUtil.remove();
this.redisTemplate.delete(cacheKey);
}
}).whenComplete((n, e) -> {
if (null != e) {
LOGGER.error("异步导出任务运行失败,原因:", e);
AcsFileFinishParam fileFinishParam = new AcsFileFinishParam();
if (e.getCause() instanceof ServiceException) {
ServiceException serviceException = (ServiceException)e.getCause();
fileFinishParam.setErrorCode(serviceException.getCode());
fileFinishParam.setErrorMessage(serviceException.getMessage());
} else {
fileFinishParam.setErrorCode("76260000");
fileFinishParam.setErrorMessage(getMessage("76260000"));
}
fileFinishParam.setFileId(exportRecordContext.getFileId());
fileFinishParam.setFileStatus(AcsFileStatusEnum.FAIL.getCode());
this.acsDownloadCenterService.finishDownload(fileFinishParam, context);
} else if (AcsFileStatusEnum.CANCELED.getCode().intValue() != exportRecordContext.getTaskStatus()) {
LOGGER.info("异步导出成功。[{}]", exportRecordContext.toString());
AcsFileFinishParam fileFinishParam = new AcsFileFinishParam();
fileFinishParam.setFileId(exportRecordContext.getFileId());
fileFinishParam.setFilePath(exportRecordContext.getFilePath());
fileFinishParam.setFileSize(exportRecordContext.getFileSize());
fileFinishParam.setFileStatus(AcsFileStatusEnum.FINISH.getCode());
this.acsDownloadCenterService.finishDownload(fileFinishParam, context);
} else if (StringUtils.isNotBlank(exportRecordContext.getFilePath())) {
FileRemoveDTO fileRemoveDTO = new FileRemoveDTO();
fileRemoveDTO
.setFileList(Lists.newArrayList((Object[])new String[] {exportRecordContext.getFilePath()}));
try {
this.fileStorageManager.remove(fileRemoveDTO);
} catch (DavinciServiceException e1) {
this.logger.error("删除文件失败,fileId=[{}],原因:", exportRecordContext.getFileId(), e1);
}
}
});
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (Exception e) {
this.logger.error("异步导出任务异常,原因:", e);
throw new ServiceException(e);
}
}
private void export(T param, Class<R> clazz, ExportRecordContext exportRecordContext, ExcelCallback callback,
CloudwalkCallContext context) throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
String sheetName = exportRecordContext.getFileName();
FeignThreadLocalUtil.setRequestHeader(context);
int startPage = 1;
int pageSize = 100;
long maxPageSize = this.EXPORT_MAX_RECORD / 100L;
PageInfo pageInfo = new PageInfo();
List<R> list = getList(param, context, startPage, 100, pageInfo);
Long totalRows = Long.valueOf(pageInfo.getTotal());
Long totalPages = Long.valueOf(pageInfo.getPages());
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
int sheetSize = 65536;
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
for (Field field : allFields) {
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (attr != null && attr.isExport()) {
fields.add(field);
}
}
long listSize =
(this.EXPORT_MAX_RECORD < totalRows.longValue()) ? this.EXPORT_MAX_RECORD : totalRows.longValue();
int startRow = 0;
int sheetNo = (int)listSize / sheetSize;
for (int index = 0; index <= sheetNo; index++) {
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(index, sheetName + index);
ExcelUtil.createRowHeard(sheet, fields, workbook, startRow);
while (true) {
if (isCancelDownload(exportRecordContext, context)) {
output.close();
return;
}
if (CollectionUtils.isEmpty(list)) {
list = getList(param, context, startPage, 100, pageInfo);
}
createRowContent(sheet, fields, workbook, list, (startPage - 1) * 100,
(startPage - 1) * 100 + list.size(), startRow + 1);
if (null != callback) {
callback.call(workbook, sheet);
}
startPage++;
if (startPage > totalPages.longValue() || startPage > maxPageSize) {
break;
}
list = new ArrayList<>();
}
}
output.flush();
workbook.write(output);
output.close();
byte[] fileByte = output.toByteArray();
exportRecordContext.setFileSize(Long.valueOf(fileByte.length));
String filePath =
fileStore(exportRecordContext.getFileName() + ".xls", fileByte, exportRecordContext, context);
exportRecordContext.setFilePath(filePath);
} catch (Exception e) {
throw new Exception("将list数据源的数据导入到excel表单异常!", e);
}
}
private boolean isCancelDownload(ExportRecordContext exportRecordContext, CloudwalkCallContext context) {
int taskStatus = this.acsDownloadCenterService.queryDownloadStatus(exportRecordContext.getFileId(), context);
if (AcsFileStatusEnum.CANCELED.getCode().intValue() == taskStatus) {
this.logger.info("导出任务已取消,fileID=[{}]", exportRecordContext.getFileId());
exportRecordContext.setTaskStatus(taskStatus);
return true;
}
return false;
}
private ArrayList<R> getList(T param, CloudwalkCallContext context, int startPage, int pageSize, PageInfo pageInfo)
throws ServiceException {
CloudwalkPageInfo cloudwalkPageInfo = new CloudwalkPageInfo(startPage, pageSize);
CloudwalkPageAble<R> dataPage = queryPage(param, cloudwalkPageInfo, context);
pageInfo.setTotal(dataPage.getTotalRows());
pageInfo.setPages((int)dataPage.getTotalPages());
return Lists.newArrayList(dataPage.getDatas());
}
private int getColumnSize(Class clazz) {
Field[] allFields = clazz.getDeclaredFields();
int size = 0;
for (Field field : allFields) {
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (attr != null && attr.isExport()) {
size++;
}
}
return size;
}
private 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);
}
private String fileStore(String fileName, byte[] bytes, ExportRecordContext exportRecordContext,
CloudwalkCallContext context) throws ServiceException {
int size = bytes.length;
LOGGER.info("文件大小为: {}", Integer.valueOf(size));
FilePartInitParam param = new FilePartInitParam();
param.setFileName(fileName);
LOGGER.info("文件分片初始化开始");
CloudwalkResult<FilePartResult> result = this.acsFileStorageService.filePartInit(param);
if (result.isSuccess()) {
LOGGER.info("文件分片初始化结束,uploadId = {}, filePath = {}", ((FilePartResult)result.getData()).getUploadId(),
((FilePartResult)result.getData()).getFilePath());
FilePartResult filePartResult = (FilePartResult)result.getData();
int times = 0;
while (true) {
if (isCancelDownload(exportRecordContext, context)) {
return ((FilePartResult)result.getData()).getFilePath();
}
int start = times++ * FILE_PART_BATCH_SIZE.intValue();
int end =
(start + FILE_PART_BATCH_SIZE.intValue() > size) ? size : (start + FILE_PART_BATCH_SIZE.intValue());
byte[] trunk = Arrays.copyOfRange(bytes, start, end);
LOGGER.info("第{}个分片开始追加,uploadId = {}, filePath = {}, size ; {}", new Object[] {Integer.valueOf(times),
filePartResult.getUploadId(), filePartResult.getFilePath(), Integer.valueOf(trunk.length)});
FilePartAppendParam<byte[]> appendParam = new FilePartAppendParam();
appendParam.setFilePath(filePartResult.getFilePath());
appendParam.setPartNumber(Integer.valueOf(times));
appendParam.setUploadId(filePartResult.getUploadId());
appendParam.setContent(trunk);
this.acsFileStorageService.filePartAppend(appendParam);
LOGGER.info("第{}个分片完成追加,uploadId = {}, filePath = {}",
new Object[] {Integer.valueOf(times), filePartResult.getUploadId(), filePartResult.getFilePath()});
if (end >= size) {
LOGGER.info("追加完成,准备结束,uploadId = {}, filePath = {}", filePartResult.getUploadId(),
filePartResult.getFilePath());
FilePartFinishParam finishParam = new FilePartFinishParam();
finishParam.setFilePath(filePartResult.getFilePath());
finishParam.setUploadId(filePartResult.getUploadId());
finishParam.setFileSize(Long.valueOf(size));
finishParam.setReturnType(Integer.valueOf(1));
CloudwalkResult<String> finishResult = this.acsFileStorageService.filePartFinish(finishParam);
LOGGER.info("结束完成,uploadId = {}, filePath = {}, finishFilePath = {}", new Object[] {
filePartResult.getUploadId(), filePartResult.getFilePath(), finishResult.getData()});
if (finishResult.isSuccess()) {
return ((String)finishResult.getData()).split("=")[1];
}
}
}
}
throw new ServiceException(result.getCode(), result.getMessage());
}
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(new ThreadPoolExecutor.AbortPolicy());
return executor;
}
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 AcsAbstractExportAsyncService.ExportRecordContext build() {
AcsAbstractExportAsyncService.ExportRecordContext context =
new AcsAbstractExportAsyncService.ExportRecordContext();
context.setFileId(this.fileId);
context.setFileSize(this.fileSize);
context.setFilePath(this.filePath);
context.setFileName(this.fileName);
context.setTaskStatus(this.taskStatus);
return context;
}
}
}
private static class Builder {
private String fileId;
private String filePath;
public AcsAbstractExportAsyncService.ExportRecordContext build() {
AcsAbstractExportAsyncService.ExportRecordContext context =
new AcsAbstractExportAsyncService.ExportRecordContext();
context.setFileId(this.fileId);
context.setFileSize(this.fileSize);
context.setFilePath(this.filePath);
context.setFileName(this.fileName);
context.setTaskStatus(this.taskStatus);
return context;
}
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;
}
}
private <T> void createRowContent(HSSFSheet sheet, List<Field> fields, HSSFWorkbook workbook, List<T> list,
int startNo, int endNo, int rowIndex) throws Exception {
String value = null;
int hwPicType = 0;
byte[] picByte = null;
int listIndex = 0;
for (int i = startNo; i < endNo; i++) {
HSSFRow row = sheet.createRow(i + 1);
T vo = list.get(listIndex);
listIndex++;
for (int j = 0; j < fields.size(); j++) {
Field field = fields.get(j);
field.setAccessible(true);
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
int col = j;
if (StringUtils.isNotBlank(attr.column())) {
col = ExcelUtil.getExcelCol(attr.column());
}
if (attr.isExport()) {
HSSFCell cell = row.createCell(col);
Class<?> classType = field.getType();
if (field.get(vo) != null) {
value = null;
if (classType.isAssignableFrom(Date.class)) {
value = DateUtils.formatDate((Date)field.get(vo), "yyyy-MM-dd HH:mm:ss");
}
if (classType.isAssignableFrom(Long.class) && attr.isDate()) {
value = DateUtils.formatDate(new Date(((Long)field.get(vo)).longValue()),
"yyyy-MM-dd HH:mm:ss");
}
if (attr.isPic()) {
try {
if (field.getType().equals(String.class)) {
picByte = ExcelUtil.getBytesByUrl((String)field.get(vo));
}
picByte = (byte[])field.get(vo);
} catch (Exception exception) {
}
hwPicType = 5;
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 1020, 250, (short)col, row.getRowNum(),
(short)col, row.getRowNum());
patriarch.createPicture(anchor, workbook.addPicture(picByte, hwPicType));
row.setHeight((short)1000);
} else {
cell.setCellValue((field.get(vo) == null) ? ""
: ((value == null) ? String.valueOf(field.get(vo)) : value));
}
}
}
}
}
}
public CloudwalkResult<Long> exportCount() throws ServiceException {
try {
return CloudwalkResult.success(Long.valueOf(this.EXPORT_MAX_RECORD));
} catch (Exception e) {
this.logger.error("获取最大导出记录失败", e);
throw new ServiceException(e);
}
}
protected abstract CloudwalkPageAble<R> queryPage(T paramT, CloudwalkPageInfo paramCloudwalkPageInfo,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
protected abstract CloudwalkResult<String> createLocalFile(T paramT, String paramString,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
protected abstract String getDefaultFileName();
protected abstract String getDefaultFileTitleName();
}
@@ -0,0 +1,31 @@
package cn.cloudwalk.elevator.export;
public enum AcsFileStatusEnum {
FINISH(Integer.valueOf(0), "已完成"), PRODUCING(Integer.valueOf(1), "生成中"), DELETED(Integer.valueOf(2), "已删除"),
CANCELED(Integer.valueOf(3), "已取消"), EXPIRED(Integer.valueOf(4), "已过期"), FAIL(Integer.valueOf(5), "失败");
private Integer code;
private String message;
AcsFileStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static AcsFileStatusEnum getEnumByCode(Integer code) {
for (AcsFileStatusEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,24 @@
package cn.cloudwalk.elevator.export;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface ExcelAttribute {
String name();
String column() default "";
String[] combo() default {};
boolean isExport() default true;
boolean isMark() default false;
boolean isDate() default false;
boolean isPic() default false;
}
@@ -0,0 +1,9 @@
package cn.cloudwalk.elevator.export;
import cn.cloudwalk.cloud.exception.ServiceException;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public interface ExcelCallback {
void call(HSSFWorkbook paramHSSFWorkbook, HSSFSheet paramHSSFSheet) throws ServiceException;
}
@@ -0,0 +1,72 @@
package cn.cloudwalk.elevator.export.impl;
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.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.device.param.AcsElevatorDeviceQueryParam;
import cn.cloudwalk.elevator.device.service.AcsElevatorDeviceService;
import cn.cloudwalk.elevator.export.AcsAbstractExportAsyncService;
import cn.cloudwalk.elevator.export.result.ElevatorDeviceRecordExcelResult;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.util.DateUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@Service
public class ElevatorDeviceExportService
extends AcsAbstractExportAsyncService<AcsElevatorDeviceQueryParam, ElevatorDeviceRecordExcelResult> {
@Resource
private AcsElevatorDeviceService elevatorDeviceService;
protected CloudwalkPageAble<ElevatorDeviceRecordExcelResult> queryPage(AcsElevatorDeviceQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
param.setCurrentPage(pageInfo.getCurrentPage());
param.setRowsOfPage(pageInfo.getPageSize());
CloudwalkResult<CloudwalkPageAble<AcsElevatorDeviceResultDTO>> result =
this.elevatorDeviceService.get(param, context);
if (result.isSuccess()) {
CloudwalkPageAble<AcsElevatorDeviceResultDTO> data =
(CloudwalkPageAble<AcsElevatorDeviceResultDTO>)result.getData();
if (CollectionUtils.isNotEmpty(data.getDatas())) {
List<ElevatorDeviceRecordExcelResult> targetList =
BeanCopyUtils.copy(data.getDatas(), ElevatorDeviceRecordExcelResult.class);
for (ElevatorDeviceRecordExcelResult item : targetList) {
if (Objects.equals(item.getStatus(), Integer.valueOf(1))) {
item.setDeviceOnlineStatus("禁用");
continue;
}
if (Objects.equals(item.getOnlineStatus(), Integer.valueOf(2))) {
item.setDeviceOnlineStatus("在线");
continue;
}
if (Objects.equals(item.getOnlineStatus(), Integer.valueOf(3))) {
item.setDeviceOnlineStatus("离线");
}
}
return new CloudwalkPageAble(targetList, pageInfo,
((CloudwalkPageAble)result.getData()).getTotalRows());
}
}
throw new ServiceException(result.getCode(), result.getMessage());
}
protected CloudwalkResult<String> createLocalFile(AcsElevatorDeviceQueryParam param, String fileName,
CloudwalkCallContext context) throws ServiceException {
return null;
}
protected String getDefaultFileName() {
return "派梯设备导出" + DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
}
protected String getDefaultFileTitleName() {
return "派梯设备";
}
}
@@ -0,0 +1,200 @@
package cn.cloudwalk.elevator.export.result;
public class ElevatorDeviceRecordExcelResult implements Serializable {
@ExcelAttribute(name = "设备名称", column = "A")
private String deviceName;
@ExcelAttribute(name = "设备编号", column = "B")
private String deviceCode;
@ExcelAttribute(name = "设备型号", column = "C")
private String deviceTypeName;
@ExcelAttribute(name = "安装区域", column = "D")
private String areaName;
@ExcelAttribute(name = "当前楼层", column = "E")
private String currentFloor;
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
@ExcelAttribute(name = "派梯楼层", column = "F")
private String elevatorFloorList;
@ExcelAttribute(name = "设备状态", column = "G")
private String deviceOnlineStatus;
@ExcelAttribute(name = "设备IP", column = "H")
private String ip;
@ExcelAttribute(name = "最后心跳", column = "I", isDate = true)
private Long lastHeartbeatTime;
private Integer status;
private Integer onlineStatus;
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public void setDeviceOnlineStatus(String deviceOnlineStatus) {
this.deviceOnlineStatus = deviceOnlineStatus;
}
public void setIp(String ip) {
this.ip = ip;
}
public void setLastHeartbeatTime(Long lastHeartbeatTime) {
this.lastHeartbeatTime = lastHeartbeatTime;
}
public void setStatus(Integer status) {
this.status = status;
}
public void setOnlineStatus(Integer onlineStatus) {
this.onlineStatus = onlineStatus;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof ElevatorDeviceRecordExcelResult))
return false;
ElevatorDeviceRecordExcelResult other = (ElevatorDeviceRecordExcelResult)o;
if (!other.canEqual(this))
return false;
Object this$deviceName = getDeviceName(), other$deviceName = other.getDeviceName();
if ((this$deviceName == null) ? (other$deviceName != null) : !this$deviceName.equals(other$deviceName))
return false;
Object this$deviceCode = getDeviceCode(), other$deviceCode = other.getDeviceCode();
if ((this$deviceCode == null) ? (other$deviceCode != null) : !this$deviceCode.equals(other$deviceCode))
return false;
Object this$deviceTypeName = getDeviceTypeName(), other$deviceTypeName = other.getDeviceTypeName();
if ((this$deviceTypeName == null) ? (other$deviceTypeName != null)
: !this$deviceTypeName.equals(other$deviceTypeName))
return false;
Object this$areaName = getAreaName(), other$areaName = other.getAreaName();
if ((this$areaName == null) ? (other$areaName != null) : !this$areaName.equals(other$areaName))
return false;
Object this$currentFloor = getCurrentFloor(), other$currentFloor = other.getCurrentFloor();
if ((this$currentFloor == null) ? (other$currentFloor != null) : !this$currentFloor.equals(other$currentFloor))
return false;
Object this$elevatorFloorList = getElevatorFloorList(), other$elevatorFloorList = other.getElevatorFloorList();
if ((this$elevatorFloorList == null) ? (other$elevatorFloorList != null)
: !this$elevatorFloorList.equals(other$elevatorFloorList))
return false;
Object this$deviceOnlineStatus = getDeviceOnlineStatus(),
other$deviceOnlineStatus = other.getDeviceOnlineStatus();
if ((this$deviceOnlineStatus == null) ? (other$deviceOnlineStatus != null)
: !this$deviceOnlineStatus.equals(other$deviceOnlineStatus))
return false;
Object this$ip = getIp(), other$ip = other.getIp();
if ((this$ip == null) ? (other$ip != null) : !this$ip.equals(other$ip))
return false;
Object this$lastHeartbeatTime = getLastHeartbeatTime(), other$lastHeartbeatTime = other.getLastHeartbeatTime();
if ((this$lastHeartbeatTime == null) ? (other$lastHeartbeatTime != null)
: !this$lastHeartbeatTime.equals(other$lastHeartbeatTime))
return false;
Object this$status = getStatus(), other$status = other.getStatus();
if ((this$status == null) ? (other$status != null) : !this$status.equals(other$status))
return false;
Object this$onlineStatus = getOnlineStatus(), other$onlineStatus = other.getOnlineStatus();
return !((this$onlineStatus == null) ? (other$onlineStatus != null)
: !this$onlineStatus.equals(other$onlineStatus));
}
protected boolean canEqual(Object other) {
return other instanceof ElevatorDeviceRecordExcelResult;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $deviceName = getDeviceName();
result = result * 59 + (($deviceName == null) ? 43 : $deviceName.hashCode());
Object $deviceCode = getDeviceCode();
result = result * 59 + (($deviceCode == null) ? 43 : $deviceCode.hashCode());
Object $deviceTypeName = getDeviceTypeName();
result = result * 59 + (($deviceTypeName == null) ? 43 : $deviceTypeName.hashCode());
Object $areaName = getAreaName();
result = result * 59 + (($areaName == null) ? 43 : $areaName.hashCode());
Object $currentFloor = getCurrentFloor();
result = result * 59 + (($currentFloor == null) ? 43 : $currentFloor.hashCode());
Object $elevatorFloorList = getElevatorFloorList();
result = result * 59 + (($elevatorFloorList == null) ? 43 : $elevatorFloorList.hashCode());
Object $deviceOnlineStatus = getDeviceOnlineStatus();
result = result * 59 + (($deviceOnlineStatus == null) ? 43 : $deviceOnlineStatus.hashCode());
Object $ip = getIp();
result = result * 59 + (($ip == null) ? 43 : $ip.hashCode());
Object $lastHeartbeatTime = getLastHeartbeatTime();
result = result * 59 + (($lastHeartbeatTime == null) ? 43 : $lastHeartbeatTime.hashCode());
Object $status = getStatus();
result = result * 59 + (($status == null) ? 43 : $status.hashCode());
Object $onlineStatus = getOnlineStatus();
return result * 59 + (($onlineStatus == null) ? 43 : $onlineStatus.hashCode());
}
public String toString() {
return "ElevatorDeviceRecordExcelResult(deviceName=" + getDeviceName() + ", deviceCode=" + getDeviceCode()
+ ", deviceTypeName=" + getDeviceTypeName() + ", areaName=" + getAreaName() + ", currentFloor="
+ getCurrentFloor() + ", elevatorFloorList=" + getElevatorFloorList() + ", deviceOnlineStatus="
+ getDeviceOnlineStatus() + ", ip=" + getIp() + ", lastHeartbeatTime=" + getLastHeartbeatTime()
+ ", status=" + getStatus() + ", onlineStatus=" + getOnlineStatus() + ")";
}
public String getDeviceName() {
return this.deviceName;
}
public String getDeviceCode() {
return this.deviceCode;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public String getAreaName() {
return this.areaName;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public String getDeviceOnlineStatus() {
return this.deviceOnlineStatus;
}
public String getIp() {
return this.ip;
}
public Long getLastHeartbeatTime() {
return this.lastHeartbeatTime;
}
public Integer getStatus() {
return this.status;
}
public Integer getOnlineStatus() {
return this.onlineStatus;
}
}
@@ -0,0 +1,476 @@
package cn.cloudwalk.elevator.export.utils;
import cn.cloudwalk.elevator.export.ExcelAttribute;
import cn.cloudwalk.elevator.export.ExcelCallback;
import cn.cloudwalk.elevator.util.DateUtils;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.DVConstraint;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExcelUtil {
public static final String FONT_CODE = "1";
private static final int BUF_SIZE = 8096;
private static Logger logger = LoggerFactory.getLogger(ExcelUtil.class);
private static String EXPORT_KEY = "isExport";
private static String ANNOTATION_FIELD = "memberValues";
public static <T> List<T> getExcelToList(String sheetName, Integer startNo, InputStream input, Class<T> clazz)
throws Exception {
List<T> list = new ArrayList<>();
try (Workbook book = WorkbookFactory.create(input)) {
Sheet sheet = null;
if (StringUtils.isNotBlank(sheetName)) {
sheet = book.getSheet(sheetName);
}
if (sheet == null) {
sheet = book.getSheetAt(0);
}
int rows = sheet.getLastRowNum();
int startLine = 1;
if (null != startNo && startNo.intValue() >= 0) {
startLine = startNo.intValue();
}
if (rows > 0) {
Field[] allFields = clazz.getDeclaredFields();
Map<String, Field> fieldsMap = getStringFieldMap(allFields);
Row firstRow = sheet.getRow(sheet.getFirstRowNum() + startLine - 1);
for (int i = sheet.getFirstRowNum() + startLine; i <= rows; i++) {
Row row = sheet.getRow(i);
if (row != null) {
Iterator<Cell> cells = row.cellIterator();
T entity = null;
boolean isNull = true;
while (cells.hasNext()) {
Cell cell = cells.next();
String fieldName = firstRow.getCell(cell.getColumnIndex()).getStringCellValue();
if (!fieldsMap.containsKey(fieldName)) {
continue;
}
cell.setCellType(1);
String c = cell.getStringCellValue();
if (StringUtils.isNotEmpty(c)) {
isNull = false;
}
entity = (entity == null) ? clazz.newInstance() : entity;
Field field = fieldsMap.get(fieldName);
Class<?> fieldType = field.getType();
if (fieldType == null) {
continue;
}
setValue(entity, c, field, fieldType);
}
if (entity != null && !isNull)
list.add(entity);
}
}
}
} catch (Exception e) {
throw new Exception("将excel表单数据源的数据导入到list异常!", e);
}
return list;
}
private static <T> void setValue(T entity, String c, Field field, Class<?> fieldType)
throws IllegalAccessException {
if (String.class == fieldType) {
field.set(entity, String.valueOf(c));
} else if (BigDecimal.class == fieldType) {
field.set(entity, BigDecimal.valueOf(Double.valueOf(c).doubleValue()));
} else if (int.class == fieldType || Integer.class == fieldType) {
field.set(entity, Integer.valueOf(Integer.parseInt(c)));
} else if (long.class == fieldType || Long.class == fieldType) {
field.set(entity, Long.valueOf(c));
} else if (float.class == fieldType || Float.class == fieldType) {
field.set(entity, Float.valueOf(c));
} else if (short.class == fieldType || Short.class == fieldType) {
field.set(entity, Short.valueOf(c));
} else if (double.class == fieldType || Double.class == fieldType) {
field.set(entity, Double.valueOf(c));
}
}
private static Map<String, Field> getStringFieldMap(Field[] allFields) {
Map<String, Field> fieldsMap = new HashMap<>(allFields.length);
for (Field field : allFields) {
if (field.isAnnotationPresent((Class)ExcelAttribute.class)) {
ExcelAttribute attribute = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (!StringUtils.isBlank(attribute.name())) {
field.setAccessible(true);
fieldsMap.put(attribute.name(), field);
}
}
}
return fieldsMap;
}
public static <T> boolean matchExcel(String sheetName, InputStream input, Class<T> clazz) throws Exception {
try {
HSSFWorkbook book = new HSSFWorkbook(input);
HSSFSheet sheet = null;
if (StringUtils.isNotBlank(sheetName)) {
sheet = book.getSheet(sheetName);
}
if (sheet == null) {
sheet = book.getSheetAt(0);
}
int rows = sheet.getLastRowNum();
if (rows > 0) {
Field[] allFields = clazz.getDeclaredFields();
Map<String, Field> fieldsMap = getStringFieldMap(allFields);
HSSFRow firstRow = sheet.getRow(sheet.getFirstRowNum());
Iterator<Cell> cells = firstRow.cellIterator();
while (cells.hasNext()) {
Cell cell = cells.next();
String fieldName = firstRow.getCell(cell.getColumnIndex()).getStringCellValue();
if (!fieldsMap.containsKey(fieldName)) {
return false;
}
}
} else {
return false;
}
} catch (Exception e) {
throw new Exception("将excel表单数据源的数据导入到list异常!", e);
}
return true;
}
public static <T> boolean getListToExcel(List<T> list, List<T> listHead, String sheetName, OutputStream output,
Class<T> clazz) throws Exception {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
for (Field field : allFields) {
if (field.isAnnotationPresent((Class)ExcelAttribute.class)) {
fields.add(field);
}
}
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(0, sheetName);
createRowContent(sheet, fields, workbook, listHead, 0, listHead.size(), 0);
createRowHeard(sheet, fields, workbook, 1);
createRowContent(sheet, fields, workbook, list, 0, list.size(), 2);
output.flush();
workbook.write(output);
output.close();
return Boolean.TRUE.booleanValue();
} catch (Exception e) {
throw new Exception("将list数据源的数据导入到excel表单异常!", e);
}
}
public static <T> boolean getListToExcel(List<T> list, String sheetName, OutputStream output, Class<T> clazz)
throws Exception {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
int sheetSize = 65536;
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
for (Field field : allFields) {
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (attr != null && attr.isExport()) {
fields.add(field);
}
}
int listSize = 0;
if (list != null && list.size() > 0) {
listSize = list.size();
}
int sheetNo = listSize / sheetSize;
for (int index = 0; index <= sheetNo; index++) {
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(index, sheetName + index);
createRowHeard(sheet, fields, workbook, 2);
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, listSize);
createRowContent(sheet, fields, workbook, list, startNo, endNo, 3);
}
output.flush();
workbook.write(output);
output.close();
return Boolean.TRUE.booleanValue();
} catch (Exception e) {
throw new Exception("将list数据源的数据导入到excel表单异常!", e);
}
}
public static <T> boolean getListToExcel(List<T> list, String sheetName, OutputStream output, Class<T> clazz,
Integer startRow, ExcelCallback callback) throws Exception {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
int sheetSize = 65536;
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
for (Field field : allFields) {
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (attr != null && attr.isExport()) {
fields.add(field);
}
}
int listSize = 0;
if (list != null && list.size() > 0) {
listSize = list.size();
}
int sheetNo = listSize / sheetSize;
for (int index = 0; index <= sheetNo; index++) {
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(index, sheetName + index);
createRowHeard(sheet, fields, workbook, startRow.intValue());
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, listSize);
createRowContent(sheet, fields, workbook, list, startNo, endNo, startRow.intValue() + 1);
if (null != callback) {
callback.call(workbook, sheet);
}
}
output.flush();
workbook.write(output);
output.close();
return Boolean.TRUE.booleanValue();
} catch (Exception e) {
throw new Exception("将list数据源的数据导入到excel表单异常!", e);
}
}
private static <T> void createRowContent(HSSFSheet sheet, List<Field> fields, HSSFWorkbook workbook, List<T> list,
int startNo, int endNo, int rowIndex) throws Exception {
String value = null;
int hwPicType = 0;
byte[] picByte = null;
for (int i = startNo; i < endNo; i++) {
HSSFRow row = sheet.createRow(i - startNo + rowIndex);
T vo = list.get(i);
for (int j = 0; j < fields.size(); j++) {
Field field = fields.get(j);
field.setAccessible(true);
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
int col = j;
if (StringUtils.isNotBlank(attr.column())) {
col = getExcelCol(attr.column());
}
if (attr.isExport()) {
HSSFCell cell = row.createCell(col);
Class<?> classType = field.getType();
if (field.get(vo) != null) {
value = null;
if (classType.isAssignableFrom(Date.class)) {
value = DateUtils.formatDate((Date)field.get(vo), "yyyy-MM-dd HH:mm:ss");
}
if (classType.isAssignableFrom(Long.class) && attr.isDate()) {
value = DateUtils.formatDate(new Date(((Long)field.get(vo)).longValue()),
"yyyy-MM-dd HH:mm:ss");
}
if (attr.isPic()) {
try {
if (field.getType().equals(String.class)) {
picByte = getBytesByUrl((String)field.get(vo));
}
picByte = (byte[])field.get(vo);
} catch (Exception exception) {
}
hwPicType = 5;
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 1020, 250, (short)col, row.getRowNum(),
(short)col, row.getRowNum());
patriarch.createPicture(anchor, workbook.addPicture(picByte, hwPicType));
row.setHeight((short)1000);
} else {
cell.setCellValue((field.get(vo) == null) ? ""
: ((value == null) ? String.valueOf(field.get(vo)) : value));
}
}
}
}
}
}
public static void createRowHeard(HSSFSheet sheet, List<Field> fields, HSSFWorkbook workbook, int index) {
HSSFRow row = sheet.createRow(index);
for (int i = 0; i < fields.size(); i++) {
int col = i;
Field field = fields.get(i);
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (StringUtils.isNotBlank(attr.column())) {
col = getExcelCol(attr.column());
}
HSSFCell cell = row.createCell(col);
HSSFCellStyle cellStyle = createCellStyle(workbook, attr.isMark() ? "2" : "1");
cell.setCellStyle(cellStyle);
sheet.setColumnWidth(i,
(int)((((attr.name().getBytes()).length <= 4) ? 6 : (attr.name().getBytes()).length) * 1.5D * 256.0D));
cell.setCellType(1);
cell.setCellValue(attr.name());
}
}
private static HSSFCellStyle createCellStyle(HSSFWorkbook workbook, String type) {
HSSFFont font = workbook.createFont();
HSSFCellStyle cellStyle = workbook.createCellStyle();
font.setFontName("Arail narrow");
font.setBoldweight((short)700);
if ("1".equals(type)) {
font.setColor('翿');
cellStyle.setFont(font);
} else {
font.setColor((short)10);
cellStyle.setFont(font);
}
return cellStyle;
}
public static int getExcelCol(String col) {
col = col.toUpperCase();
int count = -1;
char[] cs = col.toCharArray();
for (int i = 0; i < cs.length; i++) {
count = (int)(count + (cs[i] - 64) * Math.pow(26.0D, cs.length - 1.0D - i));
}
return count;
}
public static HSSFSheet setHSSFPrompt(HSSFSheet sheet, String promptTitle, String promptContent, int firstRow,
int endRow, int firstCol, int endCol) {
DVConstraint constraint = DVConstraint.createCustomFormulaConstraint("DD1");
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
HSSFDataValidation dataValidationView = new HSSFDataValidation(regions, (DataValidationConstraint)constraint);
dataValidationView.createPromptBox(promptTitle, promptContent);
sheet.addValidationData((DataValidation)dataValidationView);
return sheet;
}
public static HSSFSheet setHSSFValidation(HSSFSheet sheet, String[] textlist, int firstRow, int endRow,
int firstCol, int endCol) {
DVConstraint constraint = DVConstraint.createExplicitListConstraint(textlist);
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
HSSFDataValidation dataValidationList = new HSSFDataValidation(regions, (DataValidationConstraint)constraint);
sheet.addValidationData((DataValidation)dataValidationList);
return sheet;
}
public static byte[] getBytesByUrl(String imgUrl) throws Exception {
if (StringUtils.isEmpty(imgUrl)) {
return null;
}
BufferedInputStream bis = null;
ByteArrayOutputStream bos = null;
try {
URL url = new URL(imgUrl);
HttpURLConnection http = (HttpURLConnection)url.openConnection();
http.setConnectTimeout(3000);
http.connect();
bis = new BufferedInputStream(http.getInputStream());
bos = new ByteArrayOutputStream();
byte[] buf = new byte[8096];
int size;
while ((size = bis.read(buf)) != -1) {
bos.write(buf, 0, size);
}
http.disconnect();
return bos.toByteArray();
} finally {
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
logger.error("流关闭失败,原因:" + e.getMessage(), e);
}
}
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
logger.error("流关闭失败,原因:" + e.getMessage(), e);
}
}
}
}
public static void setExcelAttribute(ExcelAttribute excelAttribute, String key, Object obj, boolean isExport) {
if (excelAttribute == null) {
return;
}
InvocationHandler invocationHandler = Proxy.getInvocationHandler(excelAttribute);
Field value = null;
try {
value = invocationHandler.getClass().getDeclaredField(ANNOTATION_FIELD);
} catch (Exception e) {
logger.warn("反射获取ExcelAttribute注解的成员字段异常", e);
}
if (value == null) {
return;
}
value.setAccessible(true);
Map<String, Object> memberValues = null;
try {
memberValues = (Map<String, Object>)value.get(invocationHandler);
} catch (Exception e) {
logger.warn("反射获取ExcelAttribute注解的成员值异常", e);
}
if (memberValues == null) {
return;
}
if (obj != null) {
memberValues.put(key, obj);
}
if (!isExport) {
memberValues.put(EXPORT_KEY, Boolean.valueOf(isExport));
}
}
public static <T> boolean appendListToExcel(InputStream inputStream, List<T> list, int sheetIndex,
OutputStream output, Class<T> clazz, Integer startRow) throws Exception {
try (HSSFWorkbook workbook = new HSSFWorkbook(inputStream)) {
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
for (Field field : allFields) {
ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
if (attr != null && attr.isExport()) {
fields.add(field);
}
}
HSSFSheet sheet = workbook.getSheetAt(sheetIndex);
createRowContent(sheet, fields, workbook, list, 0, list.size(), startRow.intValue());
output.flush();
workbook.write(IOUtils.buffer(output));
return Boolean.TRUE.booleanValue();
} catch (IOException e) {
throw new Exception("将list数据源的数据导入到excel表单异常!", e);
} finally {
output.close();
}
}
}
@@ -0,0 +1,37 @@
package cn.cloudwalk.elevator.export.utils;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FolderUtils {
private static Logger logger = LoggerFactory.getLogger(FolderUtils.class);
public static void deleteFolder(String path) {
File file = new File(path);
if (file.exists()) {
File[] files = file.listFiles();
int len = files.length;
for (int i = 0; i < len; i++) {
if (files[i].isDirectory()) {
deleteFolder(files[i].getPath());
} else {
doDelete(files[i]);
}
}
doDelete(file);
}
}
public static void deleteFile(String path) {
File file = new File(path);
if (file.exists()) {
doDelete(file);
}
}
public static void doDelete(File file) {
if (file.exists() && !file.delete())
logger.error("文件删除失败");
}
}
@@ -0,0 +1,16 @@
package cn.cloudwalk.elevator.mqtt.client;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.elevator.mqtt.fallback.MqttFeignClientFallback;
import cn.cloudwalk.elevator.mqtt.param.MqttSendMessageParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient(name = "${feign.mqtt.name:cloudwalk-device-thirdparty}", path = "/mqtt",
fallback = MqttFeignClientFallback.class)
public interface MqttFeignClient {
@RequestMapping(value = {"/publish"}, method = {RequestMethod.POST})
CloudwalkResult<Boolean> publish(MqttSendMessageParam paramMqttSendMessageParam) throws ServiceException;
}
@@ -0,0 +1,14 @@
package cn.cloudwalk.elevator.mqtt.fallback;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.elevator.mqtt.client.MqttFeignClient;
import cn.cloudwalk.elevator.mqtt.param.MqttSendMessageParam;
import org.springframework.stereotype.Component;
@Component
public class MqttFeignClientFallback implements MqttFeignClient {
public CloudwalkResult<Boolean> publish(MqttSendMessageParam param) throws ServiceException {
throw new RuntimeException("mqtt发送数据失败");
}
}
@@ -0,0 +1,75 @@
package cn.cloudwalk.elevator.mqtt.impl;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
import cn.cloudwalk.elevator.common.AbstractAcsDeviceService;
import cn.cloudwalk.elevator.mqtt.client.MqttFeignClient;
import cn.cloudwalk.elevator.mqtt.param.AcsElevatorRecordMqttParam;
import cn.cloudwalk.elevator.mqtt.param.MqttSendMessageParam;
import cn.cloudwalk.elevator.mqtt.service.MqttService;
import cn.cloudwalk.elevator.record.dao.AcsRecogRecordDao;
import cn.cloudwalk.elevator.record.dto.AcsElevatorRecordAddDTO;
import cn.cloudwalk.elevator.record.dto.AcsRecogRecordPageDTO;
import cn.cloudwalk.elevator.record.dto.AcsRecogRecordResultDTO;
import cn.cloudwalk.elevator.util.DateUtils;
import com.alibaba.fastjson.JSON;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@Component
public class MqttServiceImpl extends AbstractAcsDeviceService implements MqttService {
private static final String VISITOR_LABEL_CODE = "1";
private static final String VISITOR_LABEL_NAME = "访客";
private static final String ELEVATOR_RECORD_SUFFIX = "_elevator_record";
@Qualifier("cn.cloudwalk.elevator.mqtt.client.MqttFeignClient")
@Resource
private MqttFeignClient mqttFeignClient;
@Resource
private AcsRecogRecordDao acsRecogRecordDao;
@Async
public void sendInfoToOne(AcsElevatorRecordAddDTO addDTO) throws ServiceException {
this.logger.info("防止人员识别记录未入库即开始推送消息,休眠10秒");
try {
TimeUnit.SECONDS.sleep(10L);
} catch (InterruptedException e) {
this.logger.error("休眠失败,失败原因:{}", e.getMessage());
throw new ServiceException(e.getMessage());
}
try {
AcsRecogRecordPageDTO recordPageDTO = new AcsRecogRecordPageDTO();
recordPageDTO.setLogId(addDTO.getRecognitionFaceId());
recordPageDTO.setStartTime(DateUtils.todayStart());
recordPageDTO.setEndTime(DateUtils.todayEnd());
List<AcsRecogRecordResultDTO> recogRecordResultDTOS = this.acsRecogRecordDao.page(recordPageDTO);
if (!CollectionUtils.isEmpty(recogRecordResultDTOS)) {
AcsRecogRecordResultDTO acsRecogRecordResultDTO = recogRecordResultDTOS.get(0);
AcsElevatorRecordMqttParam acsElevatorRecordMqttParam =
(AcsElevatorRecordMqttParam)BeanCopyUtils.copyProperties(addDTO, AcsElevatorRecordMqttParam.class);
acsElevatorRecordMqttParam.setOpenDoorId(addDTO.getId());
acsElevatorRecordMqttParam.setPersonName(acsRecogRecordResultDTO.getPersonName());
if (StringUtils.isNotBlank(acsRecogRecordResultDTO.getPersonLabelIds())
&& acsRecogRecordResultDTO.getPersonLabelIds().contains("1")) {
acsElevatorRecordMqttParam.setIsVisitor(Boolean.TRUE);
}
CloudwalkResult<Boolean> publish = this.mqttFeignClient
.publish(MqttSendMessageParam.builder().topic(addDTO.getBusinessId() + "_elevator_record")
.data(JSON.toJSONString(acsElevatorRecordMqttParam)).build());
if (publish.isSuccess()) {
this.logger.info("推送数据成功!!!,数据,{}", JSON.toJSONString(acsElevatorRecordMqttParam));
} else {
this.logger.debug("推送数据失败!!!");
}
}
} catch (Exception e) {
this.logger.error("发送消息失败 param:{} {}", addDTO, e.getMessage());
}
}
}
@@ -0,0 +1,78 @@
package cn.cloudwalk.elevator.mqtt.param;
public class AcsElevatorRecordMqttParam {
private String openDoorId;
private String openDoorType;
private String srcFloor;
public void setOpenDoorId(String openDoorId) {
this.openDoorId = openDoorId;
}
private String destFloor;
private String dispatchElevatorNo;
private Long dispatchElevatorTime;
private String personName;
public void setOpenDoorType(String openDoorType) {
this.openDoorType = openDoorType;
}
public void setSrcFloor(String srcFloor) {
this.srcFloor = srcFloor;
}
public void setDestFloor(String destFloor) {
this.destFloor = destFloor;
}
public void setDispatchElevatorNo(String dispatchElevatorNo) {
this.dispatchElevatorNo = dispatchElevatorNo;
}
public void setDispatchElevatorTime(Long dispatchElevatorTime) {
this.dispatchElevatorTime = dispatchElevatorTime;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public void setIsVisitor(Boolean isVisitor) {
this.isVisitor = isVisitor;
}
public String getOpenDoorId() {
return this.openDoorId;
}
public String getOpenDoorType() {
return this.openDoorType;
}
public String getSrcFloor() {
return this.srcFloor;
}
public String getDestFloor() {
return this.destFloor;
}
public String getDispatchElevatorNo() {
return this.dispatchElevatorNo;
}
public Long getDispatchElevatorTime() {
return this.dispatchElevatorTime;
}
public String getPersonName() {
return this.personName;
}
private Boolean isVisitor = Boolean.valueOf(false);
public Boolean getIsVisitor() {
return this.isVisitor;
}
}
@@ -0,0 +1,56 @@
package cn.cloudwalk.elevator.mqtt.param;
public class MqttSendMessageParam {
private String topic;
private String data;
@ConstructorProperties({"topic", "data"})
MqttSendMessageParam(String topic, String data) {
this.topic = topic;
this.data = data;
}
public static MqttSendMessageParamBuilder builder() {
return new MqttSendMessageParamBuilder();
}
public static class MqttSendMessageParamBuilder {
private String topic;
public MqttSendMessageParamBuilder topic(String topic) {
this.topic = topic;
return this;
}
private String data;
public MqttSendMessageParamBuilder data(String data) {
this.data = data;
return this;
}
public MqttSendMessageParam build() {
return new MqttSendMessageParam(this.topic, this.data);
}
public String toString() {
return "MqttSendMessageParam.MqttSendMessageParamBuilder(topic=" + this.topic + ", data=" + this.data + ")";
}
}
public void setTopic(String topic) {
this.topic = topic;
}
public void setData(String data) {
this.data = data;
}
public String getTopic() {
return this.topic;
}
public String getData() {
return this.data;
}
}
@@ -0,0 +1,8 @@
package cn.cloudwalk.elevator.mqtt.service;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.elevator.record.dto.AcsElevatorRecordAddDTO;
public interface MqttService {
void sendInfoToOne(AcsElevatorRecordAddDTO paramAcsElevatorRecordAddDTO) throws ServiceException;
}
@@ -0,0 +1,63 @@
package cn.cloudwalk.elevator.passrule.impl;
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.param.ImageStoreQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStoreDetailResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImgStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.result.OrganizationResult;
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.elevator.common.AbstractCloudwalkService;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
public class AbstractAcsPassService extends AbstractCloudwalkService {
@Resource
private ImageStoreService imageStoreService;
protected ImageStoreDetailResult getImageStoreDetail(String imageStoreId, CloudwalkCallContext context)
throws ServiceException {
ImageStoreQueryParam param = new ImageStoreQueryParam();
param.setId(imageStoreId);
param.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<ImageStoreDetailResult> imageStoreDetail = this.imageStoreService.detail(param, context);
if (!imageStoreDetail.isSuccess()) {
this.logger.error("远程调用查询图库详情失败,原因:" + imageStoreDetail.getMessage());
throw new ServiceException("远程调用查询图库详情失败");
}
return (ImageStoreDetailResult)imageStoreDetail.getData();
}
protected ImageStoreEditParam getEditParamByImageStore(ImageStoreDetailResult imageStoreDetail) {
ImageStoreEditParam param = new ImageStoreEditParam();
BeanCopyUtils.copyProperties(imageStoreDetail, param);
param.setIncludeOrganizations((List)imageStoreDetail.getIncludeOrganizations().stream()
.map(OrganizationResult::getId).collect(Collectors.toList()));
param.setIncludeLabels(
(List)imageStoreDetail.getIncludeLabels().stream().map(LabelResult::getId).collect(Collectors.toList()));
param.setIncludePersons(getImageStorePersonData(imageStoreDetail.getIncludePersons()));
param.setExcludeLabels(
(List)imageStoreDetail.getExcludeLabels().stream().map(LabelResult::getId).collect(Collectors.toList()));
param.setExcludePersons((List)imageStoreDetail.getExcludePersons().stream().map(ImgStorePersonResult::getId)
.collect(Collectors.toList()));
return param;
}
private List<ImageStorePersonData> getImageStorePersonData(List<ImgStorePersonResult> imgStorePersonResults) {
List<ImageStorePersonData> personDataList = new ArrayList<>();
for (ImgStorePersonResult personResult : imgStorePersonResults) {
ImageStorePersonData personData = new ImageStorePersonData();
BeanCopyUtils.copyProperties(personResult, personData);
personData.setObjectId(personResult.getId());
personDataList.add(personData);
}
return personDataList;
}
}
@@ -0,0 +1,477 @@
package cn.cloudwalk.elevator.passrule.impl;
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.ImageStoreQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStoreDetailResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStoreListResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStorePersonService;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService;
import cn.cloudwalk.client.cwoscomponent.intelligent.person.service.PersonService;
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.page.CloudwalkPageAble;
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
import cn.cloudwalk.elevator.common.service.AcsApplicationService;
import cn.cloudwalk.elevator.device.dao.AcsElevatorDeviceDao;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppBindParam;
import cn.cloudwalk.elevator.device.setting.param.DeviceImageStoreAppUnbindParam;
import cn.cloudwalk.elevator.device.setting.service.AcsDeviceImageStoreAppBindService;
import cn.cloudwalk.elevator.em.AcsPassTypeEnum;
import cn.cloudwalk.elevator.passrule.dao.AcsPassRuleDao;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleAddDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleDeleteDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleEditDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageResultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleIsDefaultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleQueryDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleResultDto;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleDeleteParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleEditParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleFloorParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleImageParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleIsDefaultParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleNewParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleQueryParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassTimeCycleParam;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleDetailResult;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleFloorResult;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleResult;
import cn.cloudwalk.elevator.passrule.service.AcsPassRuleService;
import cn.cloudwalk.elevator.person.param.AcsPersonQueryParam;
import cn.cloudwalk.elevator.person.result.AcsPersonResult;
import cn.cloudwalk.elevator.person.service.AcsPersonService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.zone.param.ZoneNextTreeParam;
import cn.cloudwalk.elevator.zone.result.ZoneTreeResult;
import cn.cloudwalk.elevator.zone.service.ZoneService;
import com.alibaba.fastjson.JSONObject;
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 javax.annotation.Resource;
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.ObjectUtils;
@Service
public class AcsPassRuleServiceImpl extends AbstractAcsPassService implements AcsPassRuleService {
@Resource
private ImageStoreService imageStoreService;
@Resource
private ImageStorePersonService imageStorePersonService;
@Resource
private PersonService personService;
@Resource
private ZoneService zoneService;
@Autowired
private AcsApplicationService acsApplicationService;
@Autowired
private AcsPersonService acsPersonService;
@Resource
private AcsPassRuleDao acsPassRuleDao;
@Resource
private AcsDeviceImageStoreAppBindService acsDeviceImageStoreAppBindService;
@Resource
private AcsElevatorDeviceDao acsElevatorDeviceDao;
public CloudwalkResult<List<AcsPassRuleFloorResult>> listFloor(AcsPassRuleFloorParam param,
CloudwalkCallContext context) throws ServiceException {
ZoneNextTreeParam treeParam = new ZoneNextTreeParam();
treeParam.setParentId(param.getZoneId());
CloudwalkResult<List<ZoneTreeResult>> zoneTree = this.zoneService.tree(treeParam, context);
if (!zoneTree.isSuccess()) {
this.logger.info("远程调用查询区域树状图失败,原因:" + zoneTree.getMessage());
throw new ServiceException(zoneTree.getCode(), zoneTree.getMessage());
}
try {
List<AcsPassRuleFloorResult> passRuleResults = new ArrayList<>();
if (!CollectionUtils.isEmpty((Collection)zoneTree.getData())) {
for (ZoneTreeResult zoneTreeResult : zoneTree.getData()) {
getZoneTypeIsThree(zoneTreeResult, passRuleResults);
}
} else {
return CloudwalkResult.success(passRuleResults);
}
for (AcsPassRuleFloorResult passRuleResult : passRuleResults) {
AcsElevatorDeviceListDto dto = new AcsElevatorDeviceListDto();
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setCurrentFloorId(passRuleResult.getId());
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.listByZoneId(dto);
passRuleResult.setDeviceNumber(Integer.valueOf(deviceList.size()));
AcsPersonQueryParam personParam = new AcsPersonQueryParam();
personParam.setZoneId(passRuleResult.getId());
CloudwalkPageInfo pageInfo = new CloudwalkPageInfo(1, 10);
CloudwalkResult<CloudwalkPageAble<AcsPersonResult>> page =
this.acsPersonService.page(personParam, pageInfo, context);
passRuleResult.setPersonNumber(Long.valueOf(((CloudwalkPageAble)page.getData()).getTotalRows()));
}
return CloudwalkResult.success(passRuleResults);
} catch (DataAccessException e) {
this.logger.error("查询所有楼层信息失败");
throw new ServiceException("76260520", getMessage("76260520"));
}
}
public CloudwalkResult<String> getIsDefaultByZoneId(AcsPassRuleIsDefaultParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsPassRuleIsDefaultDto dto = new AcsPassRuleIsDefaultDto();
dto.setZoneId(param.getZoneId());
dto.setBusinessId(context.getCompany().getCompanyId());
return CloudwalkResult.success(this.acsPassRuleDao.getIsDefaultByZoneId(dto));
} catch (DataAccessException e) {
this.logger.error("根据楼层id获取默认图库id失败");
throw new ServiceException("76260524", getMessage("76260524"));
}
}
@CloudwalkParamsValidate(argsIndexs = {0, 1})
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public CloudwalkResult<String> add(AcsPassRuleNewParam param, CloudwalkCallContext context)
throws ServiceException {
String imageStoreId = addImageStore(param, context);
AcsPassRuleAddDto dto = new AcsPassRuleAddDto();
dto.setId(genUUID());
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setName(param.getRuleName());
dto.setImageStoreId(imageStoreId);
dto.setZoneId(param.getZoneId());
dto.setZoneName(param.getZoneName());
dto.setBeginDate(param.getStartTime());
dto.setEndDate(param.getEndTime());
dto.setIsDefault(param.getIsDefault());
try {
this.acsPassRuleDao.insert(dto);
return CloudwalkResult.success(imageStoreId);
} catch (DataAccessException e) {
this.logger.error("添加通行规则失败");
throw new ServiceException("76260505", getMessage("76260505"));
}
}
private String addImageStore(AcsPassRuleNewParam param, CloudwalkCallContext context) throws ServiceException {
ImageStoreAddParam imageStoreAddParam = new ImageStoreAddParam();
String applicationId = this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId());
BeanCopyUtils.copyProperties(param, imageStoreAddParam);
imageStoreAddParam.setExpiryBeginDate(param.getStartTime());
imageStoreAddParam.setExpiryEndDate(param.getEndTime());
imageStoreAddParam.setName(param.getZoneName() + "-" + param.getRuleName());
imageStoreAddParam.setType(Short.valueOf((short)1));
imageStoreAddParam.setSourceApplicationId(applicationId);
imageStoreAddParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<String> imageStoreId = this.imageStoreService.add(imageStoreAddParam, context);
if (!imageStoreId.isSuccess()) {
this.logger.info("远程调用新增图库失败,原因:" + imageStoreId.getMessage());
throw new ServiceException(imageStoreId.getCode(), imageStoreId.getMessage());
}
AcsElevatorDeviceListDto dto = new AcsElevatorDeviceListDto();
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setCurrentFloorId(param.getZoneId());
List<AcsElevatorDeviceResultDTO> deviceList = null;
try {
deviceList = this.acsElevatorDeviceDao.listByZoneId(dto);
} catch (DataAccessException e) {
this.logger.error("根据楼层id获取设备信息失败,原因是:{}", e.getMessage());
}
DeviceImageStoreAppBindParam appBindParam = new DeviceImageStoreAppBindParam();
appBindParam.setImageStoreId((String)imageStoreId.getData());
appBindParam.setApplicationId(applicationId);
this.acsDeviceImageStoreAppBindService.bindAppImageStoreDevice(appBindParam, context);
if (!CollectionUtils.isEmpty(deviceList)) {
for (AcsElevatorDeviceResultDTO device : deviceList) {
try {
DeviceImageStoreAppBindParam bindParam = new DeviceImageStoreAppBindParam();
bindParam.setImageStoreId((String)imageStoreId.getData());
bindParam.setDeviceId(device.getDeviceId());
bindParam.setApplicationId(applicationId);
this.acsDeviceImageStoreAppBindService.bindDeviceAndImageStore(bindParam, context);
} catch (ServiceException e) {
this.logger.error("图库关联失败,图库id={},原因:{}", imageStoreId.getData(), e.getMessage());
ImageStoreDelParam delParam = new ImageStoreDelParam();
delParam.setId((String)imageStoreId.getData());
delParam.setBusinessId(context.getCompany().getCompanyId());
this.logger.info("回滚删除图库开始,delParam={},context={}", JSONObject.toJSON(delParam),
JSONObject.toJSON(context));
CloudwalkResult<Boolean> deleteResult = this.imageStoreService.delete(delParam, context);
this.logger.info("删除图库:图库id={},结果:{}", imageStoreId, deleteResult.getMessage());
throw new ServiceException(e.getCode(), e.getMessage());
}
}
}
return (String)imageStoreId.getData();
}
@CloudwalkParamsValidate(argsIndexs = {0, 1})
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public CloudwalkResult<Boolean> update(AcsPassRuleEditParam param, CloudwalkCallContext context)
throws ServiceException {
checkDefaultRule(Collections.singletonList(param.getId()), context);
AcsPassRuleEditDto dto = new AcsPassRuleEditDto();
BeanCopyUtils.copyProperties(param, context, dto);
dto.setValidDateCron(null);
dto.setValidDateJson(null);
dto.setBeginDate(param.getStartTime());
dto.setEndDate(param.getEndTime());
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setName(param.getRuleName());
try {
this.acsPassRuleDao.update(dto);
List<AcsPassRuleResultDto> ruleList = getRuleByIds(Collections.singletonList(dto.getId()), context);
updateImageStore(param, ruleList.get(0), context);
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (DataAccessException e) {
this.logger.error("编辑通行规则编辑失败");
throw new ServiceException("76260506", getMessage("76260506"));
}
}
private List<AcsPassRuleResultDto> checkDefaultRule(List<String> ruleIds, CloudwalkCallContext context)
throws ServiceException {
List<AcsPassRuleResultDto> resultDtoList = getRuleByIds(ruleIds, context);
for (AcsPassRuleResultDto resultDto : resultDtoList) {
if (!ObjectUtils.isEmpty(resultDto.getIsDefault()) && resultDto.getIsDefault().intValue() == 1) {
throw new ServiceException("门禁默认规则不可编辑和删除");
}
}
return resultDtoList;
}
private void updateImageStore(AcsPassRuleEditParam param, AcsPassRuleResultDto ruleResultDto,
CloudwalkCallContext context) throws ServiceException {
ImageStoreDetailResult imageStoreDetail = getImageStoreDetail(ruleResultDto.getImageStoreId(), context);
ImageStoreEditParam imageStoreEditParam = getEditParamByImageStore(imageStoreDetail);
BeanCopyUtils.copyProperties(ruleResultDto, imageStoreEditParam);
BeanCopyUtils.copyProperties(param, imageStoreEditParam);
imageStoreEditParam.setName(param.getZoneName() + "-" + param.getRuleName());
imageStoreEditParam.setExpiryBeginDate(param.getStartTime());
imageStoreEditParam.setExpiryEndDate(param.getEndTime());
imageStoreEditParam.setValidDateCron(null);
imageStoreEditParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<Boolean> result = this.imageStoreService.edit(imageStoreEditParam, context);
if (!result.isSuccess()) {
this.logger.info("远程调用编辑图库失败:原因:" + result.getMessage());
throw new ServiceException(result.getCode(), result.getMessage());
}
}
private List<AcsPassRuleResultDto> getRuleByIds(List<String> ruleIds, CloudwalkCallContext context)
throws ServiceException {
AcsPassRuleQueryDto dto = new AcsPassRuleQueryDto();
dto.setIds(ruleIds);
dto.setBusinessId(context.getCompany().getCompanyId());
try {
return this.acsPassRuleDao.list(dto);
} catch (DataAccessException e) {
this.logger.error("通行规则查询失败");
throw new ServiceException("通行规则查询失败");
}
}
@CloudwalkParamsValidate(argsIndexs = {0, 1})
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public CloudwalkResult<Boolean> delete(AcsPassRuleDeleteParam param, CloudwalkCallContext context)
throws ServiceException {
List<AcsPassRuleResultDto> resultDtos = checkDefaultRule(param.getIds(), context);
String applicationId = this.acsApplicationService.getApplicationId(context.getCompany().getCompanyId());
AcsElevatorDeviceListDto deviceListDto = new AcsElevatorDeviceListDto();
deviceListDto.setBusinessId(context.getCompany().getCompanyId());
deviceListDto.setCurrentFloorId(param.getZoneId());
List<AcsElevatorDeviceResultDTO> deviceList = null;
try {
deviceList = this.acsElevatorDeviceDao.listByZoneId(deviceListDto);
} catch (DataAccessException e) {
this.logger.error("根据楼层id获取设备信息失败,原因是:{}", e.getMessage());
}
for (AcsPassRuleResultDto acsPassRuleResultDto : resultDtos) {
if (!CollectionUtils.isEmpty(deviceList)) {
for (AcsElevatorDeviceResultDTO device : deviceList) {
DeviceImageStoreAppUnbindParam deviceImageStoreAppUnbindParam =
new DeviceImageStoreAppUnbindParam();
deviceImageStoreAppUnbindParam.setApplicationId(applicationId);
deviceImageStoreAppUnbindParam.setDeviceId(device.getDeviceId());
deviceImageStoreAppUnbindParam.setDeviceCode(device.getDeviceCode());
deviceImageStoreAppUnbindParam.setImageStoreId(acsPassRuleResultDto.getImageStoreId());
this.acsDeviceImageStoreAppBindService.unbindAppImageStoreDevice(deviceImageStoreAppUnbindParam,
context);
}
continue;
}
DeviceImageStoreAppUnbindParam unbindParam = new DeviceImageStoreAppUnbindParam();
unbindParam.setApplicationId(applicationId);
unbindParam.setImageStoreId(acsPassRuleResultDto.getImageStoreId());
this.acsDeviceImageStoreAppBindService.deleteImageStore(unbindParam, context);
}
AcsPassRuleDeleteDto dto = new AcsPassRuleDeleteDto();
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setIds(param.getIds());
try {
this.acsPassRuleDao.delete(dto);
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (DataAccessException e) {
this.logger.error("通行规则删除失败");
throw new ServiceException("76260507", getMessage("76260507"));
}
}
@CloudwalkParamsValidate(argsIndexs = {0, 1})
public CloudwalkResult<AcsPassRuleDetailResult> detail(AcsPassRuleQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsPassRuleQueryDto dto = new AcsPassRuleQueryDto();
BeanCopyUtils.copyProperties(param, dto);
dto.setBusinessId(context.getCompany().getCompanyId());
List<AcsPassRuleResultDto> passRuleResult = this.acsPassRuleDao.list(dto);
if (CollectionUtils.isEmpty(passRuleResult)) {
return CloudwalkResult.fail("76260517", getMessage("76260517"));
}
AcsPassRuleDetailResult result = coverRuleDetailResult(passRuleResult.get(0), context);
return CloudwalkResult.success(result);
} catch (DataAccessException e) {
this.logger.error("查询通行规则详情失败");
throw new ServiceException("76260508", getMessage("76260508"));
}
}
private List<AcsPassRuleResult> coverRulePageResult(List<AcsPassRuleResultDto> passRuleResultDtos,
CloudwalkCallContext context, boolean needDetail) throws ServiceException {
List<AcsPassRuleResult> results = new ArrayList<>();
Map<String, ImageStoreListResult> imageStoreResultMap = null;
if (needDetail) {
List<String> imageStoreIds = (List<String>)passRuleResultDtos.stream()
.map(AcsPassRuleResultDto::getImageStoreId).collect(Collectors.toList());
List<ImageStoreListResult> imageStoreListResult = getImageStorePageResult(imageStoreIds, context);
imageStoreResultMap = (Map<String, ImageStoreListResult>)imageStoreListResult.stream()
.collect(Collectors.toMap(ImageStoreListResult::getId, imageStoreListResult -> imageStoreListResult));
}
for (AcsPassRuleResultDto dto : passRuleResultDtos) {
AcsPassRuleResult result = new AcsPassRuleResult();
BeanCopyUtils.copyProperties(dto, result);
result.setRuleName(dto.getName());
result.setPassType(AcsPassTypeEnum.LONG_TIME.getCode());
if (dto.getBeginDate() != null || dto.getEndDate() != null) {
result.setPassType(AcsPassTypeEnum.AUTO_PASS.getCode());
}
if (needDetail && imageStoreResultMap.containsKey(dto.getImageStoreId())) {
ImageStoreListResult imageStoreListResult = imageStoreResultMap.get(dto.getImageStoreId());
result.setPersonSum(imageStoreListResult.getPersonNum().intValue());
result.setIncludeOrganizations(imageStoreListResult.getIncludeOrganizations());
result.setIncludeLabels(imageStoreListResult.getIncludeLabels());
result.setExcludeLabels(imageStoreListResult.getExcludeLabels());
}
results.add(result);
}
return results;
}
private List<ImageStoreListResult> getImageStorePageResult(List<String> imageStoreIds, CloudwalkCallContext context)
throws ServiceException {
ImageStoreQueryParam param = new ImageStoreQueryParam();
param.setIds(imageStoreIds);
param.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<List<ImageStoreListResult>> imageStoreResult = this.imageStoreService.list(param, context);
if (!imageStoreResult.isSuccess()) {
this.logger.info("远程调用分页查询图库失败,原因:" + imageStoreResult.getMessage());
throw new ServiceException(imageStoreResult.getCode(), imageStoreResult.getMessage());
}
return (List<ImageStoreListResult>)imageStoreResult.getData();
}
private AcsPassRuleDetailResult coverRuleDetailResult(AcsPassRuleResultDto dto, CloudwalkCallContext context)
throws ServiceException {
AcsPassRuleDetailResult result = new AcsPassRuleDetailResult();
BeanCopyUtils.copyProperties(dto, result);
result.setRuleName(dto.getName());
ImageStoreDetailResult imageStoreDetailResult = getImageStoreDetail(dto.getImageStoreId(), context);
result.setIncludeOrganizations(imageStoreDetailResult.getIncludeOrganizations());
result.setIncludeLabels(imageStoreDetailResult.getIncludeLabels());
result.setExcludeLabels(imageStoreDetailResult.getExcludeLabels());
List<AcsPassTimeCycleParam> timeCycleParams =
JSONObject.parseArray(dto.getValidDateJson(), AcsPassTimeCycleParam.class);
result.setPassableCycle(timeCycleParams);
result.setPassType(AcsPassTypeEnum.LONG_TIME.getCode());
if (dto.getBeginDate() != null || dto.getEndDate() != null) {
result.setPassType(AcsPassTypeEnum.AUTO_PASS.getCode());
}
return result;
}
@CloudwalkParamsValidate(argsIndexs = {0, 1})
public CloudwalkResult<CloudwalkPageAble<AcsPassRuleResult>> page(AcsPassRuleQueryParam param,
CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException {
try {
AcsPassRuleQueryDto dto = new AcsPassRuleQueryDto();
dto.setZoneId(param.getZoneId());
dto.setBusinessId(context.getCompany().getCompanyId());
CloudwalkPageAble<AcsPassRuleResultDto> passRuleResult = this.acsPassRuleDao.page(dto, page);
if (CollectionUtils.isEmpty(passRuleResult.getDatas()) && ObjectUtils.isEmpty(param.getIsDefault())) {
AcsPassRuleNewParam ruleNewParam = new AcsPassRuleNewParam();
ruleNewParam.setZoneId(param.getZoneId());
ruleNewParam.setZoneName(param.getZoneName());
ruleNewParam.setRuleName("默认规则");
ruleNewParam.setIsDefault(Integer.valueOf(1));
add(ruleNewParam, context);
passRuleResult = this.acsPassRuleDao.page(dto, page);
}
List<AcsPassRuleResult> results =
coverRulePageResult((List<AcsPassRuleResultDto>)passRuleResult.getDatas(), context, true);
return CloudwalkResult.success(new CloudwalkPageAble(results, page, passRuleResult.getTotalRows()));
} catch (DataAccessException e) {
this.logger.error("分页查询通行规则失败");
throw new ServiceException("76260508", getMessage("76260508"));
}
}
public CloudwalkResult<List<AcsPassRuleResult>> list(AcsPassRuleQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsPassRuleQueryDto dto = new AcsPassRuleQueryDto();
BeanCopyUtils.copyProperties(param, dto);
dto.setBusinessId(context.getCompany().getCompanyId());
List<AcsPassRuleResultDto> passRuleResult = this.acsPassRuleDao.list(dto);
return CloudwalkResult.success(coverRulePageResult(passRuleResult, context, false));
} catch (DataAccessException e) {
this.logger.error("查询通行规则失败");
throw new ServiceException("76260508", getMessage("76260508"));
}
}
public CloudwalkResult<List<AcsPassRuleImageResultDto>> listByImageId(AcsPassRuleImageParam param,
CloudwalkCallContext context) throws ServiceException {
try {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
BeanCopyUtils.copyProperties(param, dto);
List<AcsPassRuleImageResultDto> resultDtos = this.acsPassRuleDao.listByImageId(dto);
return CloudwalkResult.success(resultDtos);
} catch (DataAccessException e) {
this.logger.error("根据图库id集合查询对应楼层信息失败");
throw new ServiceException("76260526", getMessage("76260526"));
}
}
private void getZoneTypeIsThree(ZoneTreeResult zoneTreeResult, List<AcsPassRuleFloorResult> passRuleResults) {
if ("FLOOR".equals(zoneTreeResult.getType())) {
AcsPassRuleFloorResult result = new AcsPassRuleFloorResult();
result.setId(zoneTreeResult.getId());
result.setName(zoneTreeResult.getName());
result.setUnitNumber(zoneTreeResult.getUnitCount());
passRuleResults.add(result);
} else if (!CollectionUtils.isEmpty(zoneTreeResult.getChildren())) {
for (ZoneTreeResult treeResult : zoneTreeResult.getChildren())
getZoneTypeIsThree(treeResult, passRuleResults);
}
}
}
@@ -0,0 +1,779 @@
package cn.cloudwalk.elevator.passrule.impl;
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.param.ImageStorePersonQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStoreQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.UpdateGroupPersonRefParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStoreDetailResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImgStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStorePersonService;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.param.LabelDetailParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelDetailResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.service.LabelService;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.param.OrganizationListParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.result.OrganizationResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.service.OrganizationService;
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.page.CloudwalkPageAble;
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
import cn.cloudwalk.elevator.device.dao.AcsElevatorDeviceDao;
import cn.cloudwalk.elevator.device.dao.DeviceImageStoreDao;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListByBuildingIdDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.em.AcsPassTypeEnum;
import cn.cloudwalk.elevator.passrule.dao.ImageRuleRefDao;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleImageResultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRulePersonListDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRulePersonListResultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleQueryDto;
import cn.cloudwalk.elevator.passrule.dto.ImageRuleRefAddDto;
import cn.cloudwalk.elevator.passrule.dto.ImageRuleRefListResult;
import cn.cloudwalk.elevator.passrule.dto.ImageRuleRefResultDto;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleDeleteParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleEditParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleFloorParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleImageParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleNewParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRulePersonListParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleQueryParam;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleFloorResult;
import cn.cloudwalk.elevator.passrule.result.ImageRuleRefDetailResult;
import cn.cloudwalk.elevator.passrule.result.ImageRuleRefPageResult;
import cn.cloudwalk.elevator.passrule.service.ImageRuleRefService;
import cn.cloudwalk.elevator.person.param.AcsPersonQueryParam;
import cn.cloudwalk.elevator.person.result.AcsPersonResult;
import cn.cloudwalk.elevator.person.service.PersonRuleService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.zone.param.ZoneQueryParam;
import cn.cloudwalk.elevator.zone.result.ZoneResult;
import cn.cloudwalk.elevator.zone.service.ZoneService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
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.ObjectUtils;
@Service
public class ImageRuleRefServiceImpl extends AbstractAcsPassService implements ImageRuleRefService {
@Autowired
private ImageStorePersonService imageStorePersonService;
@Autowired
private OrganizationService organizationService;
@Autowired
private LabelService labelService;
@Resource
private ImageRuleRefDao imageRuleRefDao;
@Resource
private DeviceImageStoreDao deviceImageStoreDao;
@Resource
private ImageStoreService imageStoreService;
@Resource
private ZoneService zoneService;
@Resource
private AcsElevatorDeviceDao acsElevatorDeviceDao;
@Resource
private PersonRuleService personRuleService;
public CloudwalkResult<CloudwalkPageAble<ImageRuleRefPageResult>> page(AcsPassRuleQueryParam param,
CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException {
try {
AcsPassRuleQueryDto dto = new AcsPassRuleQueryDto();
dto.setZoneId(param.getZoneId());
dto.setBusinessId(context.getCompany().getCompanyId());
CloudwalkPageAble<ImageRuleRefResultDto> passRuleResult = this.imageRuleRefDao.page(dto, page);
if (CollectionUtils.isEmpty(passRuleResult.getDatas()) && ObjectUtils.isEmpty(param.getIsDefault())) {
AcsPassRuleNewParam ruleNewParam = new AcsPassRuleNewParam();
ruleNewParam.setZoneId(param.getZoneId());
ruleNewParam.setZoneName(param.getZoneName());
ruleNewParam.setRuleName("默认规则");
ruleNewParam.setIsDefault(Integer.valueOf(1));
ruleNewParam.setParentId(param.getParentId());
addOnlyRule(ruleNewParam, context);
passRuleResult = this.imageRuleRefDao.page(dto, page);
}
List<ImageRuleRefPageResult> results = coverRulePageResult(
(List<ImageRuleRefResultDto>)passRuleResult.getDatas(), param.getParentId(), context);
return CloudwalkResult.success(new CloudwalkPageAble(results, page, passRuleResult.getTotalRows()));
} catch (Exception e) {
this.logger.error("分页查询通行规则失败", e);
throw new ServiceException("76260508", getMessage("76260508"));
}
}
public CloudwalkResult<CloudwalkPageAble<AcsPassRuleFloorResult>> listFloor(AcsPassRuleFloorParam param,
CloudwalkCallContext context) throws ServiceException {
ZoneQueryParam queryParam = new ZoneQueryParam();
queryParam.setParentId(param.getZoneId());
queryParam.setRowsOfPage(param.getRowsOfPage());
queryParam.setCurrentPage(param.getCurrentPage());
CloudwalkResult<CloudwalkPageAble<ZoneResult>> zonePageData = this.zoneService.page(queryParam, context);
if (!zonePageData.isSuccess()) {
this.logger.info("远程调用分页查询区域失败,原因:" + zonePageData.getMessage());
throw new ServiceException(zonePageData.getCode(), zonePageData.getMessage());
}
try {
CloudwalkPageInfo page = new CloudwalkPageInfo(param.getCurrentPage(), param.getRowsOfPage());
CloudwalkPageAble<AcsPassRuleFloorResult> ruleFloorResult = null;
if (!ObjectUtils.isEmpty(zonePageData.getData())
&& !CollectionUtils.isEmpty(((CloudwalkPageAble)zonePageData.getData()).getDatas())) {
List<AcsPassRuleFloorResult> resultList = BeanCopyUtils
.copy(((CloudwalkPageAble)zonePageData.getData()).getDatas(), AcsPassRuleFloorResult.class);
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getZoneId());
for (AcsPassRuleFloorResult floorResult : resultList) {
AcsElevatorDeviceListDto dto = new AcsElevatorDeviceListDto();
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setCurrentFloorId(floorResult.getId());
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.listByZoneId(dto);
floorResult.setDeviceNumber(Integer.valueOf(deviceList.size()));
Long number = Long.valueOf(0L);
floorResult.setPersonNumber(number);
if (!ObjectUtils.isEmpty(imageStoreId)) {
AcsPersonQueryParam personQueryParam = new AcsPersonQueryParam();
personQueryParam.setImageStoreId(imageStoreId);
personQueryParam.setZoneId(floorResult.getId());
personQueryParam.setParentId(param.getZoneId());
CloudwalkPageInfo pageInfo = new CloudwalkPageInfo(1, 10);
CloudwalkResult<CloudwalkPageAble<AcsPersonResult>> result =
this.personRuleService.page(personQueryParam, pageInfo, context);
floorResult.setPersonNumber(Long.valueOf(((CloudwalkPageAble)result.getData()).getTotalRows()));
}
}
ruleFloorResult =
new CloudwalkPageAble(resultList, page, ((CloudwalkPageAble)zonePageData.getData()).getTotalRows());
}
return CloudwalkResult.success(ruleFloorResult);
} catch (DataAccessException e) {
this.logger.error("查询所有楼层信息失败", (Throwable)e);
throw new ServiceException("76260520", getMessage("76260520"));
}
}
public CloudwalkResult<List<AcsPassRuleImageResultDto>> listByPersonInfo(AcsPassRuleImageParam param,
CloudwalkCallContext context) throws ServiceException {
try {
AcsPassRuleImageDto dto = new AcsPassRuleImageDto();
BeanCopyUtils.copyProperties(param, dto);
List<AcsPassRuleImageResultDto> resultDtos = this.imageRuleRefDao.listByPersonInfo(dto);
return CloudwalkResult.success(resultDtos);
} catch (DataAccessException e) {
this.logger.error("根据人员id、标签集合、机构集合获取楼层权限失败", (Throwable)e);
throw new ServiceException("76260526", getMessage("76260526"));
}
}
public CloudwalkResult<List<AcsPassRulePersonListResultDto>> listByPersonList(AcsPassRulePersonListParam param,
CloudwalkCallContext context) throws ServiceException {
try {
AcsPassRulePersonListDto dto = new AcsPassRulePersonListDto();
List<String> personIds = new ArrayList<>();
List<String> labelIds = new ArrayList<>();
List<String> orgIds = new ArrayList<>();
for (AcsPassRuleImageParam imageParam : param.getPersonList()) {
personIds.add(imageParam.getPersonId());
if (!CollectionUtils.isEmpty(imageParam.getIncludeLabels())) {
labelIds.addAll(imageParam.getIncludeLabels());
}
if (!CollectionUtils.isEmpty(imageParam.getIncludeOrganizations())) {
orgIds.addAll(imageParam.getIncludeOrganizations());
}
}
dto.setPersonIds(personIds);
dto.setIncludeLabels(labelIds);
dto.setIncludeOrganizations(orgIds);
List<ImageRuleRefResultDto> resultDtos = this.imageRuleRefDao.listByPersonList(dto);
Map<String, List<ImageRuleRefResultDto>> personIdMap = new HashMap<>();
Map<String, List<ImageRuleRefResultDto>> labelIdMap = new HashMap<>();
Map<String, List<ImageRuleRefResultDto>> orgIdMap = new HashMap<>();
for (ImageRuleRefResultDto resultDto : resultDtos) {
if (!ObjectUtils.isEmpty(resultDto.getPersonId())) {
List<ImageRuleRefResultDto> personList = personIdMap.get(resultDto.getPersonId());
if (!CollectionUtils.isEmpty(personList)) {
personList.add(resultDto);
continue;
}
List<ImageRuleRefResultDto> personListDto = new ArrayList<>();
personListDto.add(resultDto);
personIdMap.put(resultDto.getPersonId(), personListDto);
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeLabels())) {
List<ImageRuleRefResultDto> labelList = labelIdMap.get(resultDto.getIncludeLabels());
if (!CollectionUtils.isEmpty(labelList)) {
labelList.add(resultDto);
continue;
}
List<ImageRuleRefResultDto> labelListDto = new ArrayList<>();
labelListDto.add(resultDto);
labelIdMap.put(resultDto.getIncludeLabels(), labelListDto);
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeOrganizations())) {
List<ImageRuleRefResultDto> orgList = orgIdMap.get(resultDto.getIncludeOrganizations());
if (!CollectionUtils.isEmpty(orgList)) {
orgList.add(resultDto);
continue;
}
List<ImageRuleRefResultDto> orgListDto = new ArrayList<>();
orgListDto.add(resultDto);
orgIdMap.put(resultDto.getIncludeOrganizations(), orgListDto);
}
}
List<AcsPassRulePersonListResultDto> returnList = new ArrayList<>();
for (AcsPassRuleImageParam imageParam : param.getPersonList()) {
List<String> zoneIdList = this.imageRuleRefDao.listPersonDelByPersonId(imageParam.getPersonId());
AcsPassRulePersonListResultDto listResultDto = new AcsPassRulePersonListResultDto();
listResultDto.setPersonId(imageParam.getPersonId());
List<AcsPassRuleImageResultDto> zoneList = new ArrayList<>();
List<String> listZoneIds = new ArrayList<>();
List<ImageRuleRefResultDto> personMapDto = personIdMap.get(imageParam.getPersonId());
if (!CollectionUtils.isEmpty(personMapDto)) {
for (ImageRuleRefResultDto resultDto : personMapDto) {
if (!zoneIdList.contains(resultDto.getZoneId())) {
listZoneIds.add(resultDto.getZoneId());
AcsPassRuleImageResultDto result = new AcsPassRuleImageResultDto();
result.setZoneId(resultDto.getZoneId());
result.setZoneName(resultDto.getZoneName());
zoneList.add(result);
}
}
}
if (!CollectionUtils.isEmpty(imageParam.getIncludeLabels())) {
for (String labelId : imageParam.getIncludeLabels()) {
List<ImageRuleRefResultDto> labelMapDto = labelIdMap.get(labelId);
if (!CollectionUtils.isEmpty(labelMapDto)) {
for (ImageRuleRefResultDto resultDto : labelMapDto) {
if (!zoneIdList.contains(resultDto.getZoneId())
&& !listZoneIds.contains(resultDto.getZoneId())) {
listZoneIds.add(resultDto.getZoneId());
AcsPassRuleImageResultDto result = new AcsPassRuleImageResultDto();
result.setZoneId(resultDto.getZoneId());
result.setZoneName(resultDto.getZoneName());
zoneList.add(result);
}
}
}
}
}
if (!CollectionUtils.isEmpty(imageParam.getIncludeOrganizations())) {
for (String orgId : imageParam.getIncludeOrganizations()) {
List<ImageRuleRefResultDto> orgMapDto = orgIdMap.get(orgId);
if (!CollectionUtils.isEmpty(orgMapDto)) {
for (ImageRuleRefResultDto resultDto : orgMapDto) {
if (!zoneIdList.contains(resultDto.getZoneId())
&& !listZoneIds.contains(resultDto.getZoneId())) {
listZoneIds.add(resultDto.getZoneId());
AcsPassRuleImageResultDto result = new AcsPassRuleImageResultDto();
result.setZoneId(resultDto.getZoneId());
result.setZoneName(resultDto.getZoneName());
zoneList.add(result);
}
}
}
}
}
listResultDto.setZoneList(zoneList);
returnList.add(listResultDto);
}
return CloudwalkResult.success(returnList);
} catch (DataAccessException e) {
this.logger.error("根据人员id、标签集合、机构集合批量获取楼层权限失败", (Throwable)e);
throw new ServiceException("76260526", getMessage("76260526"));
}
}
public CloudwalkResult<ImageRuleRefDetailResult> detail(AcsPassRuleQueryParam param, CloudwalkCallContext context)
throws ServiceException {
try {
ImageRuleRefResultDto byId = this.imageRuleRefDao.getById(param.getId());
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
List<ImageRuleRefResultDto> child =
this.imageRuleRefDao.listByParentRule(Collections.singletonList(param.getId()));
if (!CollectionUtils.isEmpty(child)) {
for (ImageRuleRefResultDto resultDto : child) {
if (!ObjectUtils.isEmpty(resultDto.getIncludeLabels())) {
includeLabels.add(resultDto.getIncludeLabels());
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeOrganizations())) {
includeOrganizations.add(resultDto.getIncludeOrganizations());
}
}
}
ImageRuleRefDetailResult result =
(ImageRuleRefDetailResult)BeanCopyUtils.copyProperties(byId, ImageRuleRefDetailResult.class);
result.setRuleName(byId.getName());
if (!CollectionUtils.isEmpty(includeLabels)) {
List<LabelDetailResult> labelDetailResultList = new ArrayList<>();
for (String label : includeLabels) {
LabelDetailParam labelDetailParam = new LabelDetailParam();
labelDetailParam.setId(label);
CloudwalkResult<LabelDetailResult> detail = this.labelService.detail(labelDetailParam, context);
labelDetailResultList.add(detail.getData());
}
result.setIncludeLabels(labelDetailResultList);
}
if (!CollectionUtils.isEmpty(includeOrganizations)) {
OrganizationListParam orgParam = new OrganizationListParam();
orgParam.setIds(includeOrganizations);
CloudwalkResult<List<OrganizationResult>> orglist = this.organizationService.list(orgParam, context);
result.setIncludeOrganizations((List)orglist.getData());
}
return CloudwalkResult.success(result);
} catch (DataAccessException e) {
this.logger.error("查询通行规则详情失败", (Throwable)e);
throw new ServiceException("76260508", getMessage("76260508"));
}
}
@CloudwalkParamsValidate(argsIndexs = {0, 1})
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public CloudwalkResult<Boolean> addOnlyRule(AcsPassRuleNewParam param, CloudwalkCallContext context)
throws ServiceException {
try {
AcsElevatorDeviceListByBuildingIdDto buildingIdDto = new AcsElevatorDeviceListByBuildingIdDto();
buildingIdDto.setCurrentBuildingId(param.getParentId());
buildingIdDto.setBusinessId(context.getCompany().getCompanyId());
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.listBuBuildingId(buildingIdDto);
if (CollectionUtils.isEmpty(deviceList)) {
return CloudwalkResult.fail("76260527", getMessage("76260527"));
}
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
ImageRuleRefAddDto addDto = createAddDto(param, context);
this.imageRuleRefDao.insert(addDto);
if (!ObjectUtils.isEmpty(param.getIsDefault()) && param.getIsDefault().intValue() == 1) {
return CloudwalkResult.success(Boolean.valueOf(true));
}
ImageStoreQueryParam queryParam = new ImageStoreQueryParam();
queryParam.setId(imageStoreId);
queryParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<ImageStoreDetailResult> imageDetail = this.imageStoreService.detail(queryParam, context);
ImageStoreEditParam editParam =
(ImageStoreEditParam)BeanCopyUtils.copyProperties(imageDetail.getData(), ImageStoreEditParam.class);
editParam.setImageStoreId(((ImageStoreDetailResult)imageDetail.getData()).getId());
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getIncludePersons())) {
List<ImageStorePersonData> includePersons = new ArrayList<>();
for (ImgStorePersonResult personResult : ((ImageStoreDetailResult)imageDetail.getData())
.getIncludePersons()) {
ImageStorePersonData data = new ImageStorePersonData();
data.setObjectId(personResult.getId());
includePersons.add(data);
}
editParam.setIncludePersons(includePersons);
}
List<String> oldIncludeLabels = new ArrayList<>();
List<String> oldIncludeOrganizations = new ArrayList<>();
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getIncludeLabels())) {
for (LabelResult labelResult : ((ImageStoreDetailResult)imageDetail.getData()).getIncludeLabels()) {
oldIncludeLabels.add(labelResult.getId());
}
}
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getIncludeOrganizations())) {
for (OrganizationResult organizationResult : ((ImageStoreDetailResult)imageDetail.getData())
.getIncludeOrganizations()) {
oldIncludeOrganizations.add(organizationResult.getId());
}
}
if (!CollectionUtils.isEmpty(param.getIncludeLabels())) {
for (String label : param.getIncludeLabels()) {
ImageRuleRefAddDto dto = createAddDto(param, context);
dto.setParentRule(addDto.getId());
dto.setIncludeLabels(label);
this.imageRuleRefDao.insert(dto);
if (!oldIncludeLabels.contains(label)) {
includeLabels.add(label);
}
}
}
if (!CollectionUtils.isEmpty(param.getIncludeOrganizations())) {
for (String org : param.getIncludeOrganizations()) {
ImageRuleRefAddDto dto = createAddDto(param, context);
dto.setParentRule(addDto.getId());
dto.setIncludeOrganizations(org);
this.imageRuleRefDao.insert(dto);
if (!oldIncludeOrganizations.contains(org)) {
includeOrganizations.add(org);
}
}
}
if (!CollectionUtils.isEmpty(includeLabels) || !CollectionUtils.isEmpty(includeOrganizations)) {
includeLabels.addAll(oldIncludeLabels);
includeOrganizations.addAll(oldIncludeOrganizations);
editParam.setIncludeLabels(includeLabels);
editParam.setIncludeOrganizations(includeOrganizations);
editParam.setBusinessId(context.getCompany().getCompanyId());
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getExcludePersons())) {
List<String> excPersonIds = new ArrayList<>();
for (ImgStorePersonResult personResult : ((ImageStoreDetailResult)imageDetail.getData())
.getExcludePersons()) {
excPersonIds.add(personResult.getId());
}
editParam.setExcludePersons(excPersonIds);
}
CloudwalkResult<Boolean> edit = this.imageStoreService.edit(editParam, context);
if (ObjectUtils.isEmpty(edit.getData()) || !((Boolean)edit.getData()).booleanValue()) {
throw new ServiceException(edit.getCode(), edit.getMessage());
}
}
UpdateGroupPersonRefParam refParam = new UpdateGroupPersonRefParam();
refParam.setImageStoreId(imageStoreId);
refParam.setBusinessId(context.getCompany().getCompanyId());
refParam.setLabelIds(param.getIncludeLabels());
refParam.setOrganizationIds(param.getIncludeOrganizations());
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (DataAccessException e) {
this.logger.error("添加通行规则失败", (Throwable)e);
throw new ServiceException("76260505", getMessage("76260505"));
}
}
public CloudwalkResult<Boolean> update(AcsPassRuleEditParam param, CloudwalkCallContext context)
throws ServiceException {
checkDefaultRule(param.getId());
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
ImageStoreQueryParam queryParam = new ImageStoreQueryParam();
queryParam.setId(imageStoreId);
queryParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<ImageStoreDetailResult> imageDetail = this.imageStoreService.detail(queryParam, context);
ImageStoreEditParam editParam =
(ImageStoreEditParam)BeanCopyUtils.copyProperties(imageDetail.getData(), ImageStoreEditParam.class);
editParam.setImageStoreId(imageStoreId);
List<String> oldIncludeLabels = new ArrayList<>();
List<String> oldIncludeOrganizations = new ArrayList<>();
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
List<String> includeLabels2 = new ArrayList<>();
List<String> includeOrganizations2 = new ArrayList<>();
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getIncludeLabels())) {
for (LabelResult labelResult : ((ImageStoreDetailResult)imageDetail.getData()).getIncludeLabels()) {
oldIncludeLabels.add(labelResult.getId());
}
}
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getIncludeOrganizations())) {
for (OrganizationResult organizationResult : ((ImageStoreDetailResult)imageDetail.getData())
.getIncludeOrganizations()) {
oldIncludeOrganizations.add(organizationResult.getId());
}
}
try {
List<ImageRuleRefResultDto> oldRule =
this.imageRuleRefDao.listByParentRule(Collections.singletonList(param.getId()));
List<String> updateLabels = new ArrayList<>(param.getIncludeLabels());
List<String> updateOrgIds = new ArrayList<>(param.getIncludeOrganizations());
Boolean isTrue = Boolean.valueOf(true);
if (!CollectionUtils.isEmpty(oldRule)) {
for (ImageRuleRefResultDto dto : oldRule) {
if (!ObjectUtils.isEmpty(dto.getIncludeLabels())
&& !updateLabels.contains(dto.getIncludeLabels())) {
updateLabels.add(dto.getIncludeLabels());
isTrue = Boolean.valueOf(false);
}
if (!ObjectUtils.isEmpty(dto.getIncludeOrganizations())
&& !updateOrgIds.contains(dto.getIncludeOrganizations())) {
updateOrgIds.add(dto.getIncludeOrganizations());
isTrue = Boolean.valueOf(false);
}
}
}
this.imageRuleRefDao.deleteById(param.getId());
ImageRuleRefAddDto addDto = createUpdateDto(param, context);
this.imageRuleRefDao.insert(addDto);
if (!CollectionUtils.isEmpty(param.getIncludeLabels())) {
for (String label : param.getIncludeLabels()) {
ImageRuleRefAddDto dto = createUpdateDto(param, context);
dto.setIncludeLabels(label);
dto.setParentRule(addDto.getId());
this.imageRuleRefDao.insert(dto);
if (!editParam.getIncludeLabels().contains(label)) {
includeLabels.add(label);
includeLabels2.add(label);
}
}
}
if (!CollectionUtils.isEmpty(param.getExcludeLabels())) {
for (String label : param.getExcludeLabels()) {
ImageRuleRefAddDto dto = createUpdateDto(param, context);
dto.setExcludeLabels(label);
dto.setParentRule(addDto.getId());
this.imageRuleRefDao.insert(dto);
}
}
if (!CollectionUtils.isEmpty(param.getIncludeOrganizations())) {
for (String org : param.getIncludeOrganizations()) {
ImageRuleRefAddDto dto = createUpdateDto(param, context);
dto.setIncludeOrganizations(org);
dto.setParentRule(addDto.getId());
this.imageRuleRefDao.insert(dto);
if (!editParam.getIncludeOrganizations().contains(org)) {
includeOrganizations.add(org);
includeOrganizations2.add(org);
}
}
}
if (!CollectionUtils.isEmpty(includeLabels) || !CollectionUtils.isEmpty(includeOrganizations)) {
includeLabels.addAll(oldIncludeLabels);
includeOrganizations.addAll(oldIncludeOrganizations);
editParam.setIncludeLabels(includeLabels);
editParam.setIncludeOrganizations(includeOrganizations);
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getExcludePersons())) {
List<String> excPersonIds = new ArrayList<>();
for (ImgStorePersonResult personResult : ((ImageStoreDetailResult)imageDetail.getData())
.getExcludePersons()) {
excPersonIds.add(personResult.getId());
}
editParam.setExcludePersons(excPersonIds);
}
if (!CollectionUtils.isEmpty(((ImageStoreDetailResult)imageDetail.getData()).getIncludePersons())) {
List<ImageStorePersonData> includePersons = new ArrayList<>();
for (ImgStorePersonResult personResult : ((ImageStoreDetailResult)imageDetail.getData())
.getIncludePersons()) {
ImageStorePersonData personData = new ImageStorePersonData();
personData.setObjectId(personResult.getId());
includePersons.add(personData);
}
editParam.setIncludePersons(includePersons);
}
editParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult cloudwalkResult = this.imageStoreService.edit(editParam, context);
}
if (!isTrue.booleanValue()) {
UpdateGroupPersonRefParam refParam = new UpdateGroupPersonRefParam();
refParam.setImageStoreId(imageStoreId);
refParam.setBusinessId(context.getCompany().getCompanyId());
refParam.setLabelIds(updateLabels);
refParam.setOrganizationIds(updateOrgIds);
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
}
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (DataAccessException e) {
this.logger.error("添加通行规则失败", (Throwable)e);
throw new ServiceException("76260505", getMessage("76260505"));
}
}
public CloudwalkResult<Boolean> delete(AcsPassRuleDeleteParam param, CloudwalkCallContext context)
throws ServiceException {
try {
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
for (String id : param.getIds()) {
checkDefaultRule(id);
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
List<ImageRuleRefResultDto> child =
this.imageRuleRefDao.listByParentRule(Collections.singletonList(id));
if (!CollectionUtils.isEmpty(child)) {
for (ImageRuleRefResultDto resultDto : child) {
if (!ObjectUtils.isEmpty(resultDto.getIncludeLabels())) {
includeLabels.add(resultDto.getIncludeLabels());
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeOrganizations())) {
includeOrganizations.add(resultDto.getIncludeOrganizations());
}
}
}
this.imageRuleRefDao.deleteById(id);
UpdateGroupPersonRefParam refParam = new UpdateGroupPersonRefParam();
refParam.setBusinessId(context.getCompany().getCompanyId());
refParam.setImageStoreId(imageStoreId);
refParam.setLabelIds(includeLabels);
refParam.setOrganizationIds(includeOrganizations);
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
}
return CloudwalkResult.success(Boolean.valueOf(true));
} catch (DataAccessException e) {
this.logger.error("通行规则删除失败", (Throwable)e);
throw new ServiceException("76260507", getMessage("76260507"));
}
}
private List<ImageRuleRefPageResult> coverRulePageResult(List<ImageRuleRefResultDto> datas, String parentId,
CloudwalkCallContext context) throws Exception {
List<ImageRuleRefPageResult> detailResultList = new ArrayList<>();
if (CollectionUtils.isEmpty(datas)) {
return detailResultList;
}
List<String> personSum =
this.imageRuleRefDao.countPersonIdByZoneId(((ImageRuleRefResultDto)datas.get(0)).getZoneId());
for (ImageRuleRefResultDto data : datas) {
ImageRuleRefPageResult detailResult = new ImageRuleRefPageResult();
AcsPersonQueryParam personQueryParam = new AcsPersonQueryParam();
BeanCopyUtils.copyProperties(data, detailResult);
detailResult.setRuleName(data.getName());
detailResult.setPassType(AcsPassTypeEnum.LONG_TIME.getCode());
if (data.getIsDefault().intValue() == 1) {
detailResult.setPersonSum(personSum.size());
} else {
personQueryParam.setDelPersonIds(personSum);
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
List<ImageRuleRefResultDto> child =
this.imageRuleRefDao.listByParentRule(Collections.singletonList(data.getId()));
if (!CollectionUtils.isEmpty(child)) {
for (ImageRuleRefResultDto resultDto : child) {
if (!ObjectUtils.isEmpty(resultDto.getIncludeLabels())) {
includeLabels.add(resultDto.getIncludeLabels());
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeOrganizations())) {
includeOrganizations.add(resultDto.getIncludeOrganizations());
}
}
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(parentId);
personQueryParam.setImageStoreId(imageStoreId);
personQueryParam.setLabelIds(includeLabels);
personQueryParam.setOrganizationIds(includeOrganizations);
if (!CollectionUtils.isEmpty(personQueryParam.getOrganizationIds())
&& !CollectionUtils.isEmpty(personQueryParam.getLabelIds())) {
personQueryParam.setIsElevator(Integer.valueOf(3));
} else if (!CollectionUtils.isEmpty(personQueryParam.getOrganizationIds())) {
personQueryParam.setIsElevator(Integer.valueOf(1));
} else if (!CollectionUtils.isEmpty(personQueryParam.getLabelIds())) {
personQueryParam.setIsElevator(Integer.valueOf(2));
}
CloudwalkPageInfo page = new CloudwalkPageInfo(1, 10);
CloudwalkPageAble<ImageStorePersonResult> pageResult =
getImageStorePerson(personQueryParam, page, context);
List<String> delPerson = this.imageRuleRefDao.listPersonDelByZoneId(data.getZoneId());
if (!ObjectUtils.isEmpty(pageResult.getDatas())) {
detailResult.setPersonSum(Math.toIntExact(pageResult.getTotalRows()) - delPerson.size());
} else {
detailResult.setPersonSum(0);
}
if (!CollectionUtils.isEmpty(includeLabels)) {
List<LabelDetailResult> labelDetailResultList = new ArrayList<>();
for (String label : includeLabels) {
LabelDetailParam param = new LabelDetailParam();
param.setId(label);
CloudwalkResult<LabelDetailResult> detail = this.labelService.detail(param, context);
labelDetailResultList.add(detail.getData());
}
detailResult.setIncludeLabels(labelDetailResultList);
}
if (!CollectionUtils.isEmpty(includeOrganizations)) {
OrganizationListParam orgParam = new OrganizationListParam();
orgParam.setIds(includeOrganizations);
CloudwalkResult<List<OrganizationResult>> orglist =
this.organizationService.list(orgParam, context);
detailResult.setIncludeOrganizations((List)orglist.getData());
}
}
}
detailResultList.add(detailResult);
}
return detailResultList;
}
private CloudwalkPageAble<ImageStorePersonResult> getImageStorePerson(AcsPersonQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
CloudwalkPageAble<ImageStorePersonResult> results = new CloudwalkPageAble();
ImageStorePersonQueryParam imageStorePersonQueryParam = new ImageStorePersonQueryParam();
imageStorePersonQueryParam.setImageStoreId(param.getImageStoreId());
imageStorePersonQueryParam.setOrganizationIds(param.getOrganizationIds());
imageStorePersonQueryParam.setLabelIds(param.getLabelIds());
imageStorePersonQueryParam.setCurrentPage(pageInfo.getCurrentPage());
imageStorePersonQueryParam.setRowsOfPage(pageInfo.getPageSize());
imageStorePersonQueryParam.setIsElevator(param.getIsElevator());
imageStorePersonQueryParam.setDelPersonIds(param.getDelPersonIds());
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> pageResult =
this.imageStorePersonService.page(imageStorePersonQueryParam, context);
if (!pageResult.isSuccess()) {
this.logger.error("远程调用查询图库人员失败,原因:[{}]", pageResult.getMessage());
throw new ServiceException(pageResult.getCode(), pageResult.getMessage());
}
if (!CollectionUtils.isEmpty(((CloudwalkPageAble)pageResult.getData()).getDatas())) {
results = (CloudwalkPageAble<ImageStorePersonResult>)pageResult.getData();
}
return results;
}
private ImageRuleRefListResult refListByZoneId(String zoneId) {
ImageRuleRefListResult listResult = new ImageRuleRefListResult();
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
List<String> parentRuleList = this.imageRuleRefDao.listRuleByZoneIdExtDefault(zoneId);
if (!CollectionUtils.isEmpty(parentRuleList)) {
List<ImageRuleRefResultDto> child = this.imageRuleRefDao.listByParentRule(parentRuleList);
if (!CollectionUtils.isEmpty(child)) {
for (ImageRuleRefResultDto resultDto : child) {
if (!ObjectUtils.isEmpty(resultDto.getIncludeLabels())) {
includeLabels.add(resultDto.getExcludeLabels());
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeOrganizations())) {
includeOrganizations.add(resultDto.getIncludeOrganizations());
}
}
}
}
listResult.setIncludeLabels(includeLabels);
listResult.setIncludeOrganizations(includeOrganizations);
return listResult;
}
private ImageRuleRefAddDto createAddDto(AcsPassRuleNewParam param, CloudwalkCallContext context) {
ImageRuleRefAddDto dto = new ImageRuleRefAddDto();
dto.setId(genUUID());
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setName(param.getRuleName());
dto.setZoneId(param.getZoneId());
dto.setZoneName(param.getZoneName());
dto.setStartTime(param.getStartTime());
dto.setEndTime(param.getEndTime());
if (!ObjectUtils.isEmpty(param.getIsDefault())) {
dto.setIsDefault(param.getIsDefault());
} else {
dto.setIsDefault(Integer.valueOf(0));
}
dto.setCreateTime(Long.valueOf(System.currentTimeMillis()));
dto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis()));
return dto;
}
private ImageRuleRefAddDto createUpdateDto(AcsPassRuleEditParam param, CloudwalkCallContext context) {
ImageRuleRefAddDto dto = new ImageRuleRefAddDto();
dto.setId(genUUID());
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setName(param.getRuleName());
dto.setZoneId(param.getZoneId());
dto.setZoneName(param.getZoneName());
dto.setStartTime(param.getStartTime());
dto.setEndTime(param.getEndTime());
dto.setCreateTime(Long.valueOf(System.currentTimeMillis()));
dto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis()));
dto.setIsDefault(Integer.valueOf(0));
return dto;
}
private ImageRuleRefResultDto checkDefaultRule(String id) throws ServiceException {
try {
ImageRuleRefResultDto resultDto = this.imageRuleRefDao.getById(id);
if (!ObjectUtils.isEmpty(resultDto.getIsDefault()) && resultDto.getIsDefault().intValue() == 1) {
throw new ServiceException("派梯默认规则不可编辑和删除");
}
return resultDto;
} catch (DataAccessException e) {
throw new ServiceException("派梯默认规则不可编辑和删除");
}
}
}
@@ -0,0 +1,37 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
import org.hibernate.validator.constraints.NotEmpty;
public class AcsPassRuleDeleteParam implements Serializable {
private static final long serialVersionUID = -40026518356914854L;
@NotEmpty(message = "76260515")
private List<String> ids;
private String zoneId;
private String parentId;
public List<String> getIds() {
return this.ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
}
@@ -0,0 +1,112 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPassRuleEditParam implements Serializable {
private static final long serialVersionUID = 924203126937866288L;
@NotBlank(message = "76260515")
private String id;
private String parentId;
private String zoneId;
private String zoneName;
@NotBlank(message = "76260514")
@Size(min = 1, max = 32, message = "76260518")
private String ruleName;
private String oldName;
private List<String> includeOrganizations;
private List<String> includeLabels;
private List<String> excludeLabels;
private Long startTime;
private Long endTime;
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getOldName() {
return this.oldName;
}
public void setOldName(String oldName) {
this.oldName = oldName;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public String getRuleName() {
return this.ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public List<String> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<String> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<String> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<String> includeLabels) {
this.includeLabels = includeLabels;
}
public List<String> getExcludeLabels() {
return this.excludeLabels;
}
public void setExcludeLabels(List<String> excludeLabels) {
this.excludeLabels = excludeLabels;
}
public Long getStartTime() {
return this.startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return this.endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
}
@@ -0,0 +1,17 @@
package cn.cloudwalk.elevator.passrule.param;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
public class AcsPassRuleFloorParam extends CloudwalkBasePageForm implements Serializable {
private static final long serialVersionUID = 137892620174267456L;
private String zoneId;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
}
@@ -0,0 +1,53 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
public class AcsPassRuleImageParam implements Serializable {
private static final long serialVersionUID = -52687427633888290L;
private List<String> imageStoreIds;
private String businessId;
private String personId;
private List<String> includeOrganizations;
private List<String> includeLabels;
public List<String> getImageStoreIds() {
return this.imageStoreIds;
}
public void setImageStoreIds(List<String> imageStoreIds) {
this.imageStoreIds = imageStoreIds;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getPersonId() {
return this.personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public List<String> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<String> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<String> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<String> includeLabels) {
this.includeLabels = includeLabels;
}
}
@@ -0,0 +1,16 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
public class AcsPassRuleIsDefaultParam implements Serializable {
private static final long serialVersionUID = 137892620174267456L;
private String zoneId;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
}
@@ -0,0 +1,102 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPassRuleNewParam implements Serializable {
private static final long serialVersionUID = 137892620174267456L;
private String parentId;
private String zoneId;
private String zoneName;
@NotBlank(message = "76260514")
@Size(min = 1, max = 32, message = "76260518")
private String ruleName;
private List<String> includeLabels;
private List<String> includeOrganizations;
private List<String> excludeLabels;
private Long startTime;
private Long endTime;
private Integer isDefault;
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public String getRuleName() {
return this.ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public List<String> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<String> includeLabels) {
this.includeLabels = includeLabels;
}
public List<String> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<String> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<String> getExcludeLabels() {
return this.excludeLabels;
}
public void setExcludeLabels(List<String> excludeLabels) {
this.excludeLabels = excludeLabels;
}
public Long getStartTime() {
return this.startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return this.endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public Integer getIsDefault() {
return this.isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
}
@@ -0,0 +1,18 @@
package cn.cloudwalk.elevator.passrule.param;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
import java.util.List;
public class AcsPassRulePersonListParam extends CloudwalkBasePageForm implements Serializable {
private static final long serialVersionUID = -52687427633888290L;
private List<AcsPassRuleImageParam> personList;
public List<AcsPassRuleImageParam> getPersonList() {
return this.personList;
}
public void setPersonList(List<AcsPassRuleImageParam> personList) {
this.personList = personList;
}
}
@@ -0,0 +1,61 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
public class AcsPassRuleQueryParam implements Serializable {
private static final long serialVersionUID = -31004388036379268L;
private String id;
private String parentId;
private String zoneId;
private String zoneName;
private String imageStoreId;
private Integer isDefault;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public Integer getIsDefault() {
return this.isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
}
@@ -0,0 +1,48 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPassTimeAddParam implements Serializable {
private static final long serialVersionUID = 8600793178515359164L;
@NotBlank(message = "76260512")
@Size(min = 1, max = 64, message = "76260519")
private String passableTimeName;
private Long beginDate;
private Long endDate;
private List<AcsPassTimeCycleParam> passableCycle;
public String getPassableTimeName() {
return this.passableTimeName;
}
public void setPassableTimeName(String passableTimeName) {
this.passableTimeName = passableTimeName;
}
public Long getBeginDate() {
return this.beginDate;
}
public void setBeginDate(Long beginDate) {
this.beginDate = beginDate;
}
public Long getEndDate() {
return this.endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public List<AcsPassTimeCycleParam> getPassableCycle() {
return this.passableCycle;
}
public void setPassableCycle(List<AcsPassTimeCycleParam> passableCycle) {
this.passableCycle = passableCycle;
}
}
@@ -0,0 +1,26 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
public class AcsPassTimeCycleParam implements Serializable {
private static final long serialVersionUID = 9084516985152275888L;
private int weekday;
private List<AcsPassTimeParam> time;
public int getWeekday() {
return this.weekday;
}
public void setWeekday(int weekday) {
this.weekday = weekday;
}
public List<AcsPassTimeParam> getTime() {
return this.time;
}
public void setTime(List<AcsPassTimeParam> time) {
this.time = time;
}
}
@@ -0,0 +1,19 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
import org.hibernate.validator.constraints.NotEmpty;
public class AcsPassTimeDeleteParam implements Serializable {
private static final long serialVersionUID = -1142611457619464538L;
@NotEmpty(message = "76260513")
private List<String> ids;
public List<String> getIds() {
return this.ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}
}
@@ -0,0 +1,58 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPassTimeEditParam implements Serializable {
private static final long serialVersionUID = -8271994630899900554L;
@NotBlank(message = "76260513")
private String id;
@NotBlank(message = "76260512")
@Size(min = 1, max = 64, message = "76260519")
private String passableTimeName;
private Long beginDate;
private Long endDate;
private List<AcsPassTimeCycleParam> passableCycle;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getPassableTimeName() {
return this.passableTimeName;
}
public void setPassableTimeName(String passableTimeName) {
this.passableTimeName = passableTimeName;
}
public Long getBeginDate() {
return this.beginDate;
}
public void setBeginDate(Long beginDate) {
this.beginDate = beginDate;
}
public Long getEndDate() {
return this.endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public List<AcsPassTimeCycleParam> getPassableCycle() {
return this.passableCycle;
}
public void setPassableCycle(List<AcsPassTimeCycleParam> passableCycle) {
this.passableCycle = passableCycle;
}
}
@@ -0,0 +1,25 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
public class AcsPassTimeParam implements Serializable {
private static final long serialVersionUID = 7496987389322298594L;
private String beginTime;
private String endTime;
public String getBeginTime() {
return this.beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return this.endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}
@@ -0,0 +1,18 @@
package cn.cloudwalk.elevator.passrule.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPassTimeQueryParam implements Serializable {
private static final long serialVersionUID = 7311660131290856391L;
@NotBlank(message = "76260513")
private String id;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -0,0 +1,136 @@
package cn.cloudwalk.elevator.passrule.result;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.result.OrganizationResult;
import cn.cloudwalk.elevator.passrule.param.AcsPassTimeCycleParam;
import java.util.List;
public class AcsPassRuleDetailResult {
private static final long serialVersionUID = -90554404684210529L;
private String id;
private String ruleName;
private String imageStoreId;
private String zoneId;
private String zoneName;
private Long beginDate;
private Long endDate;
private String validDateCron;
private String validDateJson;
private List<LabelResult> excludeLabels;
private List<OrganizationResult> includeOrganizations;
private List<LabelResult> includeLabels;
private List<AcsPassTimeCycleParam> passableCycle;
private Integer passType;
public String getRuleName() {
return this.ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public Long getBeginDate() {
return this.beginDate;
}
public void setBeginDate(Long beginDate) {
this.beginDate = beginDate;
}
public Long getEndDate() {
return this.endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public String getValidDateCron() {
return this.validDateCron;
}
public void setValidDateCron(String validDateCron) {
this.validDateCron = validDateCron;
}
public String getValidDateJson() {
return this.validDateJson;
}
public void setValidDateJson(String validDateJson) {
this.validDateJson = validDateJson;
}
public List<LabelResult> getExcludeLabels() {
return this.excludeLabels;
}
public void setExcludeLabels(List<LabelResult> excludeLabels) {
this.excludeLabels = excludeLabels;
}
public List<OrganizationResult> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<OrganizationResult> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<LabelResult> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<LabelResult> includeLabels) {
this.includeLabels = includeLabels;
}
public List<AcsPassTimeCycleParam> getPassableCycle() {
return this.passableCycle;
}
public void setPassableCycle(List<AcsPassTimeCycleParam> passableCycle) {
this.passableCycle = passableCycle;
}
public Integer getPassType() {
return this.passType;
}
public void setPassType(Integer passType) {
this.passType = passType;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
}
@@ -0,0 +1,101 @@
package cn.cloudwalk.elevator.passrule.result;
import java.io.Serializable;
public class AcsPassRuleFloorResult implements Serializable {
private static final long serialVersionUID = -90554404684210529L;
private String id;
private String name;
private Integer deviceNumber;
private Integer unitNumber;
private Long personNumber;
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setDeviceNumber(Integer deviceNumber) {
this.deviceNumber = deviceNumber;
}
public void setUnitNumber(Integer unitNumber) {
this.unitNumber = unitNumber;
}
public void setPersonNumber(Long personNumber) {
this.personNumber = personNumber;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsPassRuleFloorResult))
return false;
AcsPassRuleFloorResult other = (AcsPassRuleFloorResult)o;
if (!other.canEqual(this))
return false;
Object this$id = getId(), other$id = other.getId();
if ((this$id == null) ? (other$id != null) : !this$id.equals(other$id))
return false;
Object this$name = getName(), other$name = other.getName();
if ((this$name == null) ? (other$name != null) : !this$name.equals(other$name))
return false;
Object this$deviceNumber = getDeviceNumber(), other$deviceNumber = other.getDeviceNumber();
if ((this$deviceNumber == null) ? (other$deviceNumber != null) : !this$deviceNumber.equals(other$deviceNumber))
return false;
Object this$unitNumber = getUnitNumber(), other$unitNumber = other.getUnitNumber();
if ((this$unitNumber == null) ? (other$unitNumber != null) : !this$unitNumber.equals(other$unitNumber))
return false;
Object this$personNumber = getPersonNumber(), other$personNumber = other.getPersonNumber();
return !((this$personNumber == null) ? (other$personNumber != null)
: !this$personNumber.equals(other$personNumber));
}
protected boolean canEqual(Object other) {
return other instanceof AcsPassRuleFloorResult;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $id = getId();
result = result * 59 + (($id == null) ? 43 : $id.hashCode());
Object $name = getName();
result = result * 59 + (($name == null) ? 43 : $name.hashCode());
Object $deviceNumber = getDeviceNumber();
result = result * 59 + (($deviceNumber == null) ? 43 : $deviceNumber.hashCode());
Object $unitNumber = getUnitNumber();
result = result * 59 + (($unitNumber == null) ? 43 : $unitNumber.hashCode());
Object $personNumber = getPersonNumber();
return result * 59 + (($personNumber == null) ? 43 : $personNumber.hashCode());
}
public String toString() {
return "AcsPassRuleFloorResult(id=" + getId() + ", name=" + getName() + ", deviceNumber=" + getDeviceNumber()
+ ", unitNumber=" + getUnitNumber() + ", personNumber=" + getPersonNumber() + ")";
}
public String getId() {
return this.id;
}
public String getName() {
return this.name;
}
public Integer getDeviceNumber() {
return this.deviceNumber;
}
public Integer getUnitNumber() {
return this.unitNumber;
}
public Long getPersonNumber() {
return this.personNumber;
}
}
@@ -0,0 +1,155 @@
package cn.cloudwalk.elevator.passrule.result;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImgStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.result.OrganizationResult;
import java.io.Serializable;
import java.util.List;
public class AcsPassRuleResult implements Serializable {
private static final long serialVersionUID = -90554404684210529L;
private String id;
private String ruleName;
private int personSum;
private String imageStoreId;
private String passableTimeName;
private String zoneId;
private Long beginDate;
private Long endDate;
private String validDateCron;
private String validDateJson;
private List<LabelResult> excludeLabels;
private List<OrganizationResult> includeOrganizations;
private List<LabelResult> includeLabels;
private List<ImgStorePersonResult> includePersons;
private Integer passType;
private Integer isDefault;
public String getRuleName() {
return this.ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public int getPersonSum() {
return this.personSum;
}
public void setPersonSum(int personSum) {
this.personSum = personSum;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public Long getBeginDate() {
return this.beginDate;
}
public void setBeginDate(Long beginDate) {
this.beginDate = beginDate;
}
public Long getEndDate() {
return this.endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public String getValidDateCron() {
return this.validDateCron;
}
public void setValidDateCron(String validDateCron) {
this.validDateCron = validDateCron;
}
public String getValidDateJson() {
return this.validDateJson;
}
public void setValidDateJson(String validDateJson) {
this.validDateJson = validDateJson;
}
public List<LabelResult> getExcludeLabels() {
return this.excludeLabels;
}
public void setExcludeLabels(List<LabelResult> excludeLabels) {
this.excludeLabels = excludeLabels;
}
public List<OrganizationResult> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<OrganizationResult> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<LabelResult> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<LabelResult> includeLabels) {
this.includeLabels = includeLabels;
}
public String getPassableTimeName() {
return this.passableTimeName;
}
public void setPassableTimeName(String passableTimeName) {
this.passableTimeName = passableTimeName;
}
public List<ImgStorePersonResult> getIncludePersons() {
return this.includePersons;
}
public void setIncludePersons(List<ImgStorePersonResult> includePersons) {
this.includePersons = includePersons;
}
public Integer getPassType() {
return this.passType;
}
public void setPassType(Integer passType) {
this.passType = passType;
}
public Integer getIsDefault() {
return this.isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
}
@@ -0,0 +1,136 @@
package cn.cloudwalk.elevator.passrule.result;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelDetailResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.result.OrganizationResult;
import cn.cloudwalk.elevator.passrule.param.AcsPassTimeCycleParam;
import java.util.List;
public class ImageRuleRefDetailResult {
private static final long serialVersionUID = -90554404684210529L;
private String id;
private String ruleName;
private String imageStoreId;
private String zoneId;
private String zoneName;
private Long beginDate;
private Long endDate;
private String validDateCron;
private String validDateJson;
private List<String> excludeLabels;
private List<OrganizationResult> includeOrganizations;
private List<LabelDetailResult> includeLabels;
private List<AcsPassTimeCycleParam> passableCycle;
private Integer passType;
public String getRuleName() {
return this.ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public Long getBeginDate() {
return this.beginDate;
}
public void setBeginDate(Long beginDate) {
this.beginDate = beginDate;
}
public Long getEndDate() {
return this.endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public String getValidDateCron() {
return this.validDateCron;
}
public void setValidDateCron(String validDateCron) {
this.validDateCron = validDateCron;
}
public String getValidDateJson() {
return this.validDateJson;
}
public void setValidDateJson(String validDateJson) {
this.validDateJson = validDateJson;
}
public List<String> getExcludeLabels() {
return this.excludeLabels;
}
public void setExcludeLabels(List<String> excludeLabels) {
this.excludeLabels = excludeLabels;
}
public List<OrganizationResult> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<OrganizationResult> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<LabelDetailResult> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<LabelDetailResult> includeLabels) {
this.includeLabels = includeLabels;
}
public List<AcsPassTimeCycleParam> getPassableCycle() {
return this.passableCycle;
}
public void setPassableCycle(List<AcsPassTimeCycleParam> passableCycle) {
this.passableCycle = passableCycle;
}
public Integer getPassType() {
return this.passType;
}
public void setPassType(Integer passType) {
this.passType = passType;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
}
@@ -0,0 +1,154 @@
package cn.cloudwalk.elevator.passrule.result;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImgStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.label.result.LabelDetailResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.organization.result.OrganizationResult;
import java.util.List;
public class ImageRuleRefPageResult {
private static final long serialVersionUID = -90554404684210529L;
private String id;
private String ruleName;
private int personSum;
private String imageStoreId;
private String passableTimeName;
private String zoneId;
private Long beginDate;
private Long endDate;
private String validDateCron;
private String validDateJson;
private List<String> excludeLabels;
private List<OrganizationResult> includeOrganizations;
private List<LabelDetailResult> includeLabels;
private List<ImgStorePersonResult> includePersons;
private Integer passType;
private Integer isDefault;
public String getRuleName() {
return this.ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public int getPersonSum() {
return this.personSum;
}
public void setPersonSum(int personSum) {
this.personSum = personSum;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public Long getBeginDate() {
return this.beginDate;
}
public void setBeginDate(Long beginDate) {
this.beginDate = beginDate;
}
public Long getEndDate() {
return this.endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public String getValidDateCron() {
return this.validDateCron;
}
public void setValidDateCron(String validDateCron) {
this.validDateCron = validDateCron;
}
public String getValidDateJson() {
return this.validDateJson;
}
public void setValidDateJson(String validDateJson) {
this.validDateJson = validDateJson;
}
public List<String> getExcludeLabels() {
return this.excludeLabels;
}
public void setExcludeLabels(List<String> excludeLabels) {
this.excludeLabels = excludeLabels;
}
public List<OrganizationResult> getIncludeOrganizations() {
return this.includeOrganizations;
}
public void setIncludeOrganizations(List<OrganizationResult> includeOrganizations) {
this.includeOrganizations = includeOrganizations;
}
public List<LabelDetailResult> getIncludeLabels() {
return this.includeLabels;
}
public void setIncludeLabels(List<LabelDetailResult> includeLabels) {
this.includeLabels = includeLabels;
}
public String getPassableTimeName() {
return this.passableTimeName;
}
public void setPassableTimeName(String passableTimeName) {
this.passableTimeName = passableTimeName;
}
public List<ImgStorePersonResult> getIncludePersons() {
return this.includePersons;
}
public void setIncludePersons(List<ImgStorePersonResult> includePersons) {
this.includePersons = includePersons;
}
public Integer getPassType() {
return this.passType;
}
public void setPassType(Integer passType) {
this.passType = passType;
}
public Integer getIsDefault() {
return this.isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
}
@@ -0,0 +1,49 @@
package cn.cloudwalk.elevator.passrule.service;
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.elevator.passrule.dto.AcsPassRuleImageResultDto;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleDeleteParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleEditParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleFloorParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleImageParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleIsDefaultParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleNewParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleQueryParam;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleDetailResult;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleFloorResult;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleResult;
import java.util.List;
public interface AcsPassRuleService {
CloudwalkResult<List<AcsPassRuleFloorResult>> listFloor(AcsPassRuleFloorParam paramAcsPassRuleFloorParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<String> getIsDefaultByZoneId(AcsPassRuleIsDefaultParam paramAcsPassRuleIsDefaultParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<String> add(AcsPassRuleNewParam paramAcsPassRuleNewParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> update(AcsPassRuleEditParam paramAcsPassRuleEditParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> delete(AcsPassRuleDeleteParam paramAcsPassRuleDeleteParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<AcsPassRuleDetailResult> detail(AcsPassRuleQueryParam paramAcsPassRuleQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<CloudwalkPageAble<AcsPassRuleResult>> page(AcsPassRuleQueryParam paramAcsPassRuleQueryParam,
CloudwalkPageInfo paramCloudwalkPageInfo, CloudwalkCallContext paramCloudwalkCallContext)
throws ServiceException;
CloudwalkResult<List<AcsPassRuleResult>> list(AcsPassRuleQueryParam paramAcsPassRuleQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<List<AcsPassRuleImageResultDto>> listByImageId(AcsPassRuleImageParam paramAcsPassRuleImageParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
}
@@ -0,0 +1,49 @@
package cn.cloudwalk.elevator.passrule.service;
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.elevator.passrule.dto.AcsPassRuleImageResultDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRulePersonListResultDto;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleDeleteParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleEditParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleFloorParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleImageParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleNewParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRulePersonListParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleQueryParam;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleFloorResult;
import cn.cloudwalk.elevator.passrule.result.ImageRuleRefDetailResult;
import cn.cloudwalk.elevator.passrule.result.ImageRuleRefPageResult;
import java.util.List;
public interface ImageRuleRefService {
CloudwalkResult<CloudwalkPageAble<ImageRuleRefPageResult>> page(AcsPassRuleQueryParam paramAcsPassRuleQueryParam,
CloudwalkPageInfo paramCloudwalkPageInfo, CloudwalkCallContext paramCloudwalkCallContext)
throws ServiceException;
CloudwalkResult<CloudwalkPageAble<AcsPassRuleFloorResult>>
listFloor(AcsPassRuleFloorParam paramAcsPassRuleFloorParam, CloudwalkCallContext paramCloudwalkCallContext)
throws ServiceException;
CloudwalkResult<List<AcsPassRuleImageResultDto>> listByPersonInfo(AcsPassRuleImageParam paramAcsPassRuleImageParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<List<AcsPassRulePersonListResultDto>> listByPersonList(
AcsPassRulePersonListParam paramAcsPassRulePersonListParam, CloudwalkCallContext paramCloudwalkCallContext)
throws ServiceException;
CloudwalkResult<ImageRuleRefDetailResult> detail(AcsPassRuleQueryParam paramAcsPassRuleQueryParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> addOnlyRule(AcsPassRuleNewParam paramAcsPassRuleNewParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> update(AcsPassRuleEditParam paramAcsPassRuleEditParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
CloudwalkResult<Boolean> delete(AcsPassRuleDeleteParam paramAcsPassRuleDeleteParam,
CloudwalkCallContext paramCloudwalkCallContext) throws ServiceException;
}
@@ -0,0 +1,547 @@
package cn.cloudwalk.elevator.person.impl;
import cn.cloudwalk.client.cwoscomponent.intelligent.application.param.ApplicationImageStoreQueryParam;
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.result.DeviceApplicationResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.device.result.DeviceImageStoreResult;
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.ImageStorePersonBindParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStorePersonDelParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStorePersonQueryParam;
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.result.ImageStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImgStoreBatchBindPersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStorePersonService;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStoreService;
import cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonAddParam;
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.cloud.annotation.CloudwalkParamsValidate;
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.elevator.em.AcsPassTypeEnum;
import cn.cloudwalk.elevator.passrule.dao.AcsPassRuleDao;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleQueryDto;
import cn.cloudwalk.elevator.passrule.dto.AcsPassRuleResultDto;
import cn.cloudwalk.elevator.passrule.impl.AbstractAcsPassService;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleIsDefaultParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassRuleQueryParam;
import cn.cloudwalk.elevator.passrule.param.AcsPassTimeCycleParam;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleResult;
import cn.cloudwalk.elevator.passrule.service.AcsPassRuleService;
import cn.cloudwalk.elevator.person.param.AcsPersonAddNewParam;
import cn.cloudwalk.elevator.person.param.AcsPersonAddParam;
import cn.cloudwalk.elevator.person.param.AcsPersonDeleteParam;
import cn.cloudwalk.elevator.person.param.AcsPersonEditParam;
import cn.cloudwalk.elevator.person.param.AcsPersonQueryByAppParam;
import cn.cloudwalk.elevator.person.param.AcsPersonQueryParam;
import cn.cloudwalk.elevator.person.param.AcsPersonTimeDetailParam;
import cn.cloudwalk.elevator.person.result.AcsPersonResult;
import cn.cloudwalk.elevator.person.result.AcsPersonTimeDetailResult;
import cn.cloudwalk.elevator.person.service.AcsPersonService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.util.DateUtils;
import cn.cloudwalk.elevator.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
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 AcsPersonServiceImpl extends AbstractAcsPassService implements AcsPersonService {
private static final int ROWS_OF_PAGE = 1000;
@Autowired
private BiologyToolService biologyToolService;
@Autowired
private DeviceImageStoreService deviceImageStoreService;
@Autowired
private ImageStorePersonService imageStorePersonService;
@Autowired
private DeviceApplicationService deviceApplicationService;
@Autowired
private PersonService personService;
@Autowired
private ImageStoreService imageStoreService;
@Resource
private AcsPassRuleService acsPassRuleService;
@Resource
private AcsPassRuleDao acsPassRuleDao;
@CloudwalkParamsValidate
public CloudwalkResult<Boolean> add(AcsPersonAddParam param, CloudwalkCallContext context) throws ServiceException {
this.logger.info("从现有人员添加通行人员开始,AcsPersonAddParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(param), JSONObject.toJSONString(context));
String acsImageStoreId = getAcsImageStore(param.getZoneId(), context);
ImageStorePersonBindParam imageStorePersonBindParam = new ImageStorePersonBindParam();
imageStorePersonBindParam.setImageStoreId(acsImageStoreId);
imageStorePersonBindParam.setPersonIds(param.getPersonIds());
imageStorePersonBindParam.setNullDateIsLongTerm(Boolean.valueOf(true));
imageStorePersonBindParam.setExpiryBeginDate(param.getStartTime());
imageStorePersonBindParam.setExpiryEndDate(param.getEndTime());
this.logger.info("远程调用绑定人员图库开始,imageStorePersonBindParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(imageStorePersonBindParam), JSONObject.toJSONString(context));
CloudwalkResult<ImgStoreBatchBindPersonResult> bindResult =
this.imageStorePersonService.batchBind(imageStorePersonBindParam, context);
if (!bindResult.isSuccess()) {
this.logger.error("远程调用绑定人员图库异常,原因:[{}],失败人员id:[{}]", bindResult.getMessage(),
((ImgStoreBatchBindPersonResult)bindResult.getData()).getFailPersonIds());
return CloudwalkResult.fail(bindResult.getCode(), bindResult.getMessage());
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
private void bindImageStorePerson(String acsImageStoreId, String personId, Long startTime, Long endTime,
CloudwalkCallContext context) throws ServiceException {
ImageStorePersonBindParam imageStorePersonBindParam = new ImageStorePersonBindParam();
imageStorePersonBindParam.setImageStoreId(acsImageStoreId);
imageStorePersonBindParam.setNullDateIsLongTerm(Boolean.valueOf(true));
imageStorePersonBindParam.setPersonId(personId);
imageStorePersonBindParam.setExpiryBeginDate(startTime);
imageStorePersonBindParam.setExpiryEndDate(endTime);
this.logger.info("图库人员关系绑定开始,imageStorePersonBindParam:[{}],context:[{}]",
JSONObject.toJSONString(imageStorePersonBindParam), JSONObject.toJSONString(context));
CloudwalkResult<Boolean> bindResult = this.imageStorePersonService.bind(imageStorePersonBindParam, context);
if (!bindResult.isSuccess()) {
this.logger.error("图库人员关系绑定失败,imageStoreId=[{}],personId=[{}],原因:[{}]",
new Object[] {acsImageStoreId, personId, bindResult.getMessage()});
throw new ServiceException(bindResult.getCode(), bindResult.getMessage());
}
}
private String addPerson(AcsPersonAddNewParam param, CloudwalkCallContext context) throws ServiceException {
PersonAddParam personAddParam = new PersonAddParam();
BeanCopyUtils.copyProperties(param.getPersonProperties(), personAddParam);
CloudwalkResult<String> addPersonResult = this.personService.add(personAddParam, context);
if (!addPersonResult.isSuccess()) {
this.logger.info("新增人员失败,原因:[{}]", addPersonResult.getMessage());
throw new ServiceException(addPersonResult.getCode(), addPersonResult.getMessage());
}
return (String)addPersonResult.getData();
}
@CloudwalkParamsValidate
public CloudwalkResult<Boolean> edit(AcsPersonEditParam param, CloudwalkCallContext context)
throws ServiceException {
this.logger.info("编辑通行人员开始,AcsPersonEditParam=[{}], CloudwalkCallContext=[{}]", JSONObject.toJSONString(param),
JSONObject.toJSONString(context));
checkPersonIdByImageStore(param.getPersonId(), param.getImageStoreId(), context);
ImageStorePersonDelParam delParam = new ImageStorePersonDelParam();
delParam.setImageStoreId(param.getImageStoreId());
delParam.setPersonId(param.getPersonId());
this.logger.info("远程调用解绑图库人员开始,ImageStorePersonDelParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(delParam), JSONObject.toJSONString(context));
CloudwalkResult<Boolean> deleteResult = this.imageStorePersonService.delete(delParam, context);
if (!deleteResult.isSuccess()) {
this.logger.error("图库人员更新之前先解绑失败,原因:[{}]", deleteResult.getMessage());
return CloudwalkResult.fail("76260406", getMessage("76260406") + " " + deleteResult.getMessage());
}
bindImageStorePerson(param.getImageStoreId(), param.getPersonId(), param.getStartTime(), param.getEndTime(),
context);
return CloudwalkResult.success(Boolean.valueOf(true));
}
@CloudwalkParamsValidate
public CloudwalkResult<Boolean> delete(AcsPersonDeleteParam param, CloudwalkCallContext context)
throws ServiceException {
this.logger.info("删除门禁通行人员开始,AcsPersonDeleteParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(param), JSONObject.toJSONString(context));
for (String personId : param.getPersonIds()) {
ImageStorePersonDelParam imageStorePersonDelParam = new ImageStorePersonDelParam();
imageStorePersonDelParam.setPersonId(personId);
imageStorePersonDelParam.setImageStoreId(param.getImageStoreId());
CloudwalkResult<Boolean> imageStorePersonDeleteResult =
this.imageStorePersonService.delete(imageStorePersonDelParam, context);
if (!imageStorePersonDeleteResult.isSuccess()) {
return CloudwalkResult.fail("76260407",
getMessage("76260407") + " " + imageStorePersonDeleteResult.getMessage());
}
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
private List<DeviceApplicationResult>
sortedDeviceAppList(CloudwalkResult<List<DeviceApplicationResult>> deviceAppResult) {
List<DeviceApplicationResult> deviceAppList = (List<DeviceApplicationResult>)deviceAppResult.getData();
List<DeviceApplicationResult> sortedDeviceAppList = new ArrayList<>();
List<DeviceApplicationResult> acsAppList = (List<DeviceApplicationResult>)deviceAppList.stream()
.filter(s -> "elevator-app".equals(s.getServiceCode())).collect(Collectors.toList());
List<DeviceApplicationResult> otherAppList = (List<DeviceApplicationResult>)deviceAppList.stream()
.filter(s -> !"elevator-app".equals(s.getServiceCode())).collect(Collectors.toList());
sortedDeviceAppList.addAll(acsAppList);
sortedDeviceAppList.addAll(otherAppList);
return sortedDeviceAppList;
}
@CloudwalkParamsValidate
public CloudwalkResult<CloudwalkPageAble<AcsPersonResult>> page(AcsPersonQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
this.logger.info("分页查询通行人员开始,AcsPersonQueryParam=[{}], CloudwalkPageInfo=[{}], CloudwalkCallContext=[{}]",
new Object[] {JSONObject.toJSONString(param), JSONObject.toJSONString(pageInfo),
JSONObject.toJSONString(context)});
List<AcsPersonResult> result = new ArrayList<>();
List<String> personIds = null;
List<AcsPassRuleResult> ruleResults = getRuleListByZoneId(param.getZoneId(), context);
if (CollectionUtils.isEmpty(ruleResults)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
List<String> imageStoreIds =
(List<String>)ruleResults.stream().map(AcsPassRuleResult::getImageStoreId).collect(Collectors.toList());
if (StringUtils.isNotBlank(param.getImageStoreId()) && !imageStoreIds.contains(param.getImageStoreId())) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
Map<String, AcsPassRuleResult> ruleMap = (Map<String, AcsPassRuleResult>)ruleResults.stream()
.collect(Collectors.toMap(AcsPassRuleResult::getImageStoreId, r -> r));
if (!StringUtils.isEmpty(param.getPersonName())) {
personIds = getPersonIdsByName(param.getPersonName(), context);
if (CollectionUtils.isEmpty(personIds)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
}
CloudwalkPageAble<ImageStorePersonResult> pageResult =
getImageStorePerson(param, pageInfo, context, personIds, imageStoreIds);
if (!CollectionUtils.isEmpty(pageResult.getDatas())) {
covertPageResult(result, pageResult.getDatas(), ruleMap, context);
}
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, pageResult.getTotalRows()));
}
private List<ImageStoreListResult> getImageStoreIdsByAppAndDevice(String applicationId, String deviceId,
CloudwalkCallContext context) throws ServiceException {
ApplicationImageStoreQueryParam queryParam = new ApplicationImageStoreQueryParam();
queryParam.setApplicationId(applicationId);
List<DeviceImageStoreResult> deviceImageStore = getDeviceImageStore(deviceId, context);
if (deviceImageStore.isEmpty()) {
return new ArrayList<>();
}
List<String> imageStoreIdByDevice = (List<String>)deviceImageStore.stream()
.map(DeviceImageStoreResult::getImageStoreId).collect(Collectors.toList());
ImageStoreQueryParam imageStoreQueryParam = new ImageStoreQueryParam();
imageStoreQueryParam.setBusinessId(context.getCompany().getCompanyId());
imageStoreQueryParam.setApplicationId(applicationId);
imageStoreQueryParam.setIds(imageStoreIdByDevice);
CloudwalkResult<List<ImageStoreListResult>> imageStoreResult =
this.imageStoreService.list(imageStoreQueryParam, context);
return (List<ImageStoreListResult>)imageStoreResult.getData();
}
private CloudwalkPageAble<ImageStorePersonResult> getImageStorePerson(AcsPersonQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context, List<String> personIds, List<String> imageStoreIds)
throws ServiceException {
CloudwalkPageAble<ImageStorePersonResult> results = new CloudwalkPageAble();
ImageStorePersonQueryParam imageStorePersonQueryParam = new ImageStorePersonQueryParam();
imageStorePersonQueryParam.setImageStoreId(param.getImageStoreId());
if (StringUtils.isEmpty(param.getImageStoreId())) {
imageStorePersonQueryParam.setImageStoreIds(imageStoreIds);
}
imageStorePersonQueryParam.setPersonIds(personIds);
imageStorePersonQueryParam.setOrganizationIds(param.getOrganizationIds());
imageStorePersonQueryParam.setLabelIds(param.getLabelIds());
imageStorePersonQueryParam.setCurrentPage(pageInfo.getCurrentPage());
imageStorePersonQueryParam.setRowsOfPage(pageInfo.getPageSize());
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> pageResult =
this.imageStorePersonService.page(imageStorePersonQueryParam, context);
if (!pageResult.isSuccess()) {
this.logger.error("远程调用查询图库人员失败,原因:[{}]", pageResult.getMessage());
throw new ServiceException(pageResult.getCode(), pageResult.getMessage());
}
if (!CollectionUtils.isEmpty(((CloudwalkPageAble)pageResult.getData()).getDatas())) {
results = (CloudwalkPageAble<ImageStorePersonResult>)pageResult.getData();
}
return results;
}
public CloudwalkResult<AcsPersonTimeDetailResult> timeDetail(AcsPersonTimeDetailParam param,
CloudwalkCallContext context) throws ServiceException {
this.logger.info("查询通行人员时间详情开始,AcsPersonTimeDetailParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(param), JSONObject.toJSONString(context));
AcsPersonTimeDetailResult result = new AcsPersonTimeDetailResult();
ImageStorePersonResult imageStorePersonResult = getImageStorePersonResult(param, context);
AcsPassRuleResult rule = getRuleByImageStore(param.getImageStoreId(), context);
result.setBeginDate(imageStorePersonResult.getExpiryBeginDate());
result.setEndDate(imageStorePersonResult.getExpiryEndDate());
result.setPassType(AcsPassTypeEnum.LONG_TIME.getCode());
if (imageStorePersonResult.getExpiryBeginDate() != null || imageStorePersonResult.getExpiryEndDate() != null) {
result.setPassType(AcsPassTypeEnum.AUTO_PASS.getCode());
}
if (!CollectionUtils.isEmpty(imageStorePersonResult.getValidDateCron())) {
BeanCopyUtils.copyProperties(rule, result);
result.setPassableTimeName(rule.getPassableTimeName());
List<AcsPassTimeCycleParam> timeCycleParams =
JSONObject.parseArray(rule.getValidDateJson(), AcsPassTimeCycleParam.class);
result.setPassableCycle(timeCycleParams);
result.setPassType(AcsPassTypeEnum.PASS_TIME.getCode());
}
ImageStorePersonQueryParam imageStorePersonQueryParam = new ImageStorePersonQueryParam();
imageStorePersonQueryParam.setPersonId(param.getPersonId());
imageStorePersonQueryParam.setRowsOfPage(1000);
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> imageStorePersonPageResult =
this.imageStorePersonService.page(imageStorePersonQueryParam, context);
ImageStorePersonResult imageStoreResult =
((CloudwalkPageAble)imageStorePersonPageResult.getData()).getDatas().iterator().next();
result.setComparePicture(imageStoreResult.getComparePicture());
result.setPersonName(imageStoreResult.getName());
result.setPersonId(imageStoreResult.getPersonId());
return CloudwalkResult.success(result);
}
private AcsPassRuleResult getRuleByImageStore(String imageStoreId, CloudwalkCallContext context)
throws ServiceException {
AcsPassRuleQueryParam ruleQueryParam = new AcsPassRuleQueryParam();
ruleQueryParam.setImageStoreId(imageStoreId);
CloudwalkResult<List<AcsPassRuleResult>> results = this.acsPassRuleService.list(ruleQueryParam, context);
return ((List<AcsPassRuleResult>)results.getData()).get(0);
}
private ImageStorePersonResult getImageStorePersonResult(AcsPersonTimeDetailParam param,
CloudwalkCallContext context) throws ServiceException {
ImageStorePersonQueryParam imageStorePersonQueryParam = new ImageStorePersonQueryParam();
imageStorePersonQueryParam.setImageStoreId(param.getImageStoreId());
imageStorePersonQueryParam.setPersonId(param.getPersonId());
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> pageResult =
this.imageStorePersonService.page(imageStorePersonQueryParam, context);
if (!pageResult.isSuccess() || CollectionUtils.isEmpty(((CloudwalkPageAble)pageResult.getData()).getDatas())) {
this.logger.error("远程调用查询通行人员失败,原因:" + pageResult.getMessage());
throw new ServiceException("远程调用查询通行人员失败");
}
List<ImageStorePersonResult> list =
(List<ImageStorePersonResult>)((CloudwalkPageAble)pageResult.getData()).getDatas();
return list.get(0);
}
private List<String> mergeTime(List<ImageStorePersonResult> imageStorePersonList) {
List<String> passIntervals = new ArrayList<>();
List<ImageStorePersonResult> personLongTerm = (List<ImageStorePersonResult>)imageStorePersonList.stream()
.filter(s -> (s.getExpiryBeginDate() == null && s.getExpiryEndDate() == null)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(personLongTerm)) {
passIntervals.add("长期");
} else {
Collections.sort(imageStorePersonList,
(t1, t2) -> t1.getExpiryBeginDate().compareTo(t2.getExpiryEndDate()));
for (int i = 0; i < imageStorePersonList.size() - 1; i++) {
int j = i + 1;
if (((ImageStorePersonResult)imageStorePersonList.get(i)).getExpiryEndDate()
.longValue() >= ((ImageStorePersonResult)imageStorePersonList.get(j)).getExpiryBeginDate()
.longValue()) {
if (((ImageStorePersonResult)imageStorePersonList.get(i)).getExpiryEndDate()
.longValue() >= ((ImageStorePersonResult)imageStorePersonList.get(j)).getExpiryEndDate()
.longValue()) {
imageStorePersonList.set(j, imageStorePersonList.get(i));
} else {
((ImageStorePersonResult)imageStorePersonList.get(j)).setExpiryBeginDate(
((ImageStorePersonResult)imageStorePersonList.get(i)).getExpiryBeginDate());
}
imageStorePersonList.set(i, (ImageStorePersonResult)null);
}
}
List<ImageStorePersonResult> personTimeMergeList = (List<ImageStorePersonResult>)imageStorePersonList
.stream().filter(s -> (s != null)).collect(Collectors.toList());
for (ImageStorePersonResult personTimeMerge : personTimeMergeList) {
String beginDate = DateUtils.parseDate(new Date(personTimeMerge.getExpiryBeginDate().longValue()),
"yyyy-MM-dd HH:mm:ss");
String endDate = DateUtils.parseDate(new Date(personTimeMerge.getExpiryEndDate().longValue()),
"yyyy-MM-dd HH:mm:ss");
passIntervals.add(beginDate + "" + endDate);
}
}
return passIntervals;
}
private void covertPageResult(List<AcsPersonResult> result, Collection<ImageStorePersonResult> datas,
Map<String, AcsPassRuleResult> ruleMap, CloudwalkCallContext context) throws ServiceException {
List<String> personIds =
(List<String>)datas.stream().map(ImageStorePersonResult::getPersonId).collect(Collectors.toList());
Map<String, PersonResult> personIcCardMap = getPersonIcCardByIds(personIds, context);
for (ImageStorePersonResult data : datas) {
AcsPassRuleResult rule = null;
AcsPersonResult acsPersonResult = new AcsPersonResult();
if (ruleMap != null && ruleMap.get(data.getImageStoreId()) != null) {
rule = ruleMap.get(data.getImageStoreId());
acsPersonResult.setRuleName(rule.getRuleName());
acsPersonResult.setRuleId(rule.getId());
}
BeanCopyUtils.copyProperties(data, acsPersonResult);
acsPersonResult.setPersonName(data.getName());
acsPersonResult.setStartTime(data.getExpiryBeginDate());
acsPersonResult.setEndTime(data.getExpiryEndDate());
acsPersonResult.setPassType(AcsPassTypeEnum.LONG_TIME.getCode());
if (data.getExpiryBeginDate() != null || data.getExpiryEndDate() != null) {
acsPersonResult.setPassType(AcsPassTypeEnum.AUTO_PASS.getCode());
}
if (personIcCardMap != null && personIcCardMap.get(data.getPersonId()) != null) {
acsPersonResult.setIcCardNo(((PersonResult)personIcCardMap.get(data.getPersonId())).getIcCardNo());
}
result.add(acsPersonResult);
}
}
private Map<String, PersonResult> getPersonIcCardByIds(List<String> personIds, CloudwalkCallContext context)
throws ServiceException {
Map<String, PersonResult> personIcCardMap = null;
PersonQueryParam param = new PersonQueryParam();
param.setIds(personIds);
CloudwalkResult<List<PersonResult>> personResult = this.personService.list(param, context);
List<PersonResult> personList = (List<PersonResult>)personResult.getData();
if (personResult.isSuccess() && CollectionUtils.isNotEmpty(personList)) {
personIcCardMap = (Map<String, PersonResult>)personList.stream()
.collect(Collectors.toMap(CloudwalkBaseIdentify::getId, personResult -> personResult));
}
return personIcCardMap;
}
private List<String> getPersonIdsByName(String personName, CloudwalkCallContext context) throws ServiceException {
List<String> personIdsByName = new ArrayList<>();
if (StringUtils.isNotBlank(personName)) {
PersonQueryParam personQueryParam = new PersonQueryParam();
personQueryParam.setName(personName);
CloudwalkResult<List<PersonResult>> personResult = this.personService.list(personQueryParam, context);
List<PersonResult> personList = (List<PersonResult>)personResult.getData();
if (personResult.isSuccess() && CollectionUtils.isNotEmpty(personList)) {
personIdsByName =
(List<String>)personList.stream().map(CloudwalkBaseIdentify::getId).collect(Collectors.toList());
}
}
return personIdsByName;
}
private List<AcsPassRuleResult> getRuleListByZoneId(String zoneId, CloudwalkCallContext context)
throws ServiceException {
AcsPassRuleQueryParam param = new AcsPassRuleQueryParam();
param.setZoneId(zoneId);
CloudwalkResult<List<AcsPassRuleResult>> ruleResult = this.acsPassRuleService.list(param, context);
if (!ruleResult.isSuccess()) {
this.logger.error("查询通行规则失败,原因:[{}]", ruleResult.getMessage());
throw new ServiceException("76260508", ruleResult.getMessage());
}
return (List<AcsPassRuleResult>)ruleResult.getData();
}
private String getAcsImageStore(String zoneId, CloudwalkCallContext context) throws ServiceException {
AcsPassRuleIsDefaultParam param = new AcsPassRuleIsDefaultParam();
param.setZoneId(zoneId);
CloudwalkResult<String> imageStore = this.acsPassRuleService.getIsDefaultByZoneId(param, context);
if (imageStore.isSuccess()) {
if (imageStore.getData() != null) {
return (String)imageStore.getData();
}
throw new ServiceException("默认规则绑定的图库不存在");
}
throw new ServiceException(imageStore.getCode(), imageStore.getMessage());
}
private void checkPersonIdByImageStore(String personId, String acsImageStoreId, CloudwalkCallContext context)
throws ServiceException {
ImageStorePersonQueryParam imageStorePersonQueryParam = new ImageStorePersonQueryParam();
imageStorePersonQueryParam.setPersonId(personId);
imageStorePersonQueryParam.setImageStoreId(acsImageStoreId);
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> imageStorePersonResult =
this.imageStorePersonService.page(imageStorePersonQueryParam, context);
if (imageStorePersonResult.isSuccess()) {
if (imageStorePersonResult.getData() == null
|| CollectionUtils.isEmpty(((CloudwalkPageAble)imageStorePersonResult.getData()).getDatas())) {
throw new ServiceException("该人员未绑定门禁图库,人员id为:" + personId);
}
} else {
throw new ServiceException(imageStorePersonResult.getCode(), imageStorePersonResult.getMessage());
}
}
private List<DeviceImageStoreResult> getDeviceImageStore(String deviceId, CloudwalkCallContext context)
throws ServiceException {
DeviceImageStoreQueryParam deviceImageStoreQueryParam = new DeviceImageStoreQueryParam();
deviceImageStoreQueryParam.setDeviceId(deviceId);
CloudwalkResult<List<DeviceImageStoreResult>> imageStoreResult =
this.deviceImageStoreService.list(deviceImageStoreQueryParam, context);
if (imageStoreResult.isSuccess()) {
if (CollectionUtils.isNotEmpty((Collection)imageStoreResult.getData())) {
return (List<DeviceImageStoreResult>)imageStoreResult.getData();
}
throw new ServiceException("该设备未绑定图库");
}
throw new ServiceException(imageStoreResult.getCode(), imageStoreResult.getMessage());
}
@CloudwalkParamsValidate
public CloudwalkResult<CloudwalkPageAble<AcsPersonResult>> pageByApp(AcsPersonQueryByAppParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
List<String> personIds = null;
List<AcsPersonResult> result = new ArrayList<>();
List<ImageStoreListResult> imageStoreResult =
getImageStoreIdsByAppAndDevice(param.getApplicationId(), param.getDeviceId(), context);
List<String> imageStoreIds =
(List<String>)imageStoreResult.stream().map(ImageStoreListResult::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(imageStoreIds)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
if (!StringUtils.isEmpty(param.getPersonName())) {
personIds = getPersonIdsByName(param.getPersonName(), context);
if (CollectionUtils.isEmpty(personIds)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
}
CloudwalkPageAble<ImageStorePersonResult> pageResult =
getAppImageStorePerson(imageStoreIds, personIds, pageInfo, context);
if (!CollectionUtils.isEmpty(pageResult.getDatas())) {
covertPageResult(result, pageResult.getDatas(), (Map<String, AcsPassRuleResult>)null, context);
}
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, pageResult.getTotalRows()));
}
private CloudwalkPageAble<ImageStorePersonResult> getAppImageStorePerson(List<String> imageStoreIds,
List<String> personIds, CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
ImageStorePersonQueryParam param = new ImageStorePersonQueryParam();
param.setImageStoreIds(imageStoreIds);
param.setPersonIds(personIds);
param.setCurrentPage(pageInfo.getCurrentPage());
param.setRowsOfPage(pageInfo.getPageSize());
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> pageResult =
this.imageStorePersonService.page(param, context);
if (!pageResult.isSuccess()) {
this.logger.error("远程调用查询图库人员失败,原因:[{}]", pageResult.getMessage());
throw new ServiceException(pageResult.getCode(), pageResult.getMessage());
}
return (CloudwalkPageAble<ImageStorePersonResult>)pageResult.getData();
}
private List<AcsPassRuleResultDto> getRuleByImageStoreIds(List<String> imageStoreIds, CloudwalkCallContext context)
throws ServiceException {
try {
AcsPassRuleQueryDto dto = new AcsPassRuleQueryDto();
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setImageStoreIds(imageStoreIds);
return this.acsPassRuleDao.list(dto);
} catch (DataAccessException e) {
this.logger.error("查询通行规则失败");
throw new ServiceException("76260508", getMessage("76260508"));
}
}
private List<ImageStorePersonResult> getPersonImageStore(String personId, List<String> imageStoreIds,
CloudwalkCallContext context) throws ServiceException {
ImageStorePersonQueryParam param = new ImageStorePersonQueryParam();
param.setImageStoreIds(imageStoreIds);
param.setPersonId(personId);
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> imageStorePersonResult =
this.imageStorePersonService.page(param, context);
if (!imageStorePersonResult.isSuccess()) {
throw new ServiceException(imageStorePersonResult.getCode(), imageStorePersonResult.getMessage());
}
return (List<ImageStorePersonResult>)((CloudwalkPageAble)imageStorePersonResult.getData()).getDatas();
}
}
@@ -0,0 +1,542 @@
package cn.cloudwalk.elevator.person.impl;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStorePersonBindParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.ImageStorePersonQueryParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.param.UpdateGroupPersonRefParam;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImageStorePersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.result.ImgStoreBatchBindPersonResult;
import cn.cloudwalk.client.cwoscomponent.intelligent.imagestore.service.ImageStorePersonService;
import cn.cloudwalk.client.cwoscomponent.intelligent.person.param.PersonDetailParam;
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.cloud.annotation.CloudwalkParamsValidate;
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.elevator.device.dao.AcsElevatorDeviceDao;
import cn.cloudwalk.elevator.device.dao.DeviceImageStoreDao;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListByBuildingIdDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.em.AcsPassTypeEnum;
import cn.cloudwalk.elevator.passrule.dao.ImageRuleRefDao;
import cn.cloudwalk.elevator.passrule.dto.ImageRuleRefAddDto;
import cn.cloudwalk.elevator.passrule.dto.ImageRuleRefResultDto;
import cn.cloudwalk.elevator.passrule.impl.AbstractAcsPassService;
import cn.cloudwalk.elevator.passrule.result.AcsPassRuleResult;
import cn.cloudwalk.elevator.person.param.AcsPersonAddParam;
import cn.cloudwalk.elevator.person.param.AcsPersonAddVisitorParam;
import cn.cloudwalk.elevator.person.param.AcsPersonDeleteParam;
import cn.cloudwalk.elevator.person.param.AcsPersonEditParam;
import cn.cloudwalk.elevator.person.param.AcsPersonQueryByAppParam;
import cn.cloudwalk.elevator.person.param.AcsPersonQueryParam;
import cn.cloudwalk.elevator.person.param.AcsPersonTimeDetailParam;
import cn.cloudwalk.elevator.person.param.PersonDetailQueryParam;
import cn.cloudwalk.elevator.person.result.AcsPersonResult;
import cn.cloudwalk.elevator.person.result.AcsPersonTimeDetailResult;
import cn.cloudwalk.elevator.person.service.PersonRuleService;
import cn.cloudwalk.elevator.util.CollectionUtils;
import cn.cloudwalk.elevator.util.StringUtils;
import cn.cloudwalk.elevator.zone.param.ZoneQueryParam;
import cn.cloudwalk.elevator.zone.result.ZoneResult;
import cn.cloudwalk.elevator.zone.service.ZoneService;
import com.alibaba.fastjson.JSONObject;
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 javax.annotation.Resource;
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.ObjectUtils;
@Service
public class PersonRuleServiceImpl extends AbstractAcsPassService implements PersonRuleService {
@Resource
private ImageRuleRefDao imageRuleRefDao;
@Resource
private DeviceImageStoreDao deviceImageStoreDao;
@Autowired
private ImageStorePersonService imageStorePersonService;
@Autowired
private PersonService personService;
@Resource
private AcsElevatorDeviceDao acsElevatorDeviceDao;
@Resource
private ZoneService zoneService;
@CloudwalkParamsValidate
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public CloudwalkResult<Boolean> add(AcsPersonAddParam param, CloudwalkCallContext context) throws ServiceException {
this.logger.info("从现有人员添加通行人员开始,AcsPersonAddParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(param), JSONObject.toJSONString(context));
try {
AcsElevatorDeviceListByBuildingIdDto buildingIdDto = new AcsElevatorDeviceListByBuildingIdDto();
buildingIdDto.setCurrentBuildingId(param.getParentId());
buildingIdDto.setBusinessId(context.getCompany().getCompanyId());
List<AcsElevatorDeviceResultDTO> deviceList = this.acsElevatorDeviceDao.listBuBuildingId(buildingIdDto);
if (CollectionUtils.isEmpty(deviceList)) {
return CloudwalkResult.fail("76260527", getMessage("76260527"));
}
ImageRuleRefResultDto defaultRule = this.imageRuleRefDao.getDefaultByZoneId(param.getZoneId());
if (ObjectUtils.isEmpty(defaultRule)) {
ImageRuleRefAddDto dto = new ImageRuleRefAddDto();
dto.setId(genUUID());
dto.setBusinessId(context.getCompany().getCompanyId());
dto.setName("默认规则");
dto.setZoneId(param.getZoneId());
dto.setZoneName(param.getZoneName());
dto.setIsDefault(Integer.valueOf(1));
dto.setCreateTime(Long.valueOf(System.currentTimeMillis()));
dto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis()));
this.imageRuleRefDao.insert(dto);
defaultRule = this.imageRuleRefDao.getDefaultByZoneId(param.getZoneId());
}
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
ImageStorePersonQueryParam queryParam = new ImageStorePersonQueryParam();
queryParam.setImageStoreId(imageStoreId);
queryParam.setPersonIds(param.getPersonIds());
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> personPage =
this.imageStorePersonService.page(queryParam, context);
List<String> personPageIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(((CloudwalkPageAble)personPage.getData()).getDatas())) {
for (ImageStorePersonResult personResult : ((CloudwalkPageAble)personPage.getData()).getDatas()) {
personPageIds.add(personResult.getPersonId());
}
}
List<String> bindPersonIds = new ArrayList<>();
for (String personId : param.getPersonIds()) {
if (!personPageIds.contains(personId)) {
bindPersonIds.add(personId);
}
ImageRuleRefResultDto del = this.imageRuleRefDao.getDelByPersonIdAndZoneId(personId, param.getZoneId());
if (ObjectUtils.isEmpty(del)) {
ImageRuleRefAddDto addDto = new ImageRuleRefAddDto();
addDto.setId(genUUID());
addDto.setBusinessId(context.getCompany().getCompanyId());
addDto.setPersonId(personId);
addDto.setParentRule(defaultRule.getId());
addDto.setName(defaultRule.getName());
addDto.setZoneId(param.getZoneId());
addDto.setZoneName(defaultRule.getZoneName());
addDto.setCreateTime(Long.valueOf(System.currentTimeMillis()));
addDto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis()));
addDto.setPersonDelete(Integer.valueOf(0));
this.imageRuleRefDao.insert(addDto);
}
}
this.imageRuleRefDao.deleteByPersonIdsIsDel(param.getPersonIds(), param.getZoneId());
if (!CollectionUtils.isEmpty(bindPersonIds)) {
ImageStorePersonBindParam imageStorePersonBindParam = new ImageStorePersonBindParam();
imageStorePersonBindParam.setImageStoreId(imageStoreId);
imageStorePersonBindParam.setPersonIds(bindPersonIds);
imageStorePersonBindParam.setNullDateIsLongTerm(Boolean.valueOf(true));
this.logger.info("远程调用绑定人员图库开始,imageStorePersonBindParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(imageStorePersonBindParam), JSONObject.toJSONString(context));
CloudwalkResult<ImgStoreBatchBindPersonResult> bindResult =
this.imageStorePersonService.batchBind(imageStorePersonBindParam, context);
if (!bindResult.isSuccess()) {
this.logger.error("远程调用绑定人员图库异常,原因:[{}],失败人员id:[{}]", bindResult.getMessage(), bindPersonIds);
return CloudwalkResult.fail(bindResult.getCode(), bindResult.getMessage());
}
}
UpdateGroupPersonRefParam refParam = new UpdateGroupPersonRefParam();
refParam.setBusinessId(context.getCompany().getCompanyId());
refParam.setPersonIds(param.getPersonIds());
refParam.setImageStoreId(imageStoreId);
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
} catch (DataAccessException e) {
this.logger.error("添加通行人员失败,原因:[{}]", (Throwable)e);
throw new ServiceException("76260521", getMessage("76260521"));
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
@CloudwalkParamsValidate
public CloudwalkResult<Boolean> addVisitor(AcsPersonAddVisitorParam param, CloudwalkCallContext context)
throws ServiceException {
this.logger.info("根据被访人添加访客派梯权限开始,AcsPersonAddVisitorParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(param), JSONObject.toJSONString(context));
try {
if (CollectionUtils.isEmpty(param.getFloorIds())) {
PersonDetailParam detailParam = new PersonDetailParam();
detailParam.setId(param.getPersonId());
detailParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<PersonResult> detail = this.personService.detail(detailParam, context);
param.setFloorIds(((PersonResult)detail.getData()).getFloorList());
}
ZoneQueryParam zoneQueryParam = new ZoneQueryParam();
zoneQueryParam.setId(param.getFloorIds().get(0));
zoneQueryParam.setRowsOfPage(10);
zoneQueryParam.setCurrentPage(1);
CloudwalkResult<CloudwalkPageAble<ZoneResult>> zonePage = this.zoneService.page(zoneQueryParam, context);
List<ZoneResult> zoneResults = (List<ZoneResult>)((CloudwalkPageAble)zonePage.getData()).getDatas();
String imageStoreId =
this.deviceImageStoreDao.getByBuildingId(((ZoneResult)zoneResults.get(0)).getParentId());
List<ImageRuleRefAddDto> insertList = new ArrayList<>();
for (String floorId : param.getFloorIds()) {
ImageRuleRefResultDto defaultRule = this.imageRuleRefDao.getDefaultByZoneId(floorId);
ImageRuleRefAddDto addDto = new ImageRuleRefAddDto();
addDto.setId(genUUID());
addDto.setBusinessId(context.getCompany().getCompanyId());
addDto.setPersonId(param.getVisitorId());
addDto.setParentRule(defaultRule.getId());
addDto.setName(defaultRule.getName());
addDto.setZoneId(defaultRule.getZoneId());
addDto.setZoneName(defaultRule.getZoneName());
addDto.setCreateTime(Long.valueOf(System.currentTimeMillis()));
addDto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis()));
addDto.setPersonDelete(Integer.valueOf(0));
insertList.add(addDto);
}
this.logger.info("访客添加派梯权限开始,数据为=[{}]", JSONObject.toJSONString(insertList));
if (!CollectionUtils.isEmpty(insertList)) {
this.imageRuleRefDao.insertList(insertList);
}
ImageStorePersonBindParam imageStorePersonBindParam = new ImageStorePersonBindParam();
imageStorePersonBindParam.setImageStoreId(imageStoreId);
imageStorePersonBindParam.setPersonIds(Collections.singletonList(param.getVisitorId()));
imageStorePersonBindParam.setNullDateIsLongTerm(Boolean.valueOf(true));
imageStorePersonBindParam.setExpiryBeginDate(param.getBegVisitorTime());
imageStorePersonBindParam.setExpiryEndDate(param.getEndVisitorTime());
this.logger.info("远程调用绑定人员图库开始,imageStorePersonBindParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(imageStorePersonBindParam), JSONObject.toJSONString(context));
CloudwalkResult<ImgStoreBatchBindPersonResult> bindResult =
this.imageStorePersonService.batchBind(imageStorePersonBindParam, context);
if (!bindResult.isSuccess()) {
this.logger.error("远程调用绑定人员图库异常,原因:[{}],失败人员id:[{}]", bindResult.getMessage(), param.getVisitorId());
return CloudwalkResult.fail(bindResult.getCode(), bindResult.getMessage());
}
UpdateGroupPersonRefParam refParam = new UpdateGroupPersonRefParam();
refParam.setBusinessId(context.getCompany().getCompanyId());
refParam.setPersonIds(Collections.singletonList(param.getVisitorId()));
refParam.setImageStoreId(imageStoreId);
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
} catch (Exception e) {
this.logger.error("根据被访人添加访客派梯权限失败,原因:[{}]", e);
throw new ServiceException("76260530", getMessage("76260530"));
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
public CloudwalkResult<Boolean> edit(AcsPersonEditParam param, CloudwalkCallContext context)
throws ServiceException {
return null;
}
public CloudwalkResult<Boolean> delete(AcsPersonDeleteParam param, CloudwalkCallContext context)
throws ServiceException {
this.logger.info("从现有人员删除通行人员开始,AcsPersonDeleteParam=[{}], CloudwalkCallContext=[{}]",
JSONObject.toJSONString(param), JSONObject.toJSONString(context));
try {
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
for (String personId : param.getPersonIds()) {
ImageRuleRefResultDto rule =
this.imageRuleRefDao.getByPersonIdAndZoneId(Collections.singletonList(personId), param.getZoneId());
if (!ObjectUtils.isEmpty(rule)) {
this.imageRuleRefDao.deleteByPersonId(personId, param.getZoneId());
continue;
}
ImageRuleRefAddDto addDto = new ImageRuleRefAddDto();
addDto.setId(genUUID());
addDto.setBusinessId(context.getCompany().getCompanyId());
addDto.setPersonId(personId);
addDto.setZoneId(param.getZoneId());
addDto.setPersonDelete(Integer.valueOf(1));
addDto.setCreateTime(Long.valueOf(System.currentTimeMillis()));
addDto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis()));
this.imageRuleRefDao.insert(addDto);
}
UpdateGroupPersonRefParam refParam = new UpdateGroupPersonRefParam();
refParam.setBusinessId(context.getCompany().getCompanyId());
refParam.setPersonIds(param.getPersonIds());
refParam.setImageStoreId(imageStoreId);
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
} catch (DataAccessException e) {
this.logger.error("删除通行人员失败,原因:[{}]", (Throwable)e);
throw new ServiceException("76260523", getMessage("76260523"));
}
return CloudwalkResult.success(Boolean.valueOf(true));
}
public CloudwalkResult<CloudwalkPageAble<AcsPersonResult>> page(AcsPersonQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
this.logger.info("分页查询通行人员开始,AcsPersonQueryParam=[{}], CloudwalkPageInfo=[{}], CloudwalkCallContext=[{}]",
new Object[] {JSONObject.toJSONString(param), JSONObject.toJSONString(pageInfo),
JSONObject.toJSONString(context)});
try {
List<AcsPersonResult> result = new ArrayList<>();
List<String> personIds = null;
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
if (ObjectUtils.isEmpty(imageStoreId)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
param.setImageStoreId(imageStoreId);
List<String> parentRuleList = this.imageRuleRefDao.listRuleByZoneIdExtDefault(param.getZoneId());
List<String> personIdList = this.imageRuleRefDao.countPersonIdByZoneId(param.getZoneId());
if (CollectionUtils.isEmpty(parentRuleList) && CollectionUtils.isEmpty(personIdList)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
param.setPersonIds(personIdList);
if (!CollectionUtils.isEmpty(parentRuleList)) {
List<String> includeLabels = new ArrayList<>();
List<String> includeOrganizations = new ArrayList<>();
List<ImageRuleRefResultDto> child = this.imageRuleRefDao.listByParentRule(parentRuleList);
if (!CollectionUtils.isEmpty(child)) {
for (ImageRuleRefResultDto resultDto : child) {
if (!ObjectUtils.isEmpty(resultDto.getIncludeLabels())) {
includeLabels.add(resultDto.getIncludeLabels());
continue;
}
if (!ObjectUtils.isEmpty(resultDto.getIncludeOrganizations())) {
includeOrganizations.add(resultDto.getIncludeOrganizations());
}
}
} else if (CollectionUtils.isEmpty(personIdList)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
List<String> elevatorIncludeLabels = new ArrayList<>();
List<String> elevatorOrganizations = new ArrayList<>();
if (!CollectionUtils.isEmpty(param.getLabelIds())) {
for (String labelId : param.getLabelIds()) {
if (!includeLabels.contains(labelId)) {
elevatorIncludeLabels.add(labelId);
}
}
}
if (!CollectionUtils.isEmpty(param.getOrganizationIds())) {
for (String orgId : param.getOrganizationIds()) {
if (!includeOrganizations.contains(orgId)) {
elevatorOrganizations.add(orgId);
}
}
}
if (!CollectionUtils.isEmpty(elevatorIncludeLabels)) {
param.setElevatorLabelIds(elevatorIncludeLabels);
}
param.setLabelIds(includeLabels);
if (!CollectionUtils.isEmpty(elevatorOrganizations)) {
param.setElevatorOrganizationIds(elevatorOrganizations);
}
param.setOrganizationIds(includeOrganizations);
List<String> delPersonIds = this.imageRuleRefDao.listPersonDelByZoneId(param.getZoneId());
param.setDelPersonIds(delPersonIds);
}
if (!CollectionUtils.isEmpty(param.getElevatorLabelIds())
|| !CollectionUtils.isEmpty(param.getElevatorOrganizationIds())) {
param.setIsElevator(Integer.valueOf(0));
} else if (!CollectionUtils.isEmpty(param.getLabelIds())
&& !CollectionUtils.isEmpty(param.getOrganizationIds())) {
param.setIsElevator(Integer.valueOf(3));
param.setElevatorLabelIds(param.getLabelIds());
param.setElevatorOrganizationIds(param.getOrganizationIds());
} else if (!CollectionUtils.isEmpty(param.getOrganizationIds())) {
param.setIsElevator(Integer.valueOf(1));
param.setElevatorOrganizationIds(param.getOrganizationIds());
} else if (!CollectionUtils.isEmpty(param.getLabelIds())) {
param.setIsElevator(Integer.valueOf(2));
param.setElevatorLabelIds(param.getLabelIds());
}
if (!StringUtils.isEmpty(param.getPersonName())) {
personIds = getPersonIdsByName(param, context);
if (!CollectionUtils.isEmpty(param.getDelPersonIds()) && !CollectionUtils.isEmpty(personIds)) {
List<String> newPersonIds = new ArrayList<>();
for (int i = 0; i < personIds.size(); i++) {
if (!param.getDelPersonIds().contains(personIds.get(i))) {
newPersonIds.add(personIds.get(i));
}
}
if (CollectionUtils.isEmpty(newPersonIds)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
personIds.clear();
personIds.addAll(newPersonIds);
}
if (CollectionUtils.isEmpty(personIds)) {
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, 0L));
}
}
CloudwalkPageAble<ImageStorePersonResult> pageResult =
getImageStorePerson(param, pageInfo, context, imageStoreId, personIds);
if (!CollectionUtils.isEmpty(pageResult.getDatas())) {
covertPageResult(result, pageResult.getDatas(), context);
}
return CloudwalkResult.success(new CloudwalkPageAble(result, pageInfo, pageResult.getTotalRows()));
} catch (DataAccessException e) {
this.logger.error("分页查询通行人员失败", (Throwable)e);
throw new ServiceException("76260528", getMessage("76260528"));
}
}
public CloudwalkResult<AcsPersonTimeDetailResult> timeDetail(AcsPersonTimeDetailParam param,
CloudwalkCallContext context) throws ServiceException {
return null;
}
public CloudwalkResult<CloudwalkPageAble<AcsPersonResult>> pageByApp(AcsPersonQueryByAppParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context) throws ServiceException {
return null;
}
public CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> personDetail(PersonDetailQueryParam param,
CloudwalkCallContext context) throws ServiceException {
String imageStoreId = this.deviceImageStoreDao.getByBuildingId(param.getParentId());
List<ImageRuleRefResultDto> resultDtos =
this.imageRuleRefDao.listByParentRule(Collections.singletonList(param.getRuleId()));
try {
List<String> delPersonIds = this.imageRuleRefDao.listPersonDelByZoneId(param.getZoneId());
if (CollectionUtils.isEmpty(resultDtos)) {
return CloudwalkResult.success(null);
}
List<String> personIds = new ArrayList<>();
List<String> labelIds = new ArrayList<>();
List<String> orgIds = new ArrayList<>();
for (ImageRuleRefResultDto dto : resultDtos) {
if (!ObjectUtils.isEmpty(dto.getPersonId())) {
personIds.add(dto.getPersonId());
}
if (!ObjectUtils.isEmpty(dto.getIncludeLabels())) {
labelIds.add(dto.getIncludeLabels());
}
if (!ObjectUtils.isEmpty(dto.getIncludeOrganizations())) {
orgIds.add(dto.getIncludeOrganizations());
}
}
ImageStorePersonQueryParam queryParam = new ImageStorePersonQueryParam();
queryParam.setImageStoreId(imageStoreId);
queryParam.setName(param.getPersonName());
queryParam.setPersonIds(personIds);
queryParam.setLabelIds(labelIds);
queryParam.setOrganizationIds(orgIds);
queryParam.setDelPersonIds(delPersonIds);
queryParam.setIsElevator(Integer.valueOf(0));
queryParam.setRowsOfPage(param.getRowsOfPage());
queryParam.setCurrentPage(param.getCurrentPage());
return this.imageStorePersonService.page(queryParam, context);
} catch (DataAccessException e) {
this.logger.error("分页查询通行人员失败", (Throwable)e);
throw new ServiceException("76260528", getMessage("76260528"));
}
}
private List<String> getPersonIdsByName(AcsPersonQueryParam param, CloudwalkCallContext context)
throws ServiceException {
List<String> personIdsByName = new ArrayList<>();
if (StringUtils.isNotBlank(param.getPersonName())) {
PersonQueryParam personQueryParam = new PersonQueryParam();
personQueryParam.setName(param.getPersonName());
personQueryParam.setIds(param.getPersonIds());
personQueryParam.setLabelIds(param.getElevatorLabelIds());
personQueryParam.setOrganizationIds(param.getElevatorOrganizationIds());
personQueryParam.setIsElevator(param.getIsElevator());
CloudwalkResult<List<PersonResult>> personResult = this.personService.list(personQueryParam, context);
List<PersonResult> personList = (List<PersonResult>)personResult.getData();
if (personResult.isSuccess() && CollectionUtils.isNotEmpty(personList)) {
List<PersonResult> newPersonList = new ArrayList<>();
for (PersonResult result : personList) {
if (param.getPersonIds().contains(result.getId())) {
newPersonList.add(result);
continue;
}
if (!CollectionUtils.isEmpty(result.getOrganizationIds())) {
for (String orgId : result.getOrganizationIds()) {
if (!CollectionUtils.isEmpty(param.getOrganizationIds())
&& param.getOrganizationIds().contains(orgId))
newPersonList.add(result);
}
continue;
}
if (!CollectionUtils.isEmpty(result.getLabelIds())) {
for (String labelId : result.getLabelIds()) {
if (!CollectionUtils.isEmpty(param.getLabelIds())
&& param.getLabelIds().contains(labelId)) {
newPersonList.add(result);
}
}
}
}
if (CollectionUtils.isNotEmpty(newPersonList)) {
personIdsByName = (List<String>)newPersonList.stream().map(CloudwalkBaseIdentify::getId)
.collect(Collectors.toList());
}
}
}
return personIdsByName;
}
private CloudwalkPageAble<ImageStorePersonResult> getImageStorePerson(AcsPersonQueryParam param,
CloudwalkPageInfo pageInfo, CloudwalkCallContext context, String imageStoreId, List<String> personIds)
throws ServiceException {
CloudwalkPageAble<ImageStorePersonResult> results = new CloudwalkPageAble();
ImageStorePersonQueryParam imageStorePersonQueryParam = new ImageStorePersonQueryParam();
imageStorePersonQueryParam.setImageStoreId(imageStoreId);
if (!CollectionUtils.isEmpty(personIds)) {
imageStorePersonQueryParam.setPersonIds(personIds);
imageStorePersonQueryParam.setIsElevator(Integer.valueOf(4));
} else {
imageStorePersonQueryParam.setPersonIds(param.getPersonIds());
imageStorePersonQueryParam.setOrganizationIds(param.getElevatorOrganizationIds());
imageStorePersonQueryParam.setLabelIds(param.getElevatorLabelIds());
imageStorePersonQueryParam.setCurrentPage(pageInfo.getCurrentPage());
imageStorePersonQueryParam.setRowsOfPage(pageInfo.getPageSize());
imageStorePersonQueryParam.setIsElevator(param.getIsElevator());
imageStorePersonQueryParam.setDelPersonIds(param.getDelPersonIds());
}
CloudwalkResult<CloudwalkPageAble<ImageStorePersonResult>> pageResult =
this.imageStorePersonService.page(imageStorePersonQueryParam, context);
if (!pageResult.isSuccess()) {
this.logger.error("远程调用查询图库人员失败,原因:[{}]", pageResult.getMessage());
throw new ServiceException(pageResult.getCode(), pageResult.getMessage());
}
if (!CollectionUtils.isEmpty(((CloudwalkPageAble)pageResult.getData()).getDatas())) {
results = (CloudwalkPageAble<ImageStorePersonResult>)pageResult.getData();
}
return results;
}
private void covertPageResult(List<AcsPersonResult> result, Collection<ImageStorePersonResult> datas,
CloudwalkCallContext context) throws ServiceException {
List<String> personIds =
(List<String>)datas.stream().map(ImageStorePersonResult::getPersonId).collect(Collectors.toList());
Map<String, PersonResult> personIcCardMap = getPersonIcCardByIds(personIds, context);
for (ImageStorePersonResult data : datas) {
AcsPassRuleResult rule = null;
AcsPersonResult acsPersonResult = new AcsPersonResult();
BeanCopyUtils.copyProperties(data, acsPersonResult);
acsPersonResult.setPersonName(data.getName());
acsPersonResult.setStartTime(data.getExpiryBeginDate());
acsPersonResult.setEndTime(data.getExpiryEndDate());
acsPersonResult.setPassType(AcsPassTypeEnum.LONG_TIME.getCode());
if (data.getExpiryBeginDate() != null || data.getExpiryEndDate() != null) {
acsPersonResult.setPassType(AcsPassTypeEnum.AUTO_PASS.getCode());
}
if (personIcCardMap != null && personIcCardMap.get(data.getPersonId()) != null) {
acsPersonResult.setIcCardNo(((PersonResult)personIcCardMap.get(data.getPersonId())).getIcCardNo());
}
result.add(acsPersonResult);
}
}
private Map<String, PersonResult> getPersonIcCardByIds(List<String> personIds, CloudwalkCallContext context)
throws ServiceException {
Map<String, PersonResult> personIcCardMap = null;
PersonQueryParam param = new PersonQueryParam();
param.setIds(personIds);
CloudwalkResult<List<PersonResult>> personResult = this.personService.list(param, context);
List<PersonResult> personList = (List<PersonResult>)personResult.getData();
if (personResult.isSuccess() && CollectionUtils.isNotEmpty(personList)) {
personIcCardMap = (Map<String, PersonResult>)personList.stream()
.collect(Collectors.toMap(CloudwalkBaseIdentify::getId, personResult -> personResult));
}
return personIcCardMap;
}
}
@@ -0,0 +1,47 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
public class AcsPersonAddNewParam implements Serializable {
private static final long serialVersionUID = -943980110684030345L;
private String zoneId;
private Long startTime;
private Long endTime;
@Valid
@NotNull(message = "76260408")
private AcsPersonPropertiesParam personProperties;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public Long getStartTime() {
return this.startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return this.endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public AcsPersonPropertiesParam getPersonProperties() {
return this.personProperties;
}
public void setPersonProperties(AcsPersonPropertiesParam personProperties) {
this.personProperties = personProperties;
}
}
@@ -0,0 +1,64 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import java.util.List;
import org.hibernate.validator.constraints.NotEmpty;
public class AcsPersonAddParam implements Serializable {
private static final long serialVersionUID = 1742648191193141962L;
private String parentId;
private String zoneId;
private String zoneName;
@NotEmpty(message = "76260405")
private List<String> personIds;
private Long startTime;
private Long endTime;
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public List<String> getPersonIds() {
return this.personIds;
}
public void setPersonIds(List<String> personIds) {
this.personIds = personIds;
}
public Long getStartTime() {
return this.startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return this.endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
}
@@ -0,0 +1,105 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import java.util.List;
public class AcsPersonAddVisitorParam implements Serializable {
private static final long serialVersionUID = 7916140658162290825L;
private String visitorId;
private String personId;
private Long begVisitorTime;
private Long endVisitorTime;
private List<String> floorIds;
public void setVisitorId(String visitorId) {
this.visitorId = visitorId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public void setBegVisitorTime(Long begVisitorTime) {
this.begVisitorTime = begVisitorTime;
}
public void setEndVisitorTime(Long endVisitorTime) {
this.endVisitorTime = endVisitorTime;
}
public void setFloorIds(List<String> floorIds) {
this.floorIds = floorIds;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsPersonAddVisitorParam))
return false;
AcsPersonAddVisitorParam other = (AcsPersonAddVisitorParam)o;
if (!other.canEqual(this))
return false;
Object this$visitorId = getVisitorId(), other$visitorId = other.getVisitorId();
if ((this$visitorId == null) ? (other$visitorId != null) : !this$visitorId.equals(other$visitorId))
return false;
Object this$personId = getPersonId(), other$personId = other.getPersonId();
if ((this$personId == null) ? (other$personId != null) : !this$personId.equals(other$personId))
return false;
Object this$begVisitorTime = getBegVisitorTime(), other$begVisitorTime = other.getBegVisitorTime();
if ((this$begVisitorTime == null) ? (other$begVisitorTime != null)
: !this$begVisitorTime.equals(other$begVisitorTime))
return false;
Object this$endVisitorTime = getEndVisitorTime(), other$endVisitorTime = other.getEndVisitorTime();
if ((this$endVisitorTime == null) ? (other$endVisitorTime != null)
: !this$endVisitorTime.equals(other$endVisitorTime))
return false;
Object<String> this$floorIds = (Object<String>)getFloorIds(),
other$floorIds = (Object<String>)other.getFloorIds();
return !((this$floorIds == null) ? (other$floorIds != null) : !this$floorIds.equals(other$floorIds));
}
protected boolean canEqual(Object other) {
return other instanceof AcsPersonAddVisitorParam;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $visitorId = getVisitorId();
result = result * 59 + (($visitorId == null) ? 43 : $visitorId.hashCode());
Object $personId = getPersonId();
result = result * 59 + (($personId == null) ? 43 : $personId.hashCode());
Object $begVisitorTime = getBegVisitorTime();
result = result * 59 + (($begVisitorTime == null) ? 43 : $begVisitorTime.hashCode());
Object $endVisitorTime = getEndVisitorTime();
result = result * 59 + (($endVisitorTime == null) ? 43 : $endVisitorTime.hashCode());
Object<String> $floorIds = (Object<String>)getFloorIds();
return result * 59 + (($floorIds == null) ? 43 : $floorIds.hashCode());
}
public String toString() {
return "AcsPersonAddVisitorParam(visitorId=" + getVisitorId() + ", personId=" + getPersonId()
+ ", begVisitorTime=" + getBegVisitorTime() + ", endVisitorTime=" + getEndVisitorTime() + ", floorIds="
+ getFloorIds() + ")";
}
public String getVisitorId() {
return this.visitorId;
}
public String getPersonId() {
return this.personId;
}
public Long getBegVisitorTime() {
return this.begVisitorTime;
}
public Long getEndVisitorTime() {
return this.endVisitorTime;
}
public List<String> getFloorIds() {
return this.floorIds;
}
}
@@ -0,0 +1,35 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import java.util.List;
public class AcsPersonCheckTimeParam implements Serializable {
private static final long serialVersionUID = -4963269689428542769L;
private String personId;
private List<String> imageStoreIds;
private Long time;
public String getPersonId() {
return this.personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public List<String> getImageStoreIds() {
return this.imageStoreIds;
}
public void setImageStoreIds(List<String> imageStoreIds) {
this.imageStoreIds = imageStoreIds;
}
public Long getTime() {
return this.time;
}
public void setTime(Long time) {
this.time = time;
}
}
@@ -0,0 +1,57 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import java.util.List;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
public class AcsPersonDeleteParam implements Serializable {
private static final long serialVersionUID = 1742648191193141962L;
private String parentId;
private String zoneId;
@NotEmpty(message = "76260405")
private List<String> personIds;
@NotBlank(message = "76260418")
private String imageStoreId;
private String personId;
public String getPersonId() {
return this.personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public List<String> getPersonIds() {
return this.personIds;
}
public void setPersonIds(List<String> personIds) {
this.personIds = personIds;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
}
@@ -0,0 +1,27 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPersonDetailParam implements Serializable {
private static final long serialVersionUID = -4991936524378444365L;
private String zoneId;
@NotBlank(message = "76260405")
private String personId;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getPersonId() {
return this.personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
}
@@ -0,0 +1,55 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPersonEditParam implements Serializable {
private static final long serialVersionUID = 1742648191193141962L;
private String zoneId;
@NotBlank(message = "76260405")
private String personId;
private Long startTime;
private Long endTime;
@NotBlank(message = "76260418")
private String imageStoreId;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getPersonId() {
return this.personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public Long getStartTime() {
return this.startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return this.endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
}
@@ -0,0 +1,28 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPersonFaceParam implements Serializable {
private static final long serialVersionUID = 1742648191193141962L;
@NotBlank(message = "76260402")
private String deviceId;
@NotBlank(message = "76260403")
private String faceImage;
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getFaceImage() {
return this.faceImage;
}
public void setFaceImage(String faceImage) {
this.faceImage = faceImage;
}
}
@@ -0,0 +1,487 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import java.util.List;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPersonPropertiesParam implements Serializable {
private static final long serialVersionUID = -448990843685123843L;
private String name;
private String userName;
private String personCode;
private String phone;
private String email;
private List<String> organizationIds;
private List<String> labelIds;
private Long expiryBeginDate;
private Long expiryEndDate;
@NotBlank(message = "76260412")
private String comparePicture;
private String ext1;
private String ext2;
private String ext3;
private String ext4;
private String ext5;
private String ext6;
private String ext7;
private String ext8;
private String ext9;
private String ext10;
private String ext11;
private String ext12;
private String ext13;
private String ext14;
private String ext15;
private String ext16;
private String ext17;
private String ext18;
private String ext19;
private String ext20;
private String ext21;
private String ext22;
private String ext23;
private String ext24;
private String ext25;
private String ext26;
private String ext27;
private String ext28;
private String ext29;
private String ext30;
private String ext31;
private String ext32;
private String ext33;
private String ext34;
private String ext35;
private String ext36;
private String ext37;
private String ext38;
private String ext39;
private String ext40;
private Integer createSysAccount;
private String welcome;
private String showPicture;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPersonCode() {
return this.personCode;
}
public void setPersonCode(String personCode) {
this.personCode = personCode;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public List<String> getOrganizationIds() {
return this.organizationIds;
}
public void setOrganizationIds(List<String> organizationIds) {
this.organizationIds = organizationIds;
}
public List<String> getLabelIds() {
return this.labelIds;
}
public void setLabelIds(List<String> labelIds) {
this.labelIds = labelIds;
}
public Long getExpiryBeginDate() {
return this.expiryBeginDate;
}
public void setExpiryBeginDate(Long expiryBeginDate) {
this.expiryBeginDate = expiryBeginDate;
}
public Long getExpiryEndDate() {
return this.expiryEndDate;
}
public void setExpiryEndDate(Long expiryEndDate) {
this.expiryEndDate = expiryEndDate;
}
public String getComparePicture() {
return this.comparePicture;
}
public void setComparePicture(String comparePicture) {
this.comparePicture = comparePicture;
}
public String getExt1() {
return this.ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return this.ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return this.ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
public String getExt4() {
return this.ext4;
}
public void setExt4(String ext4) {
this.ext4 = ext4;
}
public String getExt5() {
return this.ext5;
}
public void setExt5(String ext5) {
this.ext5 = ext5;
}
public String getExt6() {
return this.ext6;
}
public void setExt6(String ext6) {
this.ext6 = ext6;
}
public String getExt7() {
return this.ext7;
}
public void setExt7(String ext7) {
this.ext7 = ext7;
}
public String getExt8() {
return this.ext8;
}
public void setExt8(String ext8) {
this.ext8 = ext8;
}
public String getExt9() {
return this.ext9;
}
public void setExt9(String ext9) {
this.ext9 = ext9;
}
public String getExt10() {
return this.ext10;
}
public void setExt10(String ext10) {
this.ext10 = ext10;
}
public String getExt11() {
return this.ext11;
}
public void setExt11(String ext11) {
this.ext11 = ext11;
}
public String getExt12() {
return this.ext12;
}
public void setExt12(String ext12) {
this.ext12 = ext12;
}
public String getExt13() {
return this.ext13;
}
public void setExt13(String ext13) {
this.ext13 = ext13;
}
public String getExt14() {
return this.ext14;
}
public void setExt14(String ext14) {
this.ext14 = ext14;
}
public String getExt15() {
return this.ext15;
}
public void setExt15(String ext15) {
this.ext15 = ext15;
}
public String getExt16() {
return this.ext16;
}
public void setExt16(String ext16) {
this.ext16 = ext16;
}
public String getExt17() {
return this.ext17;
}
public void setExt17(String ext17) {
this.ext17 = ext17;
}
public String getExt18() {
return this.ext18;
}
public void setExt18(String ext18) {
this.ext18 = ext18;
}
public String getExt19() {
return this.ext19;
}
public void setExt19(String ext19) {
this.ext19 = ext19;
}
public String getExt20() {
return this.ext20;
}
public void setExt20(String ext20) {
this.ext20 = ext20;
}
public String getExt21() {
return this.ext21;
}
public void setExt21(String ext21) {
this.ext21 = ext21;
}
public String getExt22() {
return this.ext22;
}
public void setExt22(String ext22) {
this.ext22 = ext22;
}
public String getExt23() {
return this.ext23;
}
public void setExt23(String ext23) {
this.ext23 = ext23;
}
public String getExt24() {
return this.ext24;
}
public void setExt24(String ext24) {
this.ext24 = ext24;
}
public String getExt25() {
return this.ext25;
}
public void setExt25(String ext25) {
this.ext25 = ext25;
}
public String getExt26() {
return this.ext26;
}
public void setExt26(String ext26) {
this.ext26 = ext26;
}
public String getExt27() {
return this.ext27;
}
public void setExt27(String ext27) {
this.ext27 = ext27;
}
public String getExt28() {
return this.ext28;
}
public void setExt28(String ext28) {
this.ext28 = ext28;
}
public String getExt29() {
return this.ext29;
}
public void setExt29(String ext29) {
this.ext29 = ext29;
}
public String getExt30() {
return this.ext30;
}
public void setExt30(String ext30) {
this.ext30 = ext30;
}
public String getExt31() {
return this.ext31;
}
public void setExt31(String ext31) {
this.ext31 = ext31;
}
public String getExt32() {
return this.ext32;
}
public void setExt32(String ext32) {
this.ext32 = ext32;
}
public String getExt33() {
return this.ext33;
}
public void setExt33(String ext33) {
this.ext33 = ext33;
}
public String getExt34() {
return this.ext34;
}
public void setExt34(String ext34) {
this.ext34 = ext34;
}
public String getExt35() {
return this.ext35;
}
public void setExt35(String ext35) {
this.ext35 = ext35;
}
public String getExt36() {
return this.ext36;
}
public void setExt36(String ext36) {
this.ext36 = ext36;
}
public String getExt37() {
return this.ext37;
}
public void setExt37(String ext37) {
this.ext37 = ext37;
}
public String getExt38() {
return this.ext38;
}
public void setExt38(String ext38) {
this.ext38 = ext38;
}
public String getExt39() {
return this.ext39;
}
public void setExt39(String ext39) {
this.ext39 = ext39;
}
public String getExt40() {
return this.ext40;
}
public void setExt40(String ext40) {
this.ext40 = ext40;
}
public Integer getCreateSysAccount() {
return this.createSysAccount;
}
public void setCreateSysAccount(Integer createSysAccount) {
this.createSysAccount = createSysAccount;
}
public String getWelcome() {
return this.welcome;
}
public void setWelcome(String welcome) {
this.welcome = welcome;
}
public String getShowPicture() {
return this.showPicture;
}
public void setShowPicture(String showPicture) {
this.showPicture = showPicture;
}
}
@@ -0,0 +1,37 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPersonQueryByAppParam implements Serializable {
private static final long serialVersionUID = -4823559329166668237L;
@NotBlank(message = "76260402")
private String deviceId;
@NotBlank(message = "76260415")
private String applicationId;
private String personName;
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getApplicationId() {
return this.applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public String getPersonName() {
return this.personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
}
@@ -0,0 +1,198 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import java.util.List;
public class AcsPersonQueryParam implements Serializable {
private static final long serialVersionUID = -3343979289939890513L;
private String parentId;
private String zoneId;
private String personName;
private String imageStoreId;
private List<String> organizationIds;
public void setParentId(String parentId) {
this.parentId = parentId;
}
private List<String> labelIds;
private List<String> personIds;
private Integer isElevator;
private List<String> delPersonIds;
private List<String> elevatorLabelIds;
private List<String> elevatorOrganizationIds;
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public void setOrganizationIds(List<String> organizationIds) {
this.organizationIds = organizationIds;
}
public void setLabelIds(List<String> labelIds) {
this.labelIds = labelIds;
}
public void setPersonIds(List<String> personIds) {
this.personIds = personIds;
}
public void setIsElevator(Integer isElevator) {
this.isElevator = isElevator;
}
public void setDelPersonIds(List<String> delPersonIds) {
this.delPersonIds = delPersonIds;
}
public void setElevatorLabelIds(List<String> elevatorLabelIds) {
this.elevatorLabelIds = elevatorLabelIds;
}
public void setElevatorOrganizationIds(List<String> elevatorOrganizationIds) {
this.elevatorOrganizationIds = elevatorOrganizationIds;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsPersonQueryParam))
return false;
AcsPersonQueryParam other = (AcsPersonQueryParam)o;
if (!other.canEqual(this))
return false;
Object this$parentId = getParentId(), other$parentId = other.getParentId();
if ((this$parentId == null) ? (other$parentId != null) : !this$parentId.equals(other$parentId))
return false;
Object this$zoneId = getZoneId(), other$zoneId = other.getZoneId();
if ((this$zoneId == null) ? (other$zoneId != null) : !this$zoneId.equals(other$zoneId))
return false;
Object this$personName = getPersonName(), other$personName = other.getPersonName();
if ((this$personName == null) ? (other$personName != null) : !this$personName.equals(other$personName))
return false;
Object this$imageStoreId = getImageStoreId(), other$imageStoreId = other.getImageStoreId();
if ((this$imageStoreId == null) ? (other$imageStoreId != null) : !this$imageStoreId.equals(other$imageStoreId))
return false;
Object<String> this$organizationIds = (Object<String>)getOrganizationIds(),
other$organizationIds = (Object<String>)other.getOrganizationIds();
if ((this$organizationIds == null) ? (other$organizationIds != null)
: !this$organizationIds.equals(other$organizationIds))
return false;
Object<String> this$labelIds = (Object<String>)getLabelIds(),
other$labelIds = (Object<String>)other.getLabelIds();
if ((this$labelIds == null) ? (other$labelIds != null) : !this$labelIds.equals(other$labelIds))
return false;
Object<String> this$personIds = (Object<String>)getPersonIds(),
other$personIds = (Object<String>)other.getPersonIds();
if ((this$personIds == null) ? (other$personIds != null) : !this$personIds.equals(other$personIds))
return false;
Object this$isElevator = getIsElevator(), other$isElevator = other.getIsElevator();
if ((this$isElevator == null) ? (other$isElevator != null) : !this$isElevator.equals(other$isElevator))
return false;
Object<String> this$delPersonIds = (Object<String>)getDelPersonIds(),
other$delPersonIds = (Object<String>)other.getDelPersonIds();
if ((this$delPersonIds == null) ? (other$delPersonIds != null) : !this$delPersonIds.equals(other$delPersonIds))
return false;
Object<String> this$elevatorLabelIds = (Object<String>)getElevatorLabelIds(),
other$elevatorLabelIds = (Object<String>)other.getElevatorLabelIds();
if ((this$elevatorLabelIds == null) ? (other$elevatorLabelIds != null)
: !this$elevatorLabelIds.equals(other$elevatorLabelIds))
return false;
Object<String> this$elevatorOrganizationIds = (Object<String>)getElevatorOrganizationIds(),
other$elevatorOrganizationIds = (Object<String>)other.getElevatorOrganizationIds();
return !((this$elevatorOrganizationIds == null) ? (other$elevatorOrganizationIds != null)
: !this$elevatorOrganizationIds.equals(other$elevatorOrganizationIds));
}
protected boolean canEqual(Object other) {
return other instanceof AcsPersonQueryParam;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $parentId = getParentId();
result = result * 59 + (($parentId == null) ? 43 : $parentId.hashCode());
Object $zoneId = getZoneId();
result = result * 59 + (($zoneId == null) ? 43 : $zoneId.hashCode());
Object $personName = getPersonName();
result = result * 59 + (($personName == null) ? 43 : $personName.hashCode());
Object $imageStoreId = getImageStoreId();
result = result * 59 + (($imageStoreId == null) ? 43 : $imageStoreId.hashCode());
Object<String> $organizationIds = (Object<String>)getOrganizationIds();
result = result * 59 + (($organizationIds == null) ? 43 : $organizationIds.hashCode());
Object<String> $labelIds = (Object<String>)getLabelIds();
result = result * 59 + (($labelIds == null) ? 43 : $labelIds.hashCode());
Object<String> $personIds = (Object<String>)getPersonIds();
result = result * 59 + (($personIds == null) ? 43 : $personIds.hashCode());
Object $isElevator = getIsElevator();
result = result * 59 + (($isElevator == null) ? 43 : $isElevator.hashCode());
Object<String> $delPersonIds = (Object<String>)getDelPersonIds();
result = result * 59 + (($delPersonIds == null) ? 43 : $delPersonIds.hashCode());
Object<String> $elevatorLabelIds = (Object<String>)getElevatorLabelIds();
result = result * 59 + (($elevatorLabelIds == null) ? 43 : $elevatorLabelIds.hashCode());
Object<String> $elevatorOrganizationIds = (Object<String>)getElevatorOrganizationIds();
return result * 59 + (($elevatorOrganizationIds == null) ? 43 : $elevatorOrganizationIds.hashCode());
}
public String toString() {
return "AcsPersonQueryParam(parentId=" + getParentId() + ", zoneId=" + getZoneId() + ", personName="
+ getPersonName() + ", imageStoreId=" + getImageStoreId() + ", organizationIds=" + getOrganizationIds()
+ ", labelIds=" + getLabelIds() + ", personIds=" + getPersonIds() + ", isElevator=" + getIsElevator()
+ ", delPersonIds=" + getDelPersonIds() + ", elevatorLabelIds=" + getElevatorLabelIds()
+ ", elevatorOrganizationIds=" + getElevatorOrganizationIds() + ")";
}
public String getParentId() {
return this.parentId;
}
public String getZoneId() {
return this.zoneId;
}
public String getPersonName() {
return this.personName;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public List<String> getOrganizationIds() {
return this.organizationIds;
}
public List<String> getLabelIds() {
return this.labelIds;
}
public List<String> getPersonIds() {
return this.personIds;
}
public Integer getIsElevator() {
return this.isElevator;
}
public List<String> getDelPersonIds() {
return this.delPersonIds;
}
public List<String> getElevatorLabelIds() {
return this.elevatorLabelIds;
}
public List<String> getElevatorOrganizationIds() {
return this.elevatorOrganizationIds;
}
}
@@ -0,0 +1,27 @@
package cn.cloudwalk.elevator.person.param;
import java.io.Serializable;
import org.hibernate.validator.constraints.NotBlank;
public class AcsPersonTimeDetailParam implements Serializable {
private static final long serialVersionUID = 9094521665731451301L;
private String imageStoreId;
@NotBlank(message = "76260405")
private String personId;
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getPersonId() {
return this.personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
}
@@ -0,0 +1,87 @@
package cn.cloudwalk.elevator.person.param;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
public class PersonDetailQueryParam extends CloudwalkBasePageForm implements Serializable {
private static final long serialVersionUID = -8830219133147503297L;
private String parentId;
private String zoneId;
private String ruleId;
private String personName;
public void setParentId(String parentId) {
this.parentId = parentId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setRuleId(String ruleId) {
this.ruleId = ruleId;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof PersonDetailQueryParam))
return false;
PersonDetailQueryParam other = (PersonDetailQueryParam)o;
if (!other.canEqual(this))
return false;
Object this$parentId = getParentId(), other$parentId = other.getParentId();
if ((this$parentId == null) ? (other$parentId != null) : !this$parentId.equals(other$parentId))
return false;
Object this$zoneId = getZoneId(), other$zoneId = other.getZoneId();
if ((this$zoneId == null) ? (other$zoneId != null) : !this$zoneId.equals(other$zoneId))
return false;
Object this$ruleId = getRuleId(), other$ruleId = other.getRuleId();
if ((this$ruleId == null) ? (other$ruleId != null) : !this$ruleId.equals(other$ruleId))
return false;
Object this$personName = getPersonName(), other$personName = other.getPersonName();
return !((this$personName == null) ? (other$personName != null) : !this$personName.equals(other$personName));
}
protected boolean canEqual(Object other) {
return other instanceof PersonDetailQueryParam;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $parentId = getParentId();
result = result * 59 + (($parentId == null) ? 43 : $parentId.hashCode());
Object $zoneId = getZoneId();
result = result * 59 + (($zoneId == null) ? 43 : $zoneId.hashCode());
Object $ruleId = getRuleId();
result = result * 59 + (($ruleId == null) ? 43 : $ruleId.hashCode());
Object $personName = getPersonName();
return result * 59 + (($personName == null) ? 43 : $personName.hashCode());
}
public String toString() {
return "PersonDetailQueryParam(parentId=" + getParentId() + ", zoneId=" + getZoneId() + ", ruleId="
+ getRuleId() + ", personName=" + getPersonName() + ")";
}
public String getParentId() {
return this.parentId;
}
public String getZoneId() {
return this.zoneId;
}
public String getRuleId() {
return this.ruleId;
}
public String getPersonName() {
return this.personName;
}
}
@@ -0,0 +1,35 @@
package cn.cloudwalk.elevator.person.result;
import java.io.Serializable;
import java.util.List;
public class AcsAppResult implements Serializable {
private static final long serialVersionUID = 2531683869129123657L;
private String applicationId;
private String applicationName;
private List<String> passIntervals;
public String getApplicationId() {
return this.applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public String getApplicationName() {
return this.applicationName;
}
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
public List<String> getPassIntervals() {
return this.passIntervals;
}
public void setPassIntervals(List<String> passIntervals) {
this.passIntervals = passIntervals;
}
}
@@ -0,0 +1,34 @@
package cn.cloudwalk.elevator.person.result;
import java.io.Serializable;
public class AcsImageStoreStatisticsResult implements Serializable {
private static final long serialVersionUID = 2509672603592424330L;
private String imageStoreId;
private String imageStoreName;
private Integer personNum;
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public String getImageStoreName() {
return this.imageStoreName;
}
public void setImageStoreName(String imageStoreName) {
this.imageStoreName = imageStoreName;
}
public Integer getPersonNum() {
return this.personNum;
}
public void setPersonNum(Integer personNum) {
this.personNum = personNum;
}
}
@@ -0,0 +1,17 @@
package cn.cloudwalk.elevator.person.result;
import java.io.Serializable;
import java.util.List;
public class AcsImagestorePersonStatisticsResult implements Serializable {
private static final long serialVersionUID = 8443213995134853671L;
private List<AppImageStoreStatisticsResult> appImageStores;
public List<AppImageStoreStatisticsResult> getAppImageStores() {
return this.appImageStores;
}
public void setAppImageStores(List<AppImageStoreStatisticsResult> appImageStores) {
this.appImageStores = appImageStores;
}
}

Some files were not shown because too many files have changed in this diff Show More