diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/AreaTypeServiceImpl.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/AreaTypeServiceImpl.java deleted file mode 100644 index 7dc51ce3..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/AreaTypeServiceImpl.java +++ /dev/null @@ -1,392 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.organization.common.enums.AreaTypeCodeEnum; -import cn.cloudwalk.client.organization.param.AddAreaTypeParam; -import cn.cloudwalk.client.organization.param.AreaTypePropertyParam; -import cn.cloudwalk.client.organization.param.DelAreaTypeParam; -import cn.cloudwalk.client.organization.param.EditAreaTypeParam; -import cn.cloudwalk.client.organization.param.QueryAreaTypeParam; -import cn.cloudwalk.client.organization.result.AreaTypeListResult; -import cn.cloudwalk.client.organization.result.AreaTypeResult; -import cn.cloudwalk.client.organization.service.AreaTypeService; -import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate; -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.cloud.utils.CloudwalkDateUtils; -import cn.cloudwalk.data.organization.dto.AreaTypeQueryDTO; -import cn.cloudwalk.data.organization.dto.GetsAreaDTO; -import cn.cloudwalk.data.organization.entity.Area; -import cn.cloudwalk.data.organization.entity.AreaType; -import cn.cloudwalk.data.organization.entity.AreaTypeProperties; -import cn.cloudwalk.data.organization.mapper.ImgStoreAreaMapper; -import cn.cloudwalk.data.organization.mapper.ImgStoreAreaTypeMapper; -import cn.cloudwalk.data.organization.mapper.ImgStoreAreaTypePropertiesMapper; -import cn.cloudwalk.service.organization.common.AbstractImagStoreService; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.annotation.Resource; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -@Primary -@Service -public class AreaTypeServiceImpl -extends AbstractImagStoreService -implements AreaTypeService { - @Resource - private ImgStoreAreaMapper areaMapper; - @Resource - private ImgStoreAreaTypeMapper areaTypeMapper; - @Resource - private ImgStoreAreaTypePropertiesMapper areaTypePropertiesMapper; - private static final String EXT = "ext"; - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult add(AddAreaTypeParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = StringUtils.isEmpty((Object)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId(); - if (businessId.equals("cloudwalk")) { - throw new ServiceException("53003818", this.getMessage("53003818")); - } - HashSet nameMap = new HashSet(); - List properties = param.getProperties(); - for (AreaTypePropertyParam propertyParam : properties) { - nameMap.add(propertyParam.getName()); - } - if (nameMap.size() < properties.size()) { - throw new ServiceException("53003805", this.getMessage("53003805")); - } - AreaTypeQueryDTO areaTypeQueryDTO = (AreaTypeQueryDTO)BeanCopyUtils.copyProperties((Object)param, AreaTypeQueryDTO.class); - areaTypeQueryDTO.setStatus(Integer.valueOf(0)); - areaTypeQueryDTO.setBusinessId(businessId); - List select = this.areaTypeMapper.selectByCondition(areaTypeQueryDTO); - if (!CollectionUtils.isEmpty((Collection)select)) { - throw new ServiceException("53004803", this.getMessage("53004803")); - } - AreaType areaType = (AreaType)BeanCopyUtils.copyProperties((Object)param, AreaType.class); - String uuid = CloudwalkDateUtils.getUUID(); - areaType.setId(uuid); - areaType.setBusinessId(businessId); - areaType.setCreateTime(Long.valueOf(System.currentTimeMillis())); - areaType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - areaType.setCreateUserId(context.getUser().getCaller()); - areaType.setLastUpdateUserId(context.getUser().getCaller()); - this.areaTypeMapper.insertSelective(areaType); - int index = 1; - if (!CollectionUtils.isEmpty((Collection)properties)) { - for (AreaTypePropertyParam propertyParam : properties) { - AreaTypeProperties property = (AreaTypeProperties)BeanCopyUtils.copyProperties((Object)propertyParam, AreaTypeProperties.class); - property.setId(CloudwalkDateUtils.getUUID()); - property.setBusinessId(businessId); - property.setAreaTypeId(uuid); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateUserId(context.getUser().getCaller()); - property.setLastUpdateUserId(context.getUser().getCaller()); - property.setCode(EXT + index++); - this.areaTypePropertiesMapper.insertSelective(property); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult edit(EditAreaTypeParam param, CloudwalkCallContext context) throws ServiceException { - block18: { - List typePropertiesDB; - boolean hasOrganization; - List properties; - String businessId; - block19: { - businessId = StringUtils.isEmpty((Object)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId(); - if (businessId.equals("cloudwalk")) { - throw new ServiceException("53003818", this.getMessage("53003818")); - } - HashSet nameMap = new HashSet(); - properties = param.getProperties(); - for (AreaTypePropertyParam propertyParam : properties) { - nameMap.add(propertyParam.getName()); - } - if (nameMap.size() < properties.size()) { - throw new ServiceException("53003805", this.getMessage("53003805")); - } - AreaTypeQueryDTO areaTypeQuery = new AreaTypeQueryDTO(); - areaTypeQuery.setName(param.getName()); - areaTypeQuery.setStatus(Integer.valueOf(0)); - areaTypeQuery.setBusinessId(businessId); - List select = this.areaTypeMapper.selectByCondition(areaTypeQuery); - if (!CollectionUtils.isEmpty((Collection)select)) { - for (AreaType type : select) { - if (type.getId().equals(param.getId())) continue; - throw new ServiceException("53004803", this.getMessage("53004803")); - } - } - hasOrganization = false; - boolean hasChildren = false; - GetsAreaDTO areaDTO = new GetsAreaDTO(); - areaDTO.setTypeId(param.getId()); - areaDTO.setIsDel(Short.valueOf((short)0)); - List areas = this.areaMapper.gets(areaDTO); - if (!CollectionUtils.isEmpty((Collection)areas)) { - hasOrganization = true; - ArrayList parentIds = new ArrayList(); - for (Area area : areas) { - parentIds.add(area.getId()); - } - areaDTO = new GetsAreaDTO(); - areaDTO.setIsDel(Short.valueOf((short)0)); - areaDTO.setParentIds(parentIds); - List childrens = this.areaMapper.gets(areaDTO); - if (childrens != null && childrens.size() > 0) { - hasChildren = true; - } - } - if (param.getHasLowerLevel() == 0 && hasChildren) { - throw new ServiceException("53004813", this.getMessage("53004813")); - } - AreaType areaType = (AreaType)BeanCopyUtils.copyProperties((Object)areaTypeQuery, AreaType.class); - areaType.setId(param.getId()); - areaType.setHasLowerLevel(param.getHasLowerLevel()); - areaType.setLastUpdateUserId(context.getUser().getCaller()); - areaType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - this.areaTypeMapper.updateByPrimaryKeySelective(areaType); - AreaTypeProperties proQuery = new AreaTypeProperties(); - proQuery.setAreaTypeId(param.getId()); - typePropertiesDB = this.areaTypePropertiesMapper.select(proQuery); - if (properties == null) break block18; - if (!CollectionUtils.isEmpty((Collection)typePropertiesDB)) break block19; - int index = 1; - for (AreaTypePropertyParam propertyParam : properties) { - AreaTypeProperties property = (AreaTypeProperties)BeanCopyUtils.copyProperties((Object)propertyParam, AreaTypeProperties.class); - property.setId(CloudwalkDateUtils.getUUID()); - property.setBusinessId(businessId); - property.setAreaTypeId(param.getId()); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateUserId(context.getUser().getCaller()); - property.setLastUpdateUserId(context.getUser().getCaller()); - property.setCode(EXT + index++); - property.setStatus(Integer.valueOf(0)); - this.areaTypePropertiesMapper.insertSelective(property); - } - break block18; - } - HashMap DBMap = new HashMap(); - HashSet codeSet = new HashSet(); - for (AreaTypeProperties areaTypeProperties : typePropertiesDB) { - String code = areaTypeProperties.getCode(); - codeSet.add(code); - DBMap.put(areaTypeProperties.getId(), areaTypeProperties); - } - List newList = BeanCopyUtils.copy((Collection)properties, AreaTypeProperties.class); - ArrayList newListCopy = new ArrayList(newList); - newListCopy.retainAll(typePropertiesDB); - if (!CollectionUtils.isEmpty(newListCopy)) { - for (AreaTypeProperties areaTypeProperties : newListCopy) { - Integer hasRequired; - if (hasOrganization && areaTypeProperties.getHasRequired() == 1 && (hasRequired = ((AreaTypeProperties)DBMap.get(areaTypeProperties.getId())).getHasRequired()) != null && hasRequired == 0) { - throw new ServiceException("53004815", this.getMessage("53004815")); - } - areaTypeProperties.setStatus(Integer.valueOf(0)); - areaTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - areaTypeProperties.setLastUpdateUserId(context.getUser().getCaller()); - this.areaTypePropertiesMapper.updateByPrimaryKeySelective(areaTypeProperties); - } - } - typePropertiesDB.removeAll(newListCopy); - if (!CollectionUtils.isEmpty((Collection)typePropertiesDB)) { - for (AreaTypeProperties areaTypeProperties : typePropertiesDB) { - areaTypeProperties.setStatus(Integer.valueOf(1)); - areaTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - areaTypeProperties.setLastUpdateUserId(context.getUser().getCaller()); - this.areaTypePropertiesMapper.updateByPrimaryKeySelective(areaTypeProperties); - codeSet.remove(areaTypeProperties.getCode()); - String typeId = param.getId(); - String codeProperty = areaTypeProperties.getCode(); - this.areaMapper.removePropertyByTypeIdAndCode(typeId, codeProperty); - } - } - newList.removeAll(newListCopy); - if (CollectionUtils.isEmpty((Collection)newList)) break block18; - for (AreaTypeProperties areaTypeProperties : newList) { - if (areaTypeProperties.getHasRequired() == 1 && hasOrganization) { - throw new ServiceException("53003814", this.getMessage("53003814")); - } - areaTypeProperties.setId(CloudwalkDateUtils.getUUID()); - areaTypeProperties.setBusinessId(businessId); - areaTypeProperties.setAreaTypeId(param.getId()); - areaTypeProperties.setCreateTime(Long.valueOf(System.currentTimeMillis())); - areaTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - areaTypeProperties.setCreateUserId(context.getUser().getCaller()); - areaTypeProperties.setLastUpdateUserId(context.getUser().getCaller()); - areaTypeProperties.setCode(this.getCode(codeSet)); - areaTypeProperties.setStatus(Integer.valueOf(0)); - this.areaTypePropertiesMapper.insertSelective(areaTypeProperties); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Transactional(rollbackFor={Exception.class}) - public CloudwalkResult delete(DelAreaTypeParam param, CloudwalkCallContext context) throws ServiceException { - List ids = param.getIds(); - if (!CollectionUtils.isEmpty((Collection)ids)) { - for (String typeId : ids) { - GetsAreaDTO getsAreaDTO = new GetsAreaDTO(); - getsAreaDTO.setTypeId(typeId); - getsAreaDTO.setIsDel(Short.valueOf((short)0)); - List gets = this.areaMapper.gets(getsAreaDTO); - if (CollectionUtils.isEmpty((Collection)gets)) continue; - throw new ServiceException("53004854", this.getMessage("53004854")); - } - for (String id : ids) { - AreaType areaType = this.areaTypeMapper.selectByPrimaryKey(id); - if (areaType == null) { - throw new ServiceException("53015104", this.getMessage("53015104")); - } - areaType.setId(id); - AreaType areaTypeDB = this.areaTypeMapper.selectByPrimaryKey(id); - if ("cloudwalk".equals(areaTypeDB.getBusinessId())) { - throw new ServiceException("53003818", this.getMessage("53003818")); - } - areaType.setStatus(Integer.valueOf(1)); - areaType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - areaType.setLastUpdateUserId(context.getUser().getCaller()); - this.areaTypeMapper.updateByPrimaryKeySelective(areaType); - AreaTypeProperties record = new AreaTypeProperties(); - record.setAreaTypeId(id); - record.setStatus(Integer.valueOf(1)); - record.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - record.setLastUpdateUserId(context.getUser().getCaller()); - this.areaTypePropertiesMapper.updateByTypeKey(record); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult> page(QueryAreaTypeParam param, CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException { - String businessId = context.getCompany().getCompanyId(); - ArrayList results = new ArrayList(); - AreaTypeQueryDTO record = (AreaTypeQueryDTO)BeanCopyUtils.copyProperties((Object)param, AreaTypeQueryDTO.class); - record.setBusinessId(businessId); - record.setStatus(Integer.valueOf(0)); - try { - PageHelper.startPage((int)page.getCurrentPage(), (int)page.getPageSize()); - Page gets = (Page)this.areaTypeMapper.select(record); - List result = gets.getResult(); - Map deletableMap = AreaTypeCodeEnum.deletable((String)AreaTypeCodeEnum.PARK.getGroup()); - for (AreaType areaType : result) { - AreaTypeListResult typeResult = (AreaTypeListResult)BeanCopyUtils.copyProperties((Object)areaType, AreaTypeListResult.class); - typeResult.setDeletable(deletableMap.getOrDefault(areaType.getCode(), 1)); - AreaTypeProperties recordQuery = new AreaTypeProperties(); - recordQuery.setStatus(Integer.valueOf(0)); - recordQuery.setAreaTypeId(areaType.getId()); - List propertiesList = this.areaTypePropertiesMapper.select(recordQuery); - if (!CollectionUtils.isEmpty((Collection)propertiesList)) { - StringBuilder builder = new StringBuilder(); - for (AreaTypeProperties areaTypeProperties : propertiesList) { - builder.append("," + areaTypeProperties.getName()); - } - typeResult.setProperties(builder.substring(1)); - } else { - typeResult.setProperties(""); - } - results.add(typeResult); - } - CloudwalkPageAble pageAble = new CloudwalkPageAble(results, page, gets.getTotal()); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - catch (Exception e) { - this.logger.error("分页查询区域类型信息失败,原因:", e); - throw new ServiceException("53004804", this.getMessage("53004804")); - } - } - - public CloudwalkResult> getList(QueryAreaTypeParam param, CloudwalkCallContext context) throws ServiceException { - List propertiesList; - AreaTypeListResult typeResult; - String businessId = StringUtils.isEmpty((Object)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId(); - ArrayList results = new ArrayList(); - AreaTypeQueryDTO record = (AreaTypeQueryDTO)BeanCopyUtils.copyProperties((Object)param, AreaTypeQueryDTO.class); - record.setBusinessId(businessId); - record.setStatus(Integer.valueOf(0)); - List result = this.areaTypeMapper.select(record); - for (AreaType areaType : result) { - typeResult = (AreaTypeListResult)BeanCopyUtils.copyProperties((Object)areaType, AreaTypeListResult.class); - AreaTypeProperties recordQuery = new AreaTypeProperties(); - recordQuery.setStatus(Integer.valueOf(0)); - recordQuery.setAreaTypeId(areaType.getId()); - propertiesList = this.areaTypePropertiesMapper.select(recordQuery); - if (!CollectionUtils.isEmpty((Collection)propertiesList)) { - StringBuilder builder = new StringBuilder(); - for (AreaTypeProperties areaTypeProperties : propertiesList) { - builder.append("," + areaTypeProperties.getName()); - } - typeResult.setProperties(builder.substring(1)); - } else { - typeResult.setProperties(""); - } - results.add(typeResult); - } - record = new AreaTypeQueryDTO(); - record.setBusinessId("cloudwalk"); - record.setStatus(Integer.valueOf(0)); - record.setHasDefault(Integer.valueOf(1)); - List areaTypes = this.areaTypeMapper.select(record); - if (!CollectionUtils.isEmpty((Collection)areaTypes)) { - for (AreaType areaType : areaTypes) { - typeResult = (AreaTypeListResult)BeanCopyUtils.copyProperties((Object)areaType, AreaTypeListResult.class); - AreaTypeProperties recordQuery = new AreaTypeProperties(); - recordQuery.setStatus(Integer.valueOf(0)); - recordQuery.setAreaTypeId(areaType.getId()); - propertiesList = this.areaTypePropertiesMapper.select(recordQuery); - if (!CollectionUtils.isEmpty((Collection)propertiesList)) { - StringBuilder builder = new StringBuilder(); - for (AreaTypeProperties areaTypeProperties : propertiesList) { - builder.append("," + areaTypeProperties.getName()); - } - typeResult.setProperties(builder.substring(1)); - } - results.add(typeResult); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult detail(QueryAreaTypeParam param, CloudwalkCallContext cloudwalkContext) throws ServiceException { - if (StringUtils.isEmpty((Object)param.getId())) { - throw new ServiceException("53060410", this.getMessage("53060410")); - } - AreaType areaType = this.areaTypeMapper.selectByPrimaryKey(param.getId()); - AreaTypeResult result = (AreaTypeResult)BeanCopyUtils.copyProperties((Object)areaType, AreaTypeResult.class); - AreaTypeProperties proQuery = new AreaTypeProperties(); - proQuery.setAreaTypeId(param.getId()); - List typeProperties = this.areaTypePropertiesMapper.select(proQuery); - result.setProperties(BeanCopyUtils.copy((Collection)typeProperties, AreaTypePropertyParam.class)); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private String getCode(Set codeSet) { - for (int i = 1; i <= 30; ++i) { - if (!codeSet.add(EXT + i)) continue; - return EXT + i; - } - return null; - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpDeviceImagePersonServiceImpl.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpDeviceImagePersonServiceImpl.java deleted file mode 100644 index 7237cb4e..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpDeviceImagePersonServiceImpl.java +++ /dev/null @@ -1,574 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.aggregate.application.param.ApplicationImageStoreQueryParam; -import cn.cloudwalk.client.aggregate.application.result.ApplicationImageStoreQueryResult; -import cn.cloudwalk.client.aggregate.application.service.ApplicationImageStoreService; -import cn.cloudwalk.client.aggregate.common.enums.DelStatusEnum; -import cn.cloudwalk.client.aggregate.group.param.AgImageFeatureQueryParam; -import cn.cloudwalk.client.aggregate.group.result.AgImageFeatureResult; -import cn.cloudwalk.client.aggregate.group.service.AgImageFeatureService; -import cn.cloudwalk.client.organization.common.enums.DeviceAbilityEnum; -import cn.cloudwalk.client.organization.common.enums.SyncStatusEnum; -import cn.cloudwalk.client.organization.param.QueryZoneForm; -import cn.cloudwalk.client.organization.result.ZoneResult; -import cn.cloudwalk.client.organization.service.store.param.BatchPassRuleParam; -import cn.cloudwalk.client.organization.service.store.param.DeviceImagePersonRefQuery; -import cn.cloudwalk.client.organization.service.store.param.DeviceImageUpdateFeatureQuery; -import cn.cloudwalk.client.organization.service.store.param.DeviceImageUpdatePersonQuery; -import cn.cloudwalk.client.organization.service.store.param.PassRuleParam; -import cn.cloudwalk.client.organization.service.store.result.BatchPassRuleResult; -import cn.cloudwalk.client.organization.service.store.result.DeviceImagePersonRefResult; -import cn.cloudwalk.client.organization.service.store.result.DeviceImageUpdateFeautreResult; -import cn.cloudwalk.client.organization.service.store.result.DeviceImageUpdatePersonResult; -import cn.cloudwalk.client.organization.service.store.service.CpDeviceImagePersonService; -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.serial.UUIDSerial; -import cn.cloudwalk.data.organization.dto.DevicePersonSyncLogDTO; -import cn.cloudwalk.data.organization.dto.GroupPersonRefDTO; -import cn.cloudwalk.data.organization.dto.QueryGroupPersonDTO; -import cn.cloudwalk.data.organization.entity.DevicePerson; -import cn.cloudwalk.data.organization.entity.DevicePersonSyncLog; -import cn.cloudwalk.data.organization.entity.GroupPersonRef; -import cn.cloudwalk.data.organization.entity.ImgStorePerson; -import cn.cloudwalk.data.organization.mapper.DevicePersonMapper; -import cn.cloudwalk.data.organization.mapper.DevicePersonSyncLogMapper; -import cn.cloudwalk.data.organization.mapper.GroupPersonRefMapper; -import cn.cloudwalk.data.organization.mapper.ImgStorePersonLabelMapper; -import cn.cloudwalk.data.organization.mapper.ImgStorePersonMapper; -import cn.cloudwalk.data.organization.mapper.ImgStorePersonOrganizationMapper; -import cn.cloudwalk.device.sdk.protocol.entity.v2proto.http.result.UpdatePersonResult; -import cn.cloudwalk.service.organization.common.AbstractImagStoreService; -import cn.cloudwalk.service.organization.common.FileUtil; -import cn.cloudwalk.service.organization.compare.NaturalOrderComparator; -import cn.cloudwalk.service.organization.service.feign.ElevatorAppFeignClient; -import cn.cloudwalk.service.organization.service.feign.ZoneFeignClient; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.Page; -import com.github.pagehelper.page.PageMethod; -import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import javax.annotation.Resource; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -@Service -public class CpDeviceImagePersonServiceImpl -extends AbstractImagStoreService -implements CpDeviceImagePersonService { - private static final String SYNC_LOG_KEY = "lock_sync_log_"; - @Value(value="${cloudwalk.person.sync-log-expire-time:10}") - private long syncLogExpireTime; - @Resource - private GroupPersonRefMapper groupPersonRefMapper; - @Resource - private ImgStorePersonMapper imgStorePersonMapper; - @Autowired - private AgImageFeatureService agImageFeatureService; - @Value(value="${cloudwalk.component.file.urlPrefix}") - private String fileUrlPrefix; - @Value(value="${cloudwalk.component.imagePerson.imagebase64.enable:false}") - private Boolean base64Enable; - @Resource - private ZoneFeignClient zoneFeignClient; - @Resource - private ElevatorAppFeignClient elevatorAppFeignClient; - @Resource - private DevicePersonSyncLogMapper devicePersonSyncLogMapper; - @Resource - private DevicePersonMapper devicePersonMapper; - @Resource - private UUIDSerial uuidSerial; - @Autowired - private StringRedisTemplate redisTemplate; - @Resource - private ImgStorePersonOrganizationMapper imgStorePersonOrganizationMapper; - @Resource - private ImgStorePersonLabelMapper imgStorePersonLabelMapper; - @Resource - private ApplicationImageStoreService appImageStoreService; - - public CloudwalkResult> getImagePersonRefs(DeviceImagePersonRefQuery queryParam, CloudwalkCallContext context) throws ServiceException { - ArrayList deviceImagePersonRefResults = new ArrayList(); - if (StringUtils.isBlank((CharSequence)queryParam.getImageStoreId()) && CollectionUtils.isEmpty((Collection)queryParam.getImageStoreIds())) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - if (StringUtils.isNotBlank((CharSequence)queryParam.getImageStoreId())) { - queryParam.setImageStoreIds((List)Lists.newArrayList((Object[])new String[]{queryParam.getImageStoreId()})); - } - List imageStoreIds = queryParam.getImageStoreIds(); - for (String imageId : imageStoreIds) { - DeviceImagePersonRefResult deviceImagePersonRefResult = new DeviceImagePersonRefResult(); - deviceImagePersonRefResult.setImageStoreId(imageId); - QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO(); - queryGroupPersonDTO.setImageStoreId(imageId); - PageMethod.startPage((int)queryParam.getCurrentPage(), (int)1); - PageMethod.orderBy((String)"LAST_UPDATE_TIME DESC"); - Page groupPersonRefs = (Page)this.groupPersonRefMapper.query(queryGroupPersonDTO); - if (!CollectionUtils.isNotEmpty((Collection)groupPersonRefs.getResult())) continue; - Long lastUpdateTime = ((GroupPersonRef)groupPersonRefs.getResult().get(0)).getLastUpdateTime(); - deviceImagePersonRefResult.setImageLastUpdateTime(lastUpdateTime); - deviceImagePersonRefResults.add(deviceImagePersonRefResult); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult> getDeviceImageUpdatePersonInfo(DeviceImageUpdatePersonQuery query, CloudwalkCallContext context) throws ServiceException { - ArrayList deviceImageUpdatePersonResults = new ArrayList(); - QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO(); - queryGroupPersonDTO.setImageStoreId(query.getImageStoreId()); - queryGroupPersonDTO.setLastUpdateTime(query.getLastUpdateTime()); - queryGroupPersonDTO.setSequenceId(String.valueOf(query.getSequenceId())); - CloudwalkPageInfo page = new CloudwalkPageInfo(query.getCurrentPage(), query.getRowsOfPage()); - PageMethod.startPage((int)query.getCurrentPage(), (int)query.getRowsOfPage()); - PageMethod.orderBy((String)"LAST_UPDATE_TIME ASC,PERSON_ID ASC"); - Page groupPersonRefs = (Page)this.groupPersonRefMapper.query(queryGroupPersonDTO); - List personRefsResult = groupPersonRefs.getResult(); - for (GroupPersonRef groupPersonRef : personRefsResult) { - if (groupPersonRef.getPersonId() == null) continue; - DeviceImageUpdatePersonResult deviceImageUpdatePersonResult = new DeviceImageUpdatePersonResult(); - deviceImageUpdatePersonResult.setPersonId(groupPersonRef.getPersonId()); - if (query.getSupportPersonValiddate() != null && DeviceAbilityEnum.SUPPORT_PERSON_VALIDDATE.getCode() == query.getSupportPersonValiddate().intValue()) { - if (-1 == groupPersonRef.getStatus()) { - deviceImageUpdatePersonResult.setType(Integer.valueOf(DelStatusEnum.DELETED.getCode().shortValue())); - } else { - deviceImageUpdatePersonResult.setType(Integer.valueOf(DelStatusEnum.NORAML.getCode().shortValue())); - } - } else { - deviceImageUpdatePersonResult.setType(Integer.valueOf(groupPersonRef.getIsDel().intValue())); - } - if (groupPersonRef.getIsDel() != null && DelStatusEnum.NORAML.getCode().shortValue() == groupPersonRef.getIsDel().shortValue()) { - deviceImageUpdatePersonResult.setStatus(Integer.valueOf(1)); - } else { - deviceImageUpdatePersonResult.setStatus(Integer.valueOf(0)); - } - deviceImageUpdatePersonResult.setImageStoreId(groupPersonRef.getImageStoreId()); - deviceImageUpdatePersonResult.setTimestamp(groupPersonRef.getLastUpdateTime()); - deviceImageUpdatePersonResult.setSequenceId(Long.valueOf(groupPersonRef.getPersonId())); - deviceImageUpdatePersonResult.setExpiryBeginDate(groupPersonRef.getExpiryBeginDate()); - deviceImageUpdatePersonResult.setExpiryEndDate(groupPersonRef.getExpiryEndDate()); - ImgStorePerson imgStorePerson = this.imgStorePersonMapper.selectByPrimaryKey(groupPersonRef.getPersonId()); - if (imgStorePerson != null) { - JSONObject json; - deviceImageUpdatePersonResult.setImageStoreId(groupPersonRef.getImageStoreId()); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getReserveInfo())) { - json = JSONObject.parseObject((String)imgStorePerson.getReserveInfo()); - if (null != json.get((Object)"icCardNo") && StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardNo())) { - json.put("icCardNo", (Object)imgStorePerson.getIcCardNo()); - } - if (null != json.get((Object)"icCardType") && StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardType())) { - json.put("icCardType", (Object)imgStorePerson.getIcCardType()); - } - deviceImageUpdatePersonResult.setReserveInfo(JSON.toJSONString((Object)json)); - } else { - json = new JSONObject(); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardNo())) { - json.put("icCardNo", (Object)imgStorePerson.getIcCardNo()); - } - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardType())) { - json.put("icCardType", (Object)imgStorePerson.getIcCardType()); - } - deviceImageUpdatePersonResult.setReserveInfo(JSON.toJSONString((Object)json)); - } - deviceImageUpdatePersonResult.setName(imgStorePerson.getName()); - deviceImageUpdatePersonResult.setMobileNumber(imgStorePerson.getPhone()); - if (imgStorePerson.getCreateTime() != null) { - deviceImageUpdatePersonResult.setCreateDate(imgStorePerson.getCreateTime().toString()); - } - ArrayList faceDatas = new ArrayList(); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getComparePicture())) { - DeviceImageUpdatePersonResult.FaceData personFaceData = new DeviceImageUpdatePersonResult.FaceData(); - personFaceData.setFaceId(imgStorePerson.getImageId()); - personFaceData.setPictureUrl(this.fileUrlPrefix + imgStorePerson.getComparePicture()); - faceDatas.add(personFaceData); - } - deviceImageUpdatePersonResult.setFaceData(faceDatas); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getShowPicture())) { - DeviceImageUpdatePersonResult.ImageData imageData = new DeviceImageUpdatePersonResult.ImageData(); - try { - imageData.setImageUrl(this.fileUrlPrefix + imgStorePerson.getShowPicture()); - if (this.base64Enable.booleanValue() && deviceImageUpdatePersonResult.getStatus() == 1) { - imageData.setImageType(Integer.valueOf(0)); - imageData.setImage(FileUtil.url2base64(imageData.getImageUrl())); - } - deviceImageUpdatePersonResult.setShowImage(imageData); - } - catch (Exception e) { - this.logger.warn("{} imageData url2BASE64 error {}", (Object)imageData.getImageUrl(), (Object)e.getMessage()); - } - } - } else { - deviceImageUpdatePersonResult.setStatus(Integer.valueOf(0)); - } - deviceImageUpdatePersonResults.add(deviceImageUpdatePersonResult); - } - CloudwalkPageAble resultCloudwalkPageAble = new CloudwalkPageAble(deviceImageUpdatePersonResults, page, groupPersonRefs.getTotal()); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private boolean elevatorGroup(String imageStoreId, CloudwalkCallContext context) { - Boolean elevatorGroup = false; - ApplicationImageStoreQueryParam queryParam = new ApplicationImageStoreQueryParam(); - queryParam.setImageStoreId(imageStoreId); - CloudwalkResult appImageStoreResult = this.appImageStoreService.query(queryParam, context); - if (appImageStoreResult.isSuccess() && !CollectionUtils.isEmpty((Collection)((Collection)appImageStoreResult.getData())) && "派梯应用".equals(((ApplicationImageStoreQueryResult)((List)appImageStoreResult.getData()).get(0)).getApplicationName())) { - elevatorGroup = true; - } - return elevatorGroup; - } - - private Map personPassRule(List personRefsResult, CloudwalkCallContext context) { - HashMap personPassRuleMap = new HashMap(); - if (!CollectionUtils.isEmpty(personRefsResult)) { - List personIds = personRefsResult.stream().map(GroupPersonRef::getPersonId).collect(Collectors.toList()); - long t3 = System.currentTimeMillis(); - List personOrgMapList = this.imgStorePersonOrganizationMapper.groupByPerson(personIds); - long t4 = System.currentTimeMillis(); - this.logger.info("20113 getDeviceUpdatePersonInfo queryPersonOrg,spend time {} millis", (Object)(t4 - t3)); - Map personOrgMap = personOrgMapList.stream().collect(Collectors.toMap(map -> (String)map.get("personId"), map -> (String)map.get("orgIds"))); - t3 = System.currentTimeMillis(); - List personLabelMapList = this.imgStorePersonLabelMapper.groupByPerson(personIds); - t4 = System.currentTimeMillis(); - this.logger.info("20113 getDeviceUpdatePersonInfo queryPersonLabel,spend time {} millis", (Object)(t4 - t3)); - Map personLabelMap = personLabelMapList.stream().collect(Collectors.toMap(map -> (String)map.get("personId"), map -> (String)map.get("labelIds"))); - ArrayList passRuleParamList = Lists.newArrayListWithCapacity((int)personIds.size()); - personIds.forEach(personId -> { - List orgIds = Optional.ofNullable(personOrgMap.get(personId)).map(x -> Arrays.asList(x.split(","))).orElse(new ArrayList()); - List labelIds = Optional.ofNullable(personLabelMap.get(personId)).map(x -> Arrays.asList(x.split(","))).orElse(new ArrayList()); - PassRuleParam param = new PassRuleParam(); - param.setPersonId(personId); - param.setIncludeOrganizations(orgIds); - param.setIncludeLabels(labelIds); - param.setBusinessId(context.getCompany().getCompanyId()); - passRuleParamList.add(param); - }); - t3 = System.currentTimeMillis(); - BatchPassRuleParam batchParam = new BatchPassRuleParam(); - batchParam.setPersonList((List)passRuleParamList); - CloudwalkResult> result = this.elevatorAppFeignClient.batchPassRule(batchParam); - t4 = System.currentTimeMillis(); - this.logger.info("20113 getDeviceUpdatePersonInfo batchPassRule,spend time {} millis", (Object)(t4 - t3)); - if (result.isSuccess() && CollectionUtils.isNotEmpty((Collection)((Collection)result.getData()))) { - ((List)result.getData()).forEach(passRule -> { - List zoneNameList = ((List)Optional.ofNullable(passRule.getZoneList()).orElse(new ArrayList())).stream().map(x -> x.getZoneName()).collect(Collectors.toList()); - Collections.sort(zoneNameList, new NaturalOrderComparator(true)); - String zoneNameStr = String.join((CharSequence)",", zoneNameList); - personPassRuleMap.put(passRule.getPersonId(), zoneNameStr); - }); - } - } - return personPassRuleMap; - } - - public CloudwalkResult> getDeviceUpdatePersonInfo(DeviceImageUpdatePersonQuery query, CloudwalkCallContext context) throws ServiceException { - ArrayList deviceImageUpdatePersonResults = new ArrayList(); - QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO(); - queryGroupPersonDTO.setDeviceId(query.getDeviceId()); - queryGroupPersonDTO.setImageStoreId(query.getImageStoreId()); - queryGroupPersonDTO.setLastUpdateTime(query.getLastUpdateTime()); - queryGroupPersonDTO.setSequenceId(String.valueOf(query.getSequenceId())); - queryGroupPersonDTO.setPageSize(Integer.valueOf(query.getRowsOfPage())); - CloudwalkPageInfo page = new CloudwalkPageInfo(query.getCurrentPage(), query.getRowsOfPage()); - long t1 = System.currentTimeMillis(); - List personRefsResult = this.groupPersonRefMapper.queryGroupPersonList(queryGroupPersonDTO); - long t2 = System.currentTimeMillis(); - this.logger.info("20113 getDeviceUpdatePersonInfo queryGroupPerson,spend time {} millis", (Object)(t2 - t1)); - boolean isElevatorGroup = this.elevatorGroup(query.getImageStoreId(), context); - Map personPassRuleMap = new HashMap(); - if (isElevatorGroup) { - personPassRuleMap = this.personPassRule(personRefsResult, context); - } - HashMap finalPersonPassRuleMap = personPassRuleMap; - for (GroupPersonRefDTO groupPersonRef : personRefsResult) { - if (StringUtils.isBlank((CharSequence)groupPersonRef.getPersonId())) continue; - DeviceImageUpdatePersonResult deviceImageUpdatePersonResult = new DeviceImageUpdatePersonResult(); - deviceImageUpdatePersonResult.setPersonId(groupPersonRef.getPersonId()); - if (query.getSupportPersonValiddate() != null && DeviceAbilityEnum.SUPPORT_PERSON_VALIDDATE.getCode() == query.getSupportPersonValiddate().intValue()) { - if (-1 == groupPersonRef.getStatus()) { - deviceImageUpdatePersonResult.setType(Integer.valueOf(DelStatusEnum.DELETED.getCode().shortValue())); - } else { - deviceImageUpdatePersonResult.setType(Integer.valueOf(DelStatusEnum.NORAML.getCode().shortValue())); - } - } else { - deviceImageUpdatePersonResult.setType(Integer.valueOf(groupPersonRef.getIsDel().intValue())); - } - if (groupPersonRef.getIsDel() != null && DelStatusEnum.NORAML.getCode().shortValue() == groupPersonRef.getIsDel().shortValue()) { - deviceImageUpdatePersonResult.setStatus(Integer.valueOf(1)); - } else { - deviceImageUpdatePersonResult.setStatus(Integer.valueOf(0)); - } - deviceImageUpdatePersonResult.setImageStoreId(groupPersonRef.getImageStoreId()); - deviceImageUpdatePersonResult.setTimestamp(groupPersonRef.getLastUpdateTime()); - deviceImageUpdatePersonResult.setSequenceId(Long.valueOf(groupPersonRef.getPersonId())); - deviceImageUpdatePersonResult.setExpiryBeginDate(groupPersonRef.getExpiryBeginDate()); - deviceImageUpdatePersonResult.setExpiryEndDate(groupPersonRef.getExpiryEndDate()); - ImgStorePerson imgStorePerson = this.imgStorePersonMapper.selectByPrimaryKey(groupPersonRef.getPersonId()); - if (imgStorePerson != null) { - deviceImageUpdatePersonResult.setImageStoreId(groupPersonRef.getImageStoreId()); - JSONObject json = new JSONObject(); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getReserveInfo())) { - json = JSONObject.parseObject((String)imgStorePerson.getReserveInfo()); - if (null != json.get((Object)"icCardNo") && StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardNo())) { - json.put("icCardNo", (Object)imgStorePerson.getIcCardNo()); - } - if (null != json.get((Object)"icCardType") && StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardType())) { - json.put("icCardType", (Object)imgStorePerson.getIcCardType()); - } - } else { - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardNo())) { - json.put("icCardNo", (Object)imgStorePerson.getIcCardNo()); - } - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getIcCardType())) { - json.put("icCardType", (Object)imgStorePerson.getIcCardType()); - } - } - json.put("passCrons", (Object)groupPersonRef.getValidDateCron()); - if (isElevatorGroup) { - json.put("floors", (Object)this.getFloorInfo(groupPersonRef, finalPersonPassRuleMap)); - } - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getDefaultFloor())) { - QueryZoneForm queryZoneForm = new QueryZoneForm(); - queryZoneForm.setIds(Collections.singletonList(imgStorePerson.getDefaultFloor())); - this.logger.info("楼层信息查询入参为{}", (Object)JSON.toJSONString((Object)queryZoneForm)); - CloudwalkResult> zoneDetail = this.zoneFeignClient.findZonelist(queryZoneForm); - this.logger.info("楼层信息{}", (Object)JSON.toJSONString(zoneDetail)); - if (!CollectionUtils.isEmpty((Collection)((Collection)zoneDetail.getData()))) { - json.put("defaultFloor", (Object)((ZoneResult)((List)zoneDetail.getData()).get(0)).getName()); - } - } - deviceImageUpdatePersonResult.setReserveInfo(JSON.toJSONString((Object)json)); - deviceImageUpdatePersonResult.setName(imgStorePerson.getName()); - deviceImageUpdatePersonResult.setMobileNumber(imgStorePerson.getPhone()); - if (imgStorePerson.getCreateTime() != null) { - deviceImageUpdatePersonResult.setCreateDate(imgStorePerson.getCreateTime().toString()); - } - ArrayList faceDatas = new ArrayList(); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getComparePicture())) { - DeviceImageUpdatePersonResult.FaceData personFaceData = new DeviceImageUpdatePersonResult.FaceData(); - personFaceData.setFaceId(imgStorePerson.getImageId()); - personFaceData.setPictureUrl(this.fileUrlPrefix + imgStorePerson.getComparePicture()); - faceDatas.add(personFaceData); - } - deviceImageUpdatePersonResult.setFaceData(faceDatas); - if (StringUtils.isNotBlank((CharSequence)imgStorePerson.getShowPicture())) { - DeviceImageUpdatePersonResult.ImageData imageData = new DeviceImageUpdatePersonResult.ImageData(); - try { - imageData.setImageUrl(this.fileUrlPrefix + imgStorePerson.getShowPicture()); - if (this.base64Enable.booleanValue() && deviceImageUpdatePersonResult.getStatus() == 1) { - imageData.setImageType(Integer.valueOf(0)); - imageData.setImage(FileUtil.url2base64(imageData.getImageUrl())); - } - deviceImageUpdatePersonResult.setShowImage(imageData); - } - catch (Exception e) { - this.logger.warn("{} imageData url2BASE64 error {}", (Object)imageData.getImageUrl(), (Object)e.getMessage()); - } - } - } else { - deviceImageUpdatePersonResult.setStatus(Integer.valueOf(0)); - } - deviceImageUpdatePersonResults.add(deviceImageUpdatePersonResult); - } - CloudwalkPageAble resultCloudwalkPageAble = new CloudwalkPageAble(deviceImageUpdatePersonResults, page, 0L); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private String getFloorInfo(GroupPersonRefDTO groupPersonRef, Map personPassRuleMap) { - if (personPassRuleMap.containsKey(groupPersonRef.getPersonId())) { - return personPassRuleMap.get(groupPersonRef.getPersonId()); - } - return ""; - } - - public CloudwalkResult> getDeviceImageUpdateFeatureInfo(DeviceImageUpdateFeatureQuery query, CloudwalkCallContext context) throws ServiceException { - ArrayList deviceImageUpdateFeautreResults = new ArrayList(); - QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO(); - queryGroupPersonDTO.setImageStoreId(query.getImageStoreId()); - queryGroupPersonDTO.setLastUpdateTime(query.getLastUpdateTime()); - queryGroupPersonDTO.setSequenceId(String.valueOf(query.getSequenceId())); - CloudwalkPageInfo page = new CloudwalkPageInfo(query.getCurrentPage(), query.getRowsOfPage()); - PageMethod.startPage((int)query.getCurrentPage(), (int)query.getRowsOfPage()); - PageMethod.orderBy((String)"LAST_UPDATE_TIME ASC,PERSON_ID ASC"); - Page groupPersonRefs = (Page)this.groupPersonRefMapper.query(queryGroupPersonDTO); - List personRefsResult = groupPersonRefs.getResult(); - for (GroupPersonRef refVar : personRefsResult) { - ImgStorePerson imgStorePerson = this.imgStorePersonMapper.selectByPrimaryKey(refVar.getPersonId()); - DeviceImageUpdateFeautreResult deviceImageUpdateFeautreResult = new DeviceImageUpdateFeautreResult(); - if (imgStorePerson == null) continue; - if (refVar.getIsDel() != null && DelStatusEnum.NORAML.getCode().shortValue() == refVar.getIsDel().shortValue()) { - AgImageFeatureQueryParam queryParam = new AgImageFeatureQueryParam(); - queryParam.setImageId(imgStorePerson.getImageId()); - queryParam.setGroupId(refVar.getImageStoreId()); - CloudwalkResult queryResult = this.agImageFeatureService.query(queryParam); - if (!queryResult.isSuccess() || queryResult.getData() == null) continue; - AgImageFeatureResult agImageFeatureResult = (AgImageFeatureResult)queryResult.getData(); - deviceImageUpdateFeautreResult.setFaceId(agImageFeatureResult.getImageId()); - deviceImageUpdateFeautreResult.setType(Integer.valueOf(refVar.getIsDel().intValue())); - deviceImageUpdateFeautreResult.setFeature(agImageFeatureResult.getFeature()); - deviceImageUpdateFeautreResult.setSequenceId(Long.valueOf(refVar.getPersonId())); - deviceImageUpdateFeautreResult.setTimestamp(refVar.getLastUpdateTime()); - deviceImageUpdateFeautreResults.add(deviceImageUpdateFeautreResult); - continue; - } - deviceImageUpdateFeautreResult.setFaceId(imgStorePerson.getImageId()); - deviceImageUpdateFeautreResult.setType(Integer.valueOf(DelStatusEnum.DELETED.getCode().intValue())); - deviceImageUpdateFeautreResult.setSequenceId(Long.valueOf(refVar.getPersonId())); - deviceImageUpdateFeautreResult.setTimestamp(refVar.getLastUpdateTime()); - deviceImageUpdateFeautreResults.add(deviceImageUpdateFeautreResult); - } - CloudwalkPageAble resultCloudwalkPageAble = new CloudwalkPageAble(deviceImageUpdateFeautreResults, page, groupPersonRefs.getTotal()); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Async(value="saveSyncLogExecutor") - public void saveSyncLog(String deviceId, String groupId, List personData) { - if (CollectionUtils.isEmpty(personData)) { - this.logger.warn("设备[{}]图库[{}]人员更新数据为空", (Object)deviceId, (Object)groupId); - return; - } - DevicePersonSyncLogDTO dto = new DevicePersonSyncLogDTO(); - dto.setDeviceId(deviceId); - dto.setImageStoreId(groupId); - List syncLogs = null; - for (UpdatePersonResult.PersonData personInfo : personData) { - String personId = personInfo.getUserId(); - dto.setPersonId(personId); - syncLogs = this.devicePersonSyncLogMapper.query(dto); - this.logger.debug("根据设备[{}]图库[{}]人员[{}]查询同步记录:[{}]", new Object[]{deviceId, groupId, personId, JSON.toJSONString((Object)syncLogs)}); - if (!CollectionUtils.isEmpty((Collection)syncLogs)) { - this.updateSyncLog((DevicePersonSyncLog)syncLogs.get(0), personInfo); - continue; - } - QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO(); - queryGroupPersonDTO.setImageStoreId(groupId); - queryGroupPersonDTO.setPersonId(personId); - List groupPersonRefList = this.groupPersonRefMapper.query(queryGroupPersonDTO); - if (CollectionUtils.isEmpty((Collection)groupPersonRefList)) { - this.logger.debug("根据图库Id[{}],人员Id[{}]查询不存在图库人员关联记录", (Object)groupId, (Object)personInfo.getUserId()); - continue; - } - if (this.lockSyncLog(deviceId, groupId, personId)) { - this.insertSyncLog(deviceId, groupId, personId, personInfo, (GroupPersonRef)groupPersonRefList.get(0)); - this.unlockSyncLog(deviceId, groupId, personId); - continue; - } - try { - Thread.sleep(1000L); - syncLogs = this.devicePersonSyncLogMapper.query(dto); - if (CollectionUtils.isEmpty((Collection)syncLogs)) continue; - this.updateSyncLog((DevicePersonSyncLog)syncLogs.get(0), personInfo); - } - catch (InterruptedException e) { - this.logger.error("CpOrgDevieKitServiceImpl lock sync log sleep error:{}", (Object)e.getMessage()); - Thread.currentThread().interrupt(); - } - } - } - - private void updateSyncLog(DevicePersonSyncLog dbSyncLog, UpdatePersonResult.PersonData personInfo) { - dbSyncLog.setStatus(Integer.valueOf(SyncStatusEnum.PULL.getValue())); - dbSyncLog.setCode(""); - dbSyncLog.setErrorMessage(""); - dbSyncLog.setLastPullTime(Long.valueOf(System.currentTimeMillis())); - dbSyncLog.setUpdateInfo("存在同步记录,更新同步状态:设备已拉取"); - dbSyncLog.setIsDel(personInfo.getType()); - if (!CollectionUtils.isEmpty((Collection)personInfo.getFaceData())) { - dbSyncLog.setImageId(((UpdatePersonResult.PersonData.FaceData)personInfo.getFaceData().get(0)).getFaceId()); - } else { - dbSyncLog.setErrorMessage("无识别照,设备无需上报"); - } - this.devicePersonSyncLogMapper.updateStatusAndCountInc(dbSyncLog); - this.logger.debug("更新同步记录[{}],设备已拉取,count[{}]", (Object)dbSyncLog.getId(), (Object)(dbSyncLog.getCount() + 1)); - this.logger.debug("更新同步记录[{}],[{}]", (Object)dbSyncLog.getId(), (Object)dbSyncLog); - } - - private void insertSyncLog(String deviceId, String groupId, String personId, UpdatePersonResult.PersonData personInfo, GroupPersonRef groupPersonRef) { - DevicePerson queryDevicePerson = new DevicePerson(); - queryDevicePerson.setDeviceId(deviceId); - queryDevicePerson.setPersonId(personId); - List dbDevicePersonList = this.devicePersonMapper.query(queryDevicePerson); - DevicePerson dbDevicePerson = null; - if (CollectionUtils.isEmpty((Collection)dbDevicePersonList)) { - DevicePerson newDevicePerson = new DevicePerson(); - newDevicePerson.setId(this.uuidSerial.uuid()); - newDevicePerson.setDeviceId(deviceId); - newDevicePerson.setPersonId(personId); - newDevicePerson.setType(personInfo.getType()); - newDevicePerson.setCreateTime(Long.valueOf(System.currentTimeMillis())); - newDevicePerson.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - int res = this.devicePersonMapper.insertSelective(newDevicePerson); - if (res > 0) { - dbDevicePerson = newDevicePerson; - } - } else { - dbDevicePerson = (DevicePerson)dbDevicePersonList.get(0); - } - DevicePersonSyncLog newSyncLog = new DevicePersonSyncLog(); - newSyncLog.setId(this.uuidSerial.uuid()); - newSyncLog.setDeviceId(deviceId); - newSyncLog.setImageStoreId(groupId); - newSyncLog.setPersonId(personId); - newSyncLog.setGroupPersonRefId(groupPersonRef.getId()); - newSyncLog.setStatus(Integer.valueOf(SyncStatusEnum.PULL.getValue())); - newSyncLog.setCount(Integer.valueOf(1)); - newSyncLog.setCreateTime(Long.valueOf(System.currentTimeMillis())); - newSyncLog.setLastUpdateTime(groupPersonRef.getLastUpdateTime()); - newSyncLog.setLastPullTime(Long.valueOf(System.currentTimeMillis())); - if (!CollectionUtils.isEmpty((Collection)personInfo.getFaceData())) { - newSyncLog.setImageId(((UpdatePersonResult.PersonData.FaceData)personInfo.getFaceData().get(0)).getFaceId()); - } - newSyncLog.setUpdateInfo("生成同步记录,同步状态:设备已拉取"); - newSyncLog.setDevicePersonRefId(null != dbDevicePerson ? dbDevicePerson.getId() : null); - newSyncLog.setIsDel(personInfo.getType()); - if (CollectionUtils.isEmpty((Collection)personInfo.getFaceData())) { - newSyncLog.setErrorMessage("无识别照,设备无需上报"); - } - this.logger.debug("新增同步记录[{}],[{}]", (Object)newSyncLog.getId(), (Object)newSyncLog); - try { - this.devicePersonSyncLogMapper.insertSelective(newSyncLog); - } - catch (Exception e) { - this.logger.error("新增同步记录失败,报错:{}", (Object)e.getMessage()); - } - this.logger.debug("新增同步记录[{}],设备已拉取,count[1]", (Object)newSyncLog.getId()); - } - - private synchronized boolean lockSyncLog(String deviceId, String imageStoreId, String personId) { - String value = deviceId + "_" + imageStoreId + "_" + personId; - String key = SYNC_LOG_KEY + value; - if (this.redisTemplate.hasKey((Object)key).booleanValue()) { - return false; - } - this.redisTemplate.opsForValue().set((Object)key, (Object)value, this.syncLogExpireTime, TimeUnit.SECONDS); - return true; - } - - private synchronized boolean unlockSyncLog(String deviceId, String imageStoreId, String personId) { - String value = deviceId + "_" + imageStoreId + "_" + personId; - String key = SYNC_LOG_KEY + value; - if (this.redisTemplate.hasKey((Object)key).booleanValue()) { - this.redisTemplate.delete((Object)key); - return true; - } - return false; - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonManager.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonManager.java index c9789c43..fc8c21f7 100644 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonManager.java +++ b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonManager.java @@ -396,7 +396,7 @@ extends AbstractImagStoreService { GroupPersonRef groupPersonRef = null; AgImageStoreImageResult lastResult = null; while (true) { - if (this.redisTemplate.hasKey((Object)LAST_SYNC_IMAGE_KEY).booleanValue()) { + if (this.redisTemplate.hasKey(LAST_SYNC_IMAGE_KEY).booleanValue()) { String lastFlagValue = (String)this.redisTemplate.opsForValue().get((Object)LAST_SYNC_IMAGE_KEY); lastSynTime = Long.valueOf(lastFlagValue.split(",")[0]); lastImageId = lastFlagValue.split(",")[1]; @@ -452,7 +452,7 @@ extends AbstractImagStoreService { lastResult.setLastUpdateTime(lastSynTime); this.logger.warn("最后更新时间为空,imageStoreId:[{}],imageId:[{}]", (Object)lastResult.getImageStoreId(), (Object)lastResult.getImageId()); } - this.redisTemplate.opsForValue().set((Object)LAST_SYNC_IMAGE_KEY, (Object)(lastResult.getLastUpdateTime() + "," + lastResult.getImageId())); + this.redisTemplate.opsForValue().set(LAST_SYNC_IMAGE_KEY, (Object)(lastResult.getLastUpdateTime() + "," + lastResult.getImageId())); this.logger.info("设置缓存数据,key={},value={}", (Object)LAST_SYNC_IMAGE_KEY, (Object)(lastResult.getLastUpdateTime() + "," + lastResult.getImageId())); } this.logger.warn("没有需要同步的图库图片"); diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStoreServiceImpl.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStoreServiceImpl.java deleted file mode 100644 index 79a91fad..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStoreServiceImpl.java +++ /dev/null @@ -1,771 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.account.account.param.GeneralQueryBusinessParam; -import cn.cloudwalk.client.account.account.result.AcBusinessDTO; -import cn.cloudwalk.client.account.account.service.AcBusinessService; -import cn.cloudwalk.client.aggregate.application.param.ApplicationImageStoreQueryParam; -import cn.cloudwalk.client.aggregate.application.service.ApplicationImageStoreService; -import cn.cloudwalk.client.aggregate.common.enums.DelStatusEnum; -import cn.cloudwalk.client.aggregate.common.enums.SyncStatusEnum; -import cn.cloudwalk.client.aggregate.device.param.DeviceImageStoreQueryParam; -import cn.cloudwalk.client.aggregate.device.result.DeviceImageStoreQueryResult; -import cn.cloudwalk.client.aggregate.device.service.AggDeviceImageStoreService; -import cn.cloudwalk.client.aggregate.group.param.AgImageStoreAddParam; -import cn.cloudwalk.client.aggregate.group.param.AgImageStoreEditParam; -import cn.cloudwalk.client.aggregate.group.param.AgImageStoreKeyParam; -import cn.cloudwalk.client.aggregate.group.param.AgImageStoreQueryParam; -import cn.cloudwalk.client.aggregate.group.result.AgImageStoreResult; -import cn.cloudwalk.client.aggregate.group.service.AgImageStoreService; -import cn.cloudwalk.client.device.mgn.atomic.param.CoreDeviceQueryParam; -import cn.cloudwalk.client.device.mgn.atomic.service.AtomicDeviceService; -import cn.cloudwalk.client.organization.common.enums.CpImageStoreMatchPatternEnum; -import cn.cloudwalk.client.organization.service.store.param.AddImageStoreParam; -import cn.cloudwalk.client.organization.service.store.param.AssociatedParam; -import cn.cloudwalk.client.organization.service.store.param.BaseImageStoreParam; -import cn.cloudwalk.client.organization.service.store.param.DelImageStoreParam; -import cn.cloudwalk.client.organization.service.store.param.DetailImageStoreParam; -import cn.cloudwalk.client.organization.service.store.param.EditImageStoreParam; -import cn.cloudwalk.client.organization.service.store.param.QueryImageStoreParam; -import cn.cloudwalk.client.organization.service.store.result.AssociatedResult; -import cn.cloudwalk.client.organization.service.store.result.DeviceInfoResult; -import cn.cloudwalk.client.organization.service.store.result.ImageStoreDetailResult; -import cn.cloudwalk.client.organization.service.store.result.ImageStoreResult; -import cn.cloudwalk.client.organization.service.store.result.ImgStorePersonResult; -import cn.cloudwalk.client.organization.service.store.result.LabelResult; -import cn.cloudwalk.client.organization.service.store.result.OrganizationResult; -import cn.cloudwalk.client.organization.service.store.result.PageImageStoreResult; -import cn.cloudwalk.client.organization.service.store.service.CpImageStoreService; -import cn.cloudwalk.client.resource.application.param.ApplicationBasicParam; -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.client.resource.common.en.CommonStatusEnum; -import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate; -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.cloud.utils.CloudwalkDateUtils; -import cn.cloudwalk.data.organization.dto.DelGroupPersonDTO; -import cn.cloudwalk.data.organization.dto.GetsImageStoreAssociatedDTO; -import cn.cloudwalk.data.organization.dto.ImageStoreCountDTO; -import cn.cloudwalk.data.organization.dto.ImgStorePersonQueryDto; -import cn.cloudwalk.data.organization.dto.OrganizationImageStoreQueryDTO; -import cn.cloudwalk.data.organization.dto.QueryGroupPersonDTO; -import cn.cloudwalk.data.organization.entity.IsImageStoreAssociated; -import cn.cloudwalk.data.organization.mapper.GroupPersonRefMapper; -import cn.cloudwalk.data.organization.mapper.ImgStoreLabelMapper; -import cn.cloudwalk.data.organization.mapper.ImgStoreOrganizationMapper; -import cn.cloudwalk.data.organization.mapper.ImgStorePersonMapper; -import cn.cloudwalk.data.organization.mapper.IsImageStoreAssociatedMapper; -import cn.cloudwalk.data.organization.mapper.OrganizationImageStoreMapper; -import cn.cloudwalk.service.organization.common.AbstractImagStoreService; -import cn.cloudwalk.service.organization.common.JsonUtils; -import cn.cloudwalk.service.organization.service.CpImageStorePersonManager; -import cn.cloudwalk.service.organization.service.CpImageStorePersonSynManager; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import javax.annotation.Resource; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import org.springside.modules.utils.Collections3; - -@Service -public class CpImageStoreServiceImpl -extends AbstractImagStoreService -implements CpImageStoreService { - @Autowired - private IsImageStoreAssociatedMapper isImageStoreAssociatedMapper; - @Autowired - private ImgStoreLabelMapper imgStoreLabelMapper; - @Autowired - private ImgStoreOrganizationMapper imgStoreOrganizationMapper; - @Autowired - private ImgStorePersonMapper personMapper; - @Autowired - private GroupPersonRefMapper groupPersonRefMapper; - @Autowired - private OrganizationImageStoreMapper organizationImageStoreMapper; - @Autowired - private AcBusinessService acBusinessService; - @Autowired - private ApplicationService applicationService; - @Autowired - private AgImageStoreService agImageStoreService; - @Autowired - private ApplicationImageStoreService applicationImageStoreService; - @Autowired - private AggDeviceImageStoreService deviceImageStoreService; - @Autowired - private CpImageStorePersonSynManager cpImageStorePersonSynManager; - @Resource - private CpImageStorePersonManager cpImageStorePersonManager; - @Resource - private AtomicDeviceService atomicDeviceService; - @Resource - private ApplicationImageStoreService appImageStoreService; - @Value(value="${cloudwalk.imagestore.person.searchSize:2}") - private int searchSize; - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult add(AddImageStoreParam param, CloudwalkCallContext context) throws ServiceException { - CloudwalkResult addResult; - List imageStoreAssociatedList; - String imageStoreId = CloudwalkDateUtils.getUUID(); - AgImageStoreAddParam addParam = new AgImageStoreAddParam(); - addParam.setId(imageStoreId); - addParam.setName(param.getName()); - addParam.setType(param.getType()); - addParam.setBusinessId(param.getBusinessId()); - addParam.setSourceApplicationId(param.getSourceApplicationId()); - if (StringUtils.isBlank((CharSequence)param.getBusinessId())) { - addParam.setBusinessId(context.getCompany().getCompanyId()); - } - if ((imageStoreAssociatedList = this.addBaseImageStore((BaseImageStoreParam)param, context, imageStoreId, addParam.getBusinessId())).size() > 0) { - this.isImageStoreAssociatedMapper.batchInsert(imageStoreAssociatedList); - } - if (!(addResult = this.agImageStoreService.add(addParam, context)).isSuccess()) { - throw new ServiceException(addResult.getCode(), addResult.getMessage()); - } - this.cpImageStorePersonSynManager.addGroupPersonSynTask(Lists.newArrayList((Object[])new String[]{imageStoreId}), "isAll"); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult edit(EditImageStoreParam param, CloudwalkCallContext context) throws ServiceException { - CloudwalkResult editResult; - this.checkExistAndStatus(param.getImageStoreId()); - AgImageStoreEditParam editParam = new AgImageStoreEditParam(); - editParam.setId(param.getImageStoreId()); - editParam.setName(param.getName()); - String businessId = param.getBusinessId(); - if (StringUtils.isBlank((CharSequence)businessId)) { - businessId = context.getCompany().getCompanyId(); - } - List imageStoreAssociatedList = this.addBaseImageStore((BaseImageStoreParam)param, context, param.getImageStoreId(), businessId); - if (this.checkAssociatedIsChange(param.getImageStoreId(), imageStoreAssociatedList)) { - this.isImageStoreAssociatedMapper.deleteAllByImageId(param.getImageStoreId()); - if (imageStoreAssociatedList.size() > 0) { - this.isImageStoreAssociatedMapper.batchInsert(imageStoreAssociatedList); - } - editParam.setStatus(SyncStatusEnum.SYNC_WAIT.getCode()); - } - if (!(editResult = this.agImageStoreService.edit(editParam, context)).isSuccess()) { - throw new ServiceException(editResult.getCode(), editResult.getMessage()); - } - this.cpImageStorePersonSynManager.addGroupPersonSynTask(Lists.newArrayList((Object[])new String[]{param.getImageStoreId()}), "isAll"); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private boolean checkAssociatedIsChange(String imageStoreId, List associatedListAfterUpdate) { - GetsImageStoreAssociatedDTO queryDTO = new GetsImageStoreAssociatedDTO(); - queryDTO.setImageStoreId(imageStoreId); - List associatedListBeforeUpdate = this.isImageStoreAssociatedMapper.gets(queryDTO); - if (CollectionUtils.isEmpty((Collection)associatedListBeforeUpdate) && CollectionUtils.isEmpty(associatedListAfterUpdate)) { - return false; - } - if (associatedListBeforeUpdate.size() != associatedListAfterUpdate.size()) { - return true; - } - HashSet associatedStrBeforeUpdate = new HashSet(associatedListBeforeUpdate.size()); - for (IsImageStoreAssociated associateBefore : associatedListBeforeUpdate) { - String action = associateBefore.getAssociatedAction() != null ? String.valueOf(associateBefore.getAssociatedAction()) : ""; - associatedStrBeforeUpdate.add(action + associateBefore.getAssociatedObjectIdType() + associateBefore.getAssociatedObjectId() + associateBefore.getExpiryBeginDate() + associateBefore.getExpiryEndDate() + associateBefore.getValidDateCron()); - } - HashSet associatedStrAfterUpdate = new HashSet(associatedListAfterUpdate.size()); - for (IsImageStoreAssociated associateBeforeAfter : associatedListAfterUpdate) { - String action = associateBeforeAfter.getAssociatedAction() != null ? String.valueOf(associateBeforeAfter.getAssociatedAction()) : ""; - associatedStrAfterUpdate.add(action + associateBeforeAfter.getAssociatedObjectIdType() + associateBeforeAfter.getAssociatedObjectId() + associateBeforeAfter.getExpiryBeginDate() + associateBeforeAfter.getExpiryEndDate() + associateBeforeAfter.getValidDateCron()); - } - associatedStrBeforeUpdate.removeAll(associatedStrAfterUpdate); - return !CollectionUtils.isEmpty(associatedStrBeforeUpdate); - } - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult delete(DelImageStoreParam param, CloudwalkCallContext context) throws ServiceException { - this.checkAppRefByImageStoreIdForDelete(param.getId(), context); - this.checkExistAndStatus(param.getId()); - QueryGroupPersonDTO queryDTO = new QueryGroupPersonDTO(); - queryDTO.setImageStoreId(param.getId()); - queryDTO.setIsDel(Short.valueOf(DelStatusEnum.NORAML.getCode())); - List groupPersonList = this.groupPersonRefMapper.query(queryDTO); - this.isImageStoreAssociatedMapper.deleteAllByImageId(param.getId()); - DelGroupPersonDTO delGroupPersonDTO = new DelGroupPersonDTO(); - delGroupPersonDTO.setImageStoreId(param.getId()); - delGroupPersonDTO.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - delGroupPersonDTO.setLastUpdateUserId(context.getUser().getCaller()); - this.groupPersonRefMapper.logicDeleteByParam(delGroupPersonDTO); - CloudwalkResult delete = this.agImageStoreService.delete((AgImageStoreKeyParam)BeanCopyUtils.copyProperties((Object)param, AgImageStoreKeyParam.class), context); - if (!delete.isSuccess()) { - throw new ServiceException(delete.getCode(), delete.getMessage()); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private void checkAppRefByImageStoreIdForDelete(String imageStoreId, CloudwalkCallContext context) throws ServiceException { - ApplicationImageStoreQueryParam queryParam = new ApplicationImageStoreQueryParam(); - queryParam.setImageStoreId(imageStoreId); - CloudwalkResult queryResult = this.applicationImageStoreService.query(queryParam, context); - if (!queryResult.isSuccess()) { - throw new ServiceException(queryResult.getCode(), queryResult.getMessage()); - } - if (!CollectionUtils.isEmpty((Collection)((Collection)queryResult.getData()))) { - throw new ServiceException("53013545", this.getMessage("53013545")); - } - } - - public CloudwalkResult> page(QueryImageStoreParam queryImageStoreParam, CloudwalkCallContext context) throws ServiceException { - CloudwalkResult agPageResult; - boolean isEnd = this.handleQueryParam(queryImageStoreParam); - if (isEnd) { - return (CloudwalkResult) CloudwalkResult.success($$$); - } - AgImageStoreQueryParam queryParam = (AgImageStoreQueryParam)BeanCopyUtils.copyProperties((Object)queryImageStoreParam, AgImageStoreQueryParam.class); - if (StringUtils.isBlank((CharSequence)queryParam.getBusinessId())) { - queryParam.setBusinessId(context.getCompany().getCompanyId()); - } - if (!(agPageResult = this.agImageStoreService.page(queryParam)).isSuccess()) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - if (agPageResult.getData() == null) { - return (CloudwalkResult) CloudwalkResult.success($$$); - } - List resultList = this.packageCpResult(((CloudwalkPageAble)agPageResult.getData()).getDatas(), queryParam.getBusinessId()); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult> list(QueryImageStoreParam queryImageStoreParam, CloudwalkCallContext cloudwalkContext) throws ServiceException { - CloudwalkResult agQueryResult; - List resultList = new ArrayList(); - boolean isEnd = this.handleQueryParam(queryImageStoreParam); - if (isEnd) { - return (CloudwalkResult) CloudwalkResult.success($$$); - } - AgImageStoreQueryParam queryParam = (AgImageStoreQueryParam)BeanCopyUtils.copyProperties((Object)queryImageStoreParam, AgImageStoreQueryParam.class); - if (StringUtils.isBlank((CharSequence)queryParam.getBusinessId())) { - queryParam.setBusinessId(cloudwalkContext.getCompany().getCompanyId()); - } - if (!(agQueryResult = this.agImageStoreService.query(queryParam)).isSuccess()) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - if (!CollectionUtils.isEmpty((Collection)queryImageStoreParam.getLabelIds())) { - GetsImageStoreAssociatedDTO get = new GetsImageStoreAssociatedDTO(); - get.setAssociatedObjectIds((Collection)queryImageStoreParam.getLabelIds()); - get.setAssociatedObjectIdType(Integer.valueOf(2)); - List associateds = this.isImageStoreAssociatedMapper.gets(get); - if (CollectionUtils.isEmpty((Collection)associateds)) { - return (CloudwalkResult) CloudwalkResult.success($$$); - } - List imageStoreIds = Collections3.extractToList((Collection)associateds, (String)"imageStoreId"); - List collect = ((List)agQueryResult.getData()).stream().filter(a -> imageStoreIds.contains(a.getId())).collect(Collectors.toList()); - agQueryResult.setData(collect); - } - resultList = this.packageImageStoreResult((Collection)agQueryResult.getData(), queryParam.getBusinessId()); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @CloudwalkParamsValidate - public CloudwalkResult detail(DetailImageStoreParam param, CloudwalkCallContext context) { - AgImageStoreQueryParam queryParam = new AgImageStoreQueryParam(); - queryParam.setId(param.getId()); - CloudwalkResult queryResult = this.agImageStoreService.query(queryParam); - if (!queryResult.isSuccess()) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - if (CollectionUtils.isEmpty((Collection)((Collection)queryResult.getData()))) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - AgImageStoreResult agImageStoreResult = (AgImageStoreResult)((List)queryResult.getData()).get(0); - ImageStoreDetailResult result = (ImageStoreDetailResult)BeanCopyUtils.copyProperties((Object)agImageStoreResult, ImageStoreDetailResult.class); - result.setPersonNum(this.getPersonNum(agImageStoreResult.getId())); - try { - result.setBusinessName(this.getBusinessName(result.getBusinessId())); - } - catch (ServiceException e) { - this.logger.error("查询企业名称错误e:{}", (Object)e.getMessage()); - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - try { - result.setSourceApplicationName(this.getSourceApplicationName(result.getSourceApplicationId())); - } - catch (ServiceException e) { - this.logger.error("查询来源应用名称错误e:{}", (Object)e.getMessage()); - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - this.getAssociated(result); - DeviceImageStoreQueryParam deviceParam = new DeviceImageStoreQueryParam(); - deviceParam.setImageStoreId(param.getId()); - CloudwalkResult deviceResult = this.deviceImageStoreService.query(deviceParam, context); - if (deviceResult.isSuccess()) { - result.setDevices(this.getDeviceList((List)deviceResult.getData(), context)); - } else { - this.logger.error("图库详情关联设备名称获取失败,result:[{}]", (Object)JSONObject.toJSONString((Object)deviceResult)); - } - ApplicationImageStoreQueryParam appParam = new ApplicationImageStoreQueryParam(); - appParam.setImageStoreId(param.getId()); - CloudwalkResult appResult = this.applicationImageStoreService.query(appParam, context); - if (appResult.isSuccess()) { - result.setApplicationNames(Collections3.extractToList((Collection)((Collection)appResult.getData()), (String)"applicationName")); - } else { - this.logger.error("图库详情关联应用名称获取失败,result:[{}]", (Object)JSONObject.toJSONString((Object)appResult)); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private List getDeviceList(List resultList, CloudwalkCallContext context) { - ArrayList list = Lists.newArrayListWithCapacity((int)resultList.size()); - try { - List deviceIds = resultList.stream().map(DeviceImageStoreQueryResult::getDeviceId).collect(Collectors.toList()); - CoreDeviceQueryParam param = new CoreDeviceQueryParam(); - param.setIds(deviceIds); - param.setBusinessId(context.getCompany().getCompanyId()); - CloudwalkResult deviceResult = this.atomicDeviceService.list(param, context); - Map deviceMap = new HashMap(); - if (deviceResult.isSuccess()) { - deviceMap = ((List)deviceResult.getData()).stream().collect(Collectors.toMap(device -> device.getId(), device -> device.getDeviceCode())); - } - for (DeviceImageStoreQueryResult result : resultList) { - DeviceInfoResult dr = new DeviceInfoResult(); - dr.setDeviceId(result.getDeviceId()); - dr.setDeviceCode((String)deviceMap.get(result.getDeviceId())); - dr.setDeviceName(result.getDeviceName()); - dr.setIdentifyType(result.getIdentifyType()); - list.add(dr); - } - } - catch (Exception e) { - this.logger.error("exception:{}", (Object)e.getMessage()); - } - return list; - } - - private IsImageStoreAssociated getAssociated(String objectId, long time, String userId, String imageStoreId, Integer action, Integer objectType) { - IsImageStoreAssociated associated = new IsImageStoreAssociated(); - associated.setId(this.getPrimaryId()); - associated.setAssociatedAction(action); - associated.setAssociatedObjectId(objectId); - associated.setAssociatedObjectIdType(objectType); - associated.setCreateTime(Long.valueOf(time)); - associated.setCreateUserId(userId); - associated.setImageStoreId(imageStoreId); - associated.setLastUpdateTime(Long.valueOf(time)); - associated.setLastUpdateUserId(userId); - return associated; - } - - private IsImageStoreAssociated getAssociated(AssociatedParam associatedParam, long time, String userId, String imageStoreId, Integer action, Integer objectType) { - IsImageStoreAssociated associated = this.getAssociated(associatedParam.getObjectId(), time, userId, imageStoreId, action, objectType); - associated.setExpiryBeginDate(associatedParam.getExpiryBeginDate()); - associated.setExpiryEndDate(associatedParam.getExpiryEndDate()); - associated.setValidDateCron(null); - if (!CollectionUtils.isEmpty((Collection)associatedParam.getValidDateCron())) { - associated.setValidDateCron(JSON.toJSONString((Object)associatedParam.getValidDateCron())); - } - return associated; - } - - private List addBaseImageStore(BaseImageStoreParam param, CloudwalkCallContext context, String imageStoreId, String businessId) throws ServiceException { - Object dto; - long time = System.currentTimeMillis(); - List includePersonIds = CollectionUtils.isEmpty((Collection)param.getIncludePersons()) ? new ArrayList() : param.getIncludePersons().stream().map(AssociatedParam::getObjectId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty((Collection)param.getIncludeOrganizations()) && CollectionUtils.isEmpty((Collection)param.getIncludeLabels()) && CollectionUtils.isEmpty(includePersonIds)) { - return new ArrayList(); - } - ArrayList imageStoreAssociatedList = new ArrayList(); - if (CpImageStoreMatchPatternEnum.getByCode((String)param.getMatchPattern()) != null) { - imageStoreAssociatedList.add(this.getAssociated(param.getMatchPattern(), time, context.getUser().getCaller(), imageStoreId, null, (Integer)4)); - } else { - imageStoreAssociatedList.add(this.getAssociated(CpImageStoreMatchPatternEnum.MERGE.getCode(), time, context.getUser().getCaller(), imageStoreId, null, (Integer)4)); - } - AssociatedParam imageStoreAssociatedParam = new AssociatedParam(); - imageStoreAssociatedParam.setObjectId(imageStoreId); - imageStoreAssociatedParam.setExpiryBeginDate(param.getExpiryBeginDate()); - imageStoreAssociatedParam.setExpiryEndDate(param.getExpiryEndDate()); - imageStoreAssociatedParam.setValidDateCron(param.getValidDateCron()); - imageStoreAssociatedList.add(this.getAssociated(imageStoreAssociatedParam, time, context.getUser().getCaller(), imageStoreId, (Integer)0, (Integer)5)); - if (!CollectionUtils.isEmpty((Collection)param.getIncludeOrganizations())) { - if (this.imgStoreOrganizationMapper.getOrgByIds(param.getIncludeOrganizations(), businessId).size() != param.getIncludeOrganizations().size()) { - throw new ServiceException("53013513", this.getMessage("53013513")); - } - for (Object objectId : param.getIncludeOrganizations()) { - imageStoreAssociatedList.add(this.getAssociated((String)objectId, time, context.getUser().getCaller(), imageStoreId, (Integer)0, (Integer)1)); - } - } - if (!CollectionUtils.isEmpty((Collection)param.getIncludeLabels())) { - if (this.imgStoreLabelMapper.getLabelByIds(param.getIncludeLabels(), businessId).size() != param.getIncludeLabels().size()) { - throw new ServiceException("53013514", this.getMessage("53013514")); - } - for (Object objectId : param.getIncludeLabels()) { - imageStoreAssociatedList.add(this.getAssociated((String)objectId, time, context.getUser().getCaller(), imageStoreId, (Integer)0, (Integer)2)); - } - } - if (!CollectionUtils.isEmpty(includePersonIds)) { - dto = new ImgStorePersonQueryDto(); - dto.setIds(includePersonIds); - dto.setBusinessId(businessId); - dto.setIsDel(DelStatusEnum.NORAML.getCode()); - if (this.personMapper.gets((ImgStorePersonQueryDto)dto).size() != includePersonIds.size()) { - throw new ServiceException("53013515", this.getMessage("53013515")); - } - for (AssociatedParam associatedParam : param.getIncludePersons()) { - if (!(param.getNullDateIsLongTerm().booleanValue() || null != associatedParam.getExpiryBeginDate() && null != associatedParam.getExpiryEndDate())) { - associatedParam.setExpiryBeginDate(imageStoreAssociatedParam.getExpiryBeginDate()); - associatedParam.setExpiryEndDate(imageStoreAssociatedParam.getExpiryEndDate()); - associatedParam.setValidDateCron(imageStoreAssociatedParam.getValidDateCron()); - } - imageStoreAssociatedList.add(this.getAssociated(associatedParam, time, context.getUser().getCaller(), imageStoreId, (Integer)0, (Integer)3)); - } - } - if (!CollectionUtils.isEmpty((Collection)param.getExcludeLabels())) { - if (this.imgStoreLabelMapper.getLabelByIds(param.getExcludeLabels(), businessId).size() != param.getExcludeLabels().size()) { - throw new ServiceException("53013516", this.getMessage("53013516")); - } - for (Object objectId : param.getExcludeLabels()) { - imageStoreAssociatedList.add(this.getAssociated((String)objectId, time, context.getUser().getCaller(), imageStoreId, (Integer)1, (Integer)2)); - } - } - if (!CollectionUtils.isEmpty((Collection)param.getExcludePersons())) { - dto = new ImgStorePersonQueryDto(); - dto.setIds((Collection)param.getExcludePersons()); - dto.setBusinessId(businessId); - dto.setIsDel(DelStatusEnum.NORAML.getCode()); - if (this.personMapper.gets((ImgStorePersonQueryDto)dto).size() != param.getExcludePersons().size()) { - throw new ServiceException("53013517", this.getMessage("53013517")); - } - for (String objectId : param.getExcludePersons()) { - imageStoreAssociatedList.add(this.getAssociated(objectId, time, context.getUser().getCaller(), imageStoreId, (Integer)1, (Integer)3)); - } - } - return imageStoreAssociatedList; - } - - private String getBusinessName(String businessId) throws ServiceException { - GeneralQueryBusinessParam generalQueryBusinessParam = new GeneralQueryBusinessParam(); - generalQueryBusinessParam.setId(businessId); - CloudwalkResult cloudwalkResult = this.acBusinessService.generalQuery(generalQueryBusinessParam); - if (cloudwalkResult == null) { - throw new ServiceException("53013535", this.getMessage("53013535")); - } - if (!cloudwalkResult.isSuccess()) { - throw new ServiceException(cloudwalkResult.getCode(), cloudwalkResult.getMessage()); - } - if (cloudwalkResult.getData() != null && ((List)cloudwalkResult.getData()).size() > 0) { - return ((AcBusinessDTO)((List)cloudwalkResult.getData()).get(0)).getName(); - } - return null; - } - - private String getSourceApplicationName(String sourceApplicationId) throws ServiceException { - if (StringUtils.isEmpty((CharSequence)sourceApplicationId)) { - return null; - } - ApplicationBasicParam applicationBasicParam = new ApplicationBasicParam(); - applicationBasicParam.setIds(Arrays.asList(sourceApplicationId)); - CloudwalkResult cloudwalkResult = this.applicationService.gets(applicationBasicParam); - if (cloudwalkResult == null) { - throw new ServiceException("53013547", this.getMessage("53013547")); - } - if (!cloudwalkResult.isSuccess()) { - throw new ServiceException(cloudwalkResult.getCode(), cloudwalkResult.getMessage()); - } - if (cloudwalkResult.getData() != null && ((List)cloudwalkResult.getData()).size() > 0) { - return ((ApplicationResult)((List)cloudwalkResult.getData()).get(0)).getName(); - } - return null; - } - - private void checkExistAndStatus(String iamgeStoreId) throws ServiceException { - AgImageStoreQueryParam queryParam = new AgImageStoreQueryParam(); - queryParam.setId(iamgeStoreId); - CloudwalkResult query = this.agImageStoreService.query(queryParam); - if (!query.isSuccess()) { - throw new ServiceException(query.getCode(), query.getMessage()); - } - if (CollectionUtils.isEmpty((Collection)((Collection)query.getData()))) { - throw new ServiceException("53013502", this.getMessage("53013502")); - } - if (SyncStatusEnum.SYNC_ING.getCode().equals(((AgImageStoreResult)((List)query.getData()).get(0)).getStatus())) { - throw new ServiceException("53013512", this.getMessage("53013512")); - } - } - - private Map getBusinessNameMap() throws ServiceException { - CloudwalkResult listCloudwalkResult = this.acBusinessService.generalQuery(new GeneralQueryBusinessParam()); - if (!listCloudwalkResult.isSuccess()) { - throw new ServiceException(listCloudwalkResult.getCode(), listCloudwalkResult.getMessage()); - } - if (CollectionUtils.isEmpty((Collection)((Collection)listCloudwalkResult.getData()))) { - return new HashMap(); - } - return Collections3.extractToMap((Collection)((Collection)listCloudwalkResult.getData()), (String)"id", (String)"name"); - } - - private Map getSourceApplicationNameMap(String businessId) throws ServiceException { - ApplicationQueryParam param = new ApplicationQueryParam(); - param.setBusinessId(businessId); - param.setStatus(CommonStatusEnum.ENABLE.getCode()); - CloudwalkResult listCloudwalkResult = this.applicationService.query(param); - if (!listCloudwalkResult.isSuccess()) { - throw new ServiceException(listCloudwalkResult.getCode(), listCloudwalkResult.getMessage()); - } - if (CollectionUtils.isEmpty((Collection)((Collection)listCloudwalkResult.getData()))) { - return new HashMap(); - } - return Collections3.extractToMap((Collection)((Collection)listCloudwalkResult.getData()), (String)"id", (String)"name"); - } - - private void getAssociated(ImageStoreDetailResult result) { - GetsImageStoreAssociatedDTO get = new GetsImageStoreAssociatedDTO(); - get.setImageStoreId(result.getId()); - List associateds = this.isImageStoreAssociatedMapper.gets(get); - String matchPattern = null; - ArrayList includeLabelIds = new ArrayList(); - ArrayList includeOrganizationIds = new ArrayList(); - ArrayList includePersonIds = new ArrayList(); - HashMap includePersonMap = new HashMap(); - ArrayList excludeLabelIds = new ArrayList(); - ArrayList excludePersonIds = new ArrayList(); - String businessId = result.getBusinessId(); - for (IsImageStoreAssociated associated : associateds) { - if (4 == associated.getAssociatedObjectIdType()) { - matchPattern = associated.getAssociatedObjectId(); - continue; - } - if (0 == associated.getAssociatedAction()) { - if (1 == associated.getAssociatedObjectIdType()) { - includeOrganizationIds.add(associated.getAssociatedObjectId()); - continue; - } - if (2 == associated.getAssociatedObjectIdType()) { - includeLabelIds.add(associated.getAssociatedObjectId()); - continue; - } - if (3 == associated.getAssociatedObjectIdType()) { - includePersonIds.add(associated.getAssociatedObjectId()); - AssociatedResult associatedResult = new AssociatedResult(); - BeanCopyUtils.copyProperties((Object)associated, (Object)associatedResult); - associatedResult.setObjectId(associated.getAssociatedObjectId()); - includePersonMap.put(associated.getAssociatedObjectId(), associatedResult); - continue; - } - if (5 != associated.getAssociatedObjectIdType()) continue; - result.setExpiryBeginDate(associated.getExpiryBeginDate()); - result.setExpiryEndDate(associated.getExpiryEndDate()); - result.setValidDateCron(JsonUtils.toStrList(associated.getValidDateCron())); - continue; - } - if (1 != associated.getAssociatedAction()) continue; - if (2 == associated.getAssociatedObjectIdType()) { - excludeLabelIds.add(associated.getAssociatedObjectId()); - continue; - } - if (3 != associated.getAssociatedObjectIdType()) continue; - excludePersonIds.add(associated.getAssociatedObjectId()); - } - result.setMatchPattern(matchPattern); - if (!CollectionUtils.isEmpty(includeLabelIds)) { - result.setIncludeLabels(BeanCopyUtils.copy((Collection)this.imgStoreLabelMapper.getLabelByIds(includeLabelIds, businessId), LabelResult.class)); - } else { - result.setIncludeLabels(new ArrayList()); - } - if (!CollectionUtils.isEmpty(includeOrganizationIds)) { - result.setIncludeOrganizations(BeanCopyUtils.copy((Collection)this.imgStoreOrganizationMapper.getOrgByIds(includeOrganizationIds, businessId), OrganizationResult.class)); - } else { - result.setIncludeOrganizations(new ArrayList()); - } - ImgStorePersonQueryDto getDTO = new ImgStorePersonQueryDto(); - if (!CollectionUtils.isEmpty(includePersonIds)) { - getDTO.setIds(includePersonIds); - getDTO.setIsDel(DelStatusEnum.NORAML.getCode()); - List personList = this.personMapper.gets(getDTO); - ArrayList includePersons = new ArrayList(); - personList.forEach(imgStorePerson -> { - ImgStorePersonResult imgStorePersonResult = new ImgStorePersonResult(); - BeanCopyUtils.copyProperties((Object)imgStorePerson, (Object)imgStorePersonResult); - AssociatedResult associatedResult = (AssociatedResult)includePersonMap.get(imgStorePerson.getId()); - BeanCopyUtils.copyProperties((Object)associatedResult, (Object)imgStorePersonResult); - imgStorePersonResult.setValidDateCron(JsonUtils.toStrList(associatedResult.getValidDateCron())); - includePersons.add(imgStorePersonResult); - }); - result.setIncludePersons(includePersons); - } else { - result.setIncludePersons(new ArrayList()); - } - if (!CollectionUtils.isEmpty(excludeLabelIds)) { - result.setExcludeLabels(BeanCopyUtils.copy((Collection)this.imgStoreLabelMapper.getLabelByIds(excludeLabelIds, businessId), LabelResult.class)); - } else { - result.setExcludeLabels(new ArrayList()); - } - if (!CollectionUtils.isEmpty(excludePersonIds)) { - getDTO.setIds(excludePersonIds); - getDTO.setIsDel(DelStatusEnum.NORAML.getCode()); - result.setExcludePersons(BeanCopyUtils.copy((Collection)this.personMapper.gets(getDTO), ImgStorePersonResult.class)); - } else { - result.setExcludePersons(new ArrayList()); - } - } - - private boolean handleQueryParam(QueryImageStoreParam queryParam) { - List imageStoreIds; - if (StringUtils.isNotBlank((CharSequence)queryParam.getOrgId()) || !CollectionUtils.isEmpty((Collection)queryParam.getOrgIds())) { - List orgImageStoreList = this.organizationImageStoreMapper.query((OrganizationImageStoreQueryDTO)BeanCopyUtils.copyProperties((Object)queryParam, OrganizationImageStoreQueryDTO.class)); - GetsImageStoreAssociatedDTO orgParam = new GetsImageStoreAssociatedDTO(); - orgParam.setAssociatedObjectIdType(Integer.valueOf(1)); - ArrayList orgIds = new ArrayList(500); - if (StringUtils.isNotBlank((CharSequence)queryParam.getOrgId())) { - orgIds.add(queryParam.getOrgId()); - } - if (!CollectionUtils.isEmpty((Collection)queryParam.getOrgIds())) { - orgIds.addAll(queryParam.getOrgIds()); - } - orgParam.setAssociatedObjectIds(orgIds); - List orgResultList = this.isImageStoreAssociatedMapper.gets(orgParam); - if (CollectionUtils.isEmpty((Collection)orgImageStoreList) && CollectionUtils.isEmpty((Collection)orgResultList)) { - return true; - } - List imageStoreIds2 = Collections3.extractToList((Collection)orgImageStoreList, (String)"imageStoreId"); - imageStoreIds2.addAll(Collections3.extractToList((Collection)orgResultList, (String)"imageStoreId")); - if (StringUtils.isNotBlank((CharSequence)queryParam.getId())) { - if (!imageStoreIds2.contains(queryParam.getId())) { - return true; - } - } else if (!CollectionUtils.isEmpty((Collection)queryParam.getIds())) { - imageStoreIds2.retainAll(queryParam.getIds()); - } - if (CollectionUtils.isEmpty((Collection)imageStoreIds2)) { - return true; - } - queryParam.setIds(imageStoreIds2); - } - if (!CollectionUtils.isEmpty((Collection)queryParam.getPersonIds())) { - QueryGroupPersonDTO queryGroupPersonDTO = (QueryGroupPersonDTO)BeanCopyUtils.copyProperties((Object)queryParam, QueryGroupPersonDTO.class); - queryGroupPersonDTO.setIsDel(DelStatusEnum.NORAML.getCode()); - List queryResult = this.groupPersonRefMapper.query(queryGroupPersonDTO); - if (CollectionUtils.isEmpty((Collection)queryResult)) { - return true; - } - imageStoreIds = Collections3.extractToList((Collection)queryResult, (String)"imageStoreId"); - if (StringUtils.isNotBlank((CharSequence)queryParam.getId())) { - if (!imageStoreIds.contains(queryParam.getId())) { - return true; - } - } else if (!CollectionUtils.isEmpty((Collection)queryParam.getIds())) { - imageStoreIds.retainAll(queryParam.getIds()); - } - if (CollectionUtils.isEmpty((Collection)imageStoreIds)) { - return true; - } - queryParam.setIds(imageStoreIds); - } - if (!CollectionUtils.isEmpty((Collection)queryParam.getLabelIds())) { - GetsImageStoreAssociatedDTO labelParam = new GetsImageStoreAssociatedDTO(); - labelParam.setAssociatedObjectIdType(Integer.valueOf(2)); - labelParam.setAssociatedObjectIds((Collection)queryParam.getLabelIds()); - List labelResultList = this.isImageStoreAssociatedMapper.gets(labelParam); - if (CollectionUtils.isEmpty((Collection)labelResultList)) { - return true; - } - imageStoreIds = Collections3.extractToList((Collection)labelResultList, (String)"imageStoreId"); - if (StringUtils.isNotBlank((CharSequence)queryParam.getId())) { - if (!imageStoreIds.contains(queryParam.getId())) { - return true; - } - } else if (!CollectionUtils.isEmpty((Collection)queryParam.getIds())) { - imageStoreIds.retainAll(queryParam.getIds()); - } - if (CollectionUtils.isEmpty((Collection)imageStoreIds)) { - return true; - } - queryParam.setIds(imageStoreIds); - } - return false; - } - - private List packageImageStoreResult(Collection agDatas, String businessId) throws ServiceException { - if (CollectionUtils.isEmpty(agDatas)) { - return new ArrayList(); - } - List imageIds = agDatas.stream().map(AgImageStoreResult::getId).collect(Collectors.toList()); - long startTime = System.currentTimeMillis(); - ArrayList countByImageStoreIds = Lists.newArrayListWithCapacity((int)imageIds.size()); - List partition = Lists.partition(imageIds, (int)this.searchSize); - partition.stream().forEach(p -> { - List list = this.groupPersonRefMapper.getCountByImageStoreIds(p); - if (!CollectionUtils.isEmpty((Collection)list)) { - countByImageStoreIds.addAll(list); - } - }); - long endTime = System.currentTimeMillis(); - this.logger.info("图库分页查询耗时:[{}],searchSize:[{}]", (Object)(endTime - startTime), (Object)this.searchSize); - Map countMap = countByImageStoreIds.stream().filter(imageStoreCountDTO -> null != imageStoreCountDTO).collect(Collectors.toMap(ImageStoreCountDTO::getId, ImageStoreCountDTO::getCount, (k1, k2) -> k1)); - Map businessNameMap = this.getBusinessNameMap(); - Map sourceApplicationNameMap = this.getSourceApplicationNameMap(businessId); - ArrayList resultList = new ArrayList(agDatas.size()); - for (AgImageStoreResult agData : agDatas) { - ImageStoreResult temp = (ImageStoreResult)BeanCopyUtils.copyProperties((Object)agData, ImageStoreResult.class); - temp.setBusinessName(businessNameMap.get(temp.getBusinessId())); - temp.setSourceApplicationName(sourceApplicationNameMap.get(temp.getSourceApplicationId())); - temp.setPersonNum(countMap.containsKey(agData.getId()) ? countMap.get(agData.getId()) : Integer.valueOf(0)); - this.getAssociated((ImageStoreDetailResult)temp); - resultList.add(temp); - } - return resultList; - } - - private List packageCpResult(Collection agDatas, String businessId) throws ServiceException { - if (CollectionUtils.isEmpty(agDatas)) { - return new ArrayList(); - } - List imageIds = agDatas.stream().map(AgImageStoreResult::getId).collect(Collectors.toList()); - long startTime = System.currentTimeMillis(); - ArrayList countByImageStoreIds = Lists.newArrayListWithCapacity((int)imageIds.size()); - List partition = Lists.partition(imageIds, (int)this.searchSize); - partition.stream().forEach(p -> { - List list = this.groupPersonRefMapper.getCountByImageStoreIds(p); - if (!CollectionUtils.isEmpty((Collection)list)) { - countByImageStoreIds.addAll(list); - } - }); - long endTime = System.currentTimeMillis(); - this.logger.info("图库分页查询耗时:[{}],searchSize:[{}]", (Object)(endTime - startTime), (Object)this.searchSize); - Map countMap = countByImageStoreIds.stream().filter(imageStoreCountDTO -> null != imageStoreCountDTO).collect(Collectors.toMap(ImageStoreCountDTO::getId, ImageStoreCountDTO::getCount, (k1, k2) -> k1)); - Map businessNameMap = this.getBusinessNameMap(); - Map sourceApplicationNameMap = this.getSourceApplicationNameMap(businessId); - ArrayList resultList = new ArrayList(agDatas.size()); - for (AgImageStoreResult agData : agDatas) { - PageImageStoreResult temp = (PageImageStoreResult)BeanCopyUtils.copyProperties((Object)agData, PageImageStoreResult.class); - temp.setBusinessName(businessNameMap.get(temp.getBusinessId())); - temp.setSourceApplicationName(sourceApplicationNameMap.get(temp.getSourceApplicationId())); - temp.setPersonNum(countMap.containsKey(agData.getId()) ? countMap.get(agData.getId()) : Integer.valueOf(0)); - resultList.add(temp); - } - return resultList; - } - - private Integer getPersonNum(String id) { - List countByImageStoreIds = this.groupPersonRefMapper.getCountByImageStoreIds((List)Lists.newArrayList((Object[])new String[]{id})); - if (CollectionUtils.isEmpty((Collection)countByImageStoreIds) || countByImageStoreIds.get(0) == null) { - return 0; - } - return ((ImageStoreCountDTO)countByImageStoreIds.get(0)).getCount(); - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchDetailServiceImpl.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchDetailServiceImpl.java deleted file mode 100644 index fe9a6378..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchDetailServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.organization.batch.param.BatchDetailInsertBatchParam; -import cn.cloudwalk.client.organization.batch.param.BatchDetailQueryParam; -import cn.cloudwalk.client.organization.batch.result.BatchDetailResult; -import cn.cloudwalk.client.organization.batch.service.ImgPersonBatchDetailService; -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.data.organization.entity.BatchDetail; -import cn.cloudwalk.data.organization.mapper.ImgPersonBatchDetailMapper; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import java.util.Collection; -import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -@Service -public class ImgPersonBatchDetailServiceImpl -implements ImgPersonBatchDetailService { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - private ImgPersonBatchDetailMapper imgPersonBatchDetailMapper; - - public CloudwalkResult> page(BatchDetailQueryParam param, CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException { - Object result; - BatchDetail batchDetail = (BatchDetail)BeanCopyUtils.copyProperties((Object)param, (Object)new BatchDetail()); - CloudwalkPageAble pageAble = null; - try { - PageHelper.startPage((int)page.getCurrentPage(), (int)page.getPageSize()); - result = (Page)this.imgPersonBatchDetailMapper.page(batchDetail); - pageAble = new CloudwalkPageAble((Collection)result.getResult(), page, result.getTotal()); - } - catch (Exception e) { - this.logger.error("导入详情查询失败,原因:", e); - throw new ServiceException(e); - } - result = BeanCopyUtils.copy((Collection)pageAble.getDatas(), BatchDetailResult.class); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult insertBatch(List batchDetails) { - if (!CollectionUtils.isEmpty(batchDetails)) { - List list = BeanCopyUtils.copy(batchDetails, BatchDetail.class); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchServiceImpl.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchServiceImpl.java deleted file mode 100644 index ecdde15c..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchServiceImpl.java +++ /dev/null @@ -1,535 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.aggregate.common.enums.DelStatusEnum; -import cn.cloudwalk.client.organization.batch.param.BatchDetailInsertBatchParam; -import cn.cloudwalk.client.organization.batch.param.BatchImportQueryParam; -import cn.cloudwalk.client.organization.batch.result.BatchImportQueryResult; -import cn.cloudwalk.client.organization.batch.service.ImgPersonBatchDetailService; -import cn.cloudwalk.client.organization.batch.service.ImgPersonBatchService; -import cn.cloudwalk.client.organization.common.constant.ImageStoreConstants; -import cn.cloudwalk.client.organization.common.enums.CpPersonSourceEnum; -import cn.cloudwalk.client.organization.common.exception.ImageStoreException; -import cn.cloudwalk.client.organization.personimg.param.AddImgPersonParam; -import cn.cloudwalk.client.organization.personimg.param.BatchImportParam; -import cn.cloudwalk.client.organization.result.ZoneResult; -import cn.cloudwalk.client.organization.service.PersonFileService; -import cn.cloudwalk.client.organization.service.PictureRevisionService; -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.serial.UUIDSerial; -import cn.cloudwalk.cloud.utils.BeanCopyUtils; -import cn.cloudwalk.cloud.utils.CloudwalkDateUtils; -import cn.cloudwalk.component.client.resource.ext.user.param.PortalUserAccountBatchAddParam; -import cn.cloudwalk.component.client.resource.ext.user.result.PortalUserAccountBatchAddResult; -import cn.cloudwalk.component.client.resource.ext.user.service.PortalUserService; -import cn.cloudwalk.data.organization.entity.BatchImport; -import cn.cloudwalk.data.organization.entity.ImgStorePerson; -import cn.cloudwalk.data.organization.entity.ImgStorePersonLabel; -import cn.cloudwalk.data.organization.entity.ImgStorePersonOrganization; -import cn.cloudwalk.data.organization.entity.ImgStorePersonProperties; -import cn.cloudwalk.data.organization.entity.Label; -import cn.cloudwalk.data.organization.entity.Organization; -import cn.cloudwalk.data.organization.mapper.ImgStorePersonPropertiesMapper; -import cn.cloudwalk.data.organization.mapper.PersonBatchImportMapper; -import cn.cloudwalk.service.organization.common.AbstractImagStoreService; -import cn.cloudwalk.service.organization.common.OpenCvUtils; -import cn.cloudwalk.service.organization.schedule.BatchImportContext; -import cn.cloudwalk.service.organization.service.CpImageStorePersonSynManager; -import cn.cloudwalk.service.organization.service.ImgPersonManager; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import com.google.common.collect.Sets; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Field; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import javax.annotation.Resource; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.MessageSource; -import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ReflectionUtils; -import org.springframework.web.multipart.MultipartFile; -import org.springside.modules.utils.Collections3; - -@Service -public class ImgPersonBatchServiceImpl -extends AbstractImagStoreService -implements ImgPersonBatchService { - private final String ORG_NAME = "organizationIds"; - private final String LABEL_NAME = "labelIds"; - private final String floorName = "floorName"; - private final String floorNames = "floorNames"; - private final String COMPARE_PICTURE_NAME = "comparePicture"; - private final String PHONE_REGEXP = "^[1][3,4,5,6,7,8,9][0-9]{9}$"; - private final String EMAIL_REGEXP = "^[A-Za-z0-9]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"; - private final String NO_CHINESE_REGEXP = "^[^\\u4e00-\\u9fa5]+$"; - @Autowired - private MessageSource messageSource; - @Autowired - private PersonBatchImportMapper personBatchImportMapper; - @Autowired - private ImgPersonBatchDetailService imgPersonBatchDetailService; - @Autowired - private UUIDSerial uuidSerial; - @Autowired - private ImgPersonManager imgPersonManager; - @Autowired - private OpenCvUtils openCvUtils; - @Autowired - private PictureRevisionService pictureRevisionService; - @Autowired - private PortalUserService portalUserService; - @Autowired - private CpImageStorePersonSynManager cpImageStorePersonSynManager; - @Value(value="${imageQualityScore}") - private Double imgQualityScore; - @Resource - private PersonFileService personFileService; - @Resource - private ImgStorePersonPropertiesMapper propertiesMapper; - - public void handlerBatchPersonImport(List> batchRecordList, T context, String filePath) { - BatchImportContext importContext = (BatchImportContext)context; - ArrayList batchDetailInsertBatchParams = new ArrayList(batchRecordList.size()); - List personParamList = this.generatePersonParams(batchRecordList, filePath, importContext, batchDetailInsertBatchParams); - ArrayList needInsertList = new ArrayList(personParamList.size()); - ArrayList personOrganizationList = new ArrayList(personParamList.size()); - ArrayList personLabelList = new ArrayList(personParamList.size()); - ArrayList needCreateAccountList = new ArrayList(personParamList.size()); - this.personParamsToEntity(importContext, batchDetailInsertBatchParams, personParamList, needInsertList, personOrganizationList, personLabelList, needCreateAccountList); - try { - List errorInfoList; - if (!CollectionUtils.isEmpty(needCreateAccountList) && !CollectionUtils.isEmpty(errorInfoList = this.addUserAccountUsePortal(importContext, needCreateAccountList))) { - List errorPersonIdList = Collections3.extractToList(errorInfoList, (String)"personId"); - this.removeErrorEntity(needInsertList, personOrganizationList, personLabelList, errorPersonIdList); - for (PortalUserAccountBatchAddResult.ErrorInfo errorInfo : errorInfoList) { - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, errorInfo.getPersonName(), errorInfo.getErrorMsg(), 2)); - } - } - this.imgPersonManager.batchInsertWithTx(needInsertList, personOrganizationList, personLabelList); - List batchInsertPersonIds = needInsertList.parallelStream().map(ImgStorePerson::getId).collect(Collectors.toList()); - HashSet imageIdResultSet = Sets.newHashSet(); - batchInsertPersonIds.parallelStream().forEach(personId -> imageIdResultSet.addAll(this.cpImageStorePersonSynManager.addGroupPersonSynTask((String)personId))); - if (Collections3.isNotEmpty((Collection)imageIdResultSet)) { - imageIdResultSet.parallelStream().forEach(imageId -> this.cpImageStorePersonSynManager.handleGroupPersonSynTask((String)imageId)); - } - for (ImgStorePerson storePerson : needInsertList) { - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, storePerson.getName(), "", 1)); - } - } - catch (Exception e) { - this.logger.error("person import data insert exception", e); - for (ImgStorePerson storePerson : needInsertList) { - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, storePerson.getName(), "数据插入异常", 2)); - } - needInsertList.clear(); - } - try { - this.imgPersonBatchDetailService.insertBatch(batchDetailInsertBatchParams); - } - catch (Exception e) { - this.logger.error("---person import batch detail insert exception", e); - } - importContext.getSuccessCount().getAndAdd(needInsertList.size()); - importContext.getFailCount().getAndAdd(batchDetailInsertBatchParams.size() - needInsertList.size()); - } - - private List addUserAccountUsePortal(BatchImportContext importContext, List needCreateAccountList) throws ServiceException { - PortalUserAccountBatchAddParam userAccountBatchAddParam = new PortalUserAccountBatchAddParam(); - userAccountBatchAddParam.setBusinessId(importContext.getBatchImport().getBusinessId()); - userAccountBatchAddParam.setUserInfos(this.generateUserInfo(needCreateAccountList)); - CloudwalkResult batchAddResult = this.portalUserService.batchAdd(userAccountBatchAddParam); - if (!batchAddResult.isSuccess()) { - this.logger.error("call cwos add user account failed, result:[{}]", (Object)JSON.toJSONString((Object)batchAddResult)); - throw new ServiceException(batchAddResult.getCode(), batchAddResult.getMessage()); - } - return ((PortalUserAccountBatchAddResult)batchAddResult.getData()).getErrorInfoList(); - } - - private List generateUserInfo(List needInsertList) { - ArrayList userInfoList = new ArrayList(needInsertList.size()); - for (ImgStorePerson imgStorePerson : needInsertList) { - PortalUserAccountBatchAddParam.UserInfo userInfo = new PortalUserAccountBatchAddParam.UserInfo(); - userInfo.setPersonId(imgStorePerson.getId()); - userInfo.setSystemId(imgStorePerson.getSysAccountId()); - userInfo.setName(imgStorePerson.getName()); - userInfo.setUserName(imgStorePerson.getUserName()); - userInfo.setEmail(imgStorePerson.getEmail()); - userInfo.setPhone(imgStorePerson.getPhone()); - userInfo.setPersonCode(imgStorePerson.getPersonCode()); - userInfo.setCorpAdmin(Short.valueOf((short)2)); - userInfo.setUserLevel(Short.valueOf((short)3)); - userInfoList.add(userInfo); - } - return userInfoList; - } - - private void removeErrorEntity(List needInsertList, List personOrganizationList, List personLabelList, List errorPersonIdList) { - needInsertList.removeIf(next -> errorPersonIdList.contains(next.getId())); - personLabelList.removeIf(next -> errorPersonIdList.contains(next.getPersonId())); - personOrganizationList.removeIf(next -> errorPersonIdList.contains(next.getPersonId())); - } - - private void personParamsToEntity(BatchImportContext importContext, List batchDetailInsertBatchParams, List personParamList, List needInsertList, List personOrganizationList, List personLabelList, List needCreateAccoutList) { - for (AddImgPersonParam personParam : personParamList) { - try { - ImgStorePerson imgStorePerson = this.generatePersonDTO(importContext, personParam); - needInsertList.add(imgStorePerson); - if (personParam.getCreateSysAccount() != null && personParam.getCreateSysAccount().intValue() == 1) { - needCreateAccoutList.add(imgStorePerson); - } - if (!CollectionUtils.isEmpty((Collection)personParam.getOrganizationIds())) { - personOrganizationList.addAll(this.generatePersonOrganizations(imgStorePerson.getId(), personParam.getOrganizationIds(), importContext)); - } - if (CollectionUtils.isEmpty((Collection)personParam.getLabelIds())) continue; - personLabelList.addAll(this.generatePersonLabels(imgStorePerson.getId(), personParam.getLabelIds(), importContext)); - } - catch (ServiceException e) { - this.logger.warn("package person data exception:{}", (Object)e.getMessage()); - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, personParam.getName(), e.getMessage(), 2)); - } - catch (Exception e) { - this.logger.error("package person data exception:{}", (Object)e.getMessage()); - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, personParam.getName(), "人员数据封装异常", 2)); - } - } - } - - private List generatePersonParams(List> batchRecordList, String filePath, BatchImportContext importContext, List batchDetailInsertBatchParams) { - ArrayList personParamList = new ArrayList(batchRecordList.size()); - AddImgPersonParam addPersonParam = null; - for (List record : batchRecordList) { - addPersonParam = new AddImgPersonParam(); - try { - this.checkRecordAndFillParam(record, importContext, filePath, addPersonParam); - this.logger.info("addPersonParam after properties handle :[{}]", (Object)JSON.toJSONString((Object)addPersonParam)); - personParamList.add(addPersonParam); - } - catch (ImageStoreException | ServiceException e) { - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, record.get(0), e.getMessage(), 2)); - } - catch (Exception e) { - this.logger.error("Batch import person,checkRecordAndFillParam exception:{}", (Object)e.getMessage()); - batchDetailInsertBatchParams.add(this.generateBatchDetail(importContext, record.get(0), "未知错误", 2)); - } - } - return personParamList; - } - - private Collection generatePersonLabels(String personId, List labelIds, BatchImportContext importContext) { - ArrayList personLabels = new ArrayList(labelIds.size()); - for (String labelId : labelIds) { - ImgStorePersonLabel imgStorePersonLabel = new ImgStorePersonLabel(); - imgStorePersonLabel.setCreateTime(Long.valueOf(System.currentTimeMillis())); - imgStorePersonLabel.setCreateUserId(importContext.getBatchImport().getCreateUserId()); - imgStorePersonLabel.setLabelId(labelId); - imgStorePersonLabel.setPersonId(personId); - imgStorePersonLabel.setId(CloudwalkDateUtils.getUUID()); - personLabels.add(imgStorePersonLabel); - } - return personLabels; - } - - private Collection generatePersonOrganizations(String personId, List organizationIds, BatchImportContext importContext) { - ArrayList personOrganizations = new ArrayList(organizationIds.size()); - for (String orgId : organizationIds) { - ImgStorePersonOrganization imgStorePersonOrganization = new ImgStorePersonOrganization(); - imgStorePersonOrganization.setCreateTime(Long.valueOf(System.currentTimeMillis())); - imgStorePersonOrganization.setCreateUserId(importContext.getBatchImport().getCreateUserId()); - imgStorePersonOrganization.setPersonId(personId); - imgStorePersonOrganization.setOrgId(orgId); - imgStorePersonOrganization.setId(CloudwalkDateUtils.getUUID()); - personOrganizations.add(imgStorePersonOrganization); - } - return personOrganizations; - } - - private ImgStorePerson generatePersonDTO(BatchImportContext importContext, AddImgPersonParam personParam) throws ServiceException { - ImgStorePerson personDto = new ImgStorePerson(); - BeanCopyUtils.copyProperties((Object)personParam, (Object)personDto); - personDto.setId(this.uuidSerial.uuid()); - if (!StringUtils.isEmpty((CharSequence)personParam.getComparePicture())) { - personDto.setImageId(this.imgPersonManager.addAgImage(personParam.getComparePicture(), this.getCloudwalkContext())); - } - personDto.setComparePicture(personParam.getComparePicture()); - personDto.setBusinessId(importContext.getBatchImport().getBusinessId()); - personDto.setCreateUserId(importContext.getBatchImport().getCreateUserId()); - personDto.setIsDel(DelStatusEnum.NORAML.getCode()); - personDto.setStatus(Short.valueOf((short)0)); - personDto.setCreateTime(Long.valueOf(System.currentTimeMillis())); - personDto.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - personDto.setLastUpdateUserId(importContext.getBatchImport().getCreateUserId()); - personDto.setCreateSysAccount(Short.valueOf(personParam.getCreateSysAccount() == null ? (short)0 : personParam.getCreateSysAccount())); - personDto.setSysAccountId(personParam.getSysAccountId()); - personDto.setSource(CpPersonSourceEnum.PAGE.getCode()); - personDto.setIcCardNo(personParam.getIcCardNo()); - personDto.setIcCardType(personParam.getIcCardType()); - personDto.setWelcome(personParam.getWelcome()); - personDto.setReserveInfo(personParam.getReserveInfo()); - return personDto; - } - - private void checkRecordAndFillParam(List record, BatchImportContext importContext, String filePath, AddImgPersonParam addPersonParam) throws ImageStoreException, ServiceException { - Map namePropertiesMap = importContext.getNameCodeMap(); - Map indexNameMap = importContext.getNameIndexMap(); - Map orgNameMap = importContext.getOrgNameMap(); - Map labelNameMap = importContext.getLabelNameMap(); - Map zoneMap = importContext.getZoneMap(); - if (namePropertiesMap.size() < 12) { - throw new ImageStoreException("53014029", "人员属性未设置"); - } - for (int i = 0; i < record.size(); ++i) { - Pattern pattern; - Matcher matcher; - String value = record.get(i); - String name = indexNameMap.get(i); - ImgStorePersonProperties properties = namePropertiesMap.get(name); - if (properties == null) continue; - try { - this.checkField(properties, value); - } - catch (ImageStoreException e) { - this.logger.warn("当前属性值缺失{}", (Object)JSONObject.toJSONString(record)); - throw new ImageStoreException("53014017", properties.getName() + "没有有效值"); - } - if (StringUtils.isEmpty((CharSequence)value)) continue; - if ("personCode".equals(properties.getCode()) && !(matcher = (pattern = Pattern.compile("^[^\\u4e00-\\u9fa5]+$")).matcher(value)).matches()) { - this.logger.warn("文件内工号格式不正确,name:[{}], value:[{}]", (Object)properties.getName(), (Object)value); - throw new ImageStoreException("53014001", String.format("%s[%s]文件内工号格式不正确", properties.getName(), value)); - } - if ("userName".equals(properties.getCode()) && !(matcher = (pattern = Pattern.compile("^[^\\u4e00-\\u9fa5]+$")).matcher(value)).matches()) { - this.logger.warn("文件内用户名格式不正确,name:[{}], value:[{}]", (Object)properties.getName(), (Object)value); - throw new ImageStoreException("53014003", String.format("%s[%s]文件内用户名格式不正确", properties.getName(), value)); - } - if ("phone".equals(properties.getCode()) && !(matcher = (pattern = Pattern.compile("^[1][3,4,5,6,7,8,9][0-9]{9}$")).matcher(value)).matches()) { - this.logger.warn("文件内手机号格式不正确,name:[{}], value:[{}]", (Object)properties.getName(), (Object)value); - throw new ImageStoreException("53014017", String.format("%s[%s]文件内手机号格式不正确", properties.getName(), value)); - } - if ("email".equals(properties.getCode()) && !(matcher = (pattern = Pattern.compile("^[A-Za-z0-9]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")).matcher(value)).matches()) { - this.logger.warn("文件内邮箱格式不正确,name:[{}], value:[{}]", (Object)properties.getName(), (Object)value); - throw new ImageStoreException("53014017", String.format("%s[%s]文件内邮箱格式不正确", properties.getName(), value)); - } - if ("floorName".equals(properties.getCode())) { - addPersonParam.setDefaultFloor(this.handlerZoneName(value, zoneMap)); - continue; - } - if ("floorNames".equals(properties.getCode())) { - addPersonParam.setChooseFloor(this.handlerZoneName(value, zoneMap)); - continue; - } - if ("organizationIds".equals(properties.getCode())) { - addPersonParam.setOrganizationIds(this.handlerOrgName(value, orgNameMap)); - continue; - } - if ("labelIds".equals(properties.getCode())) { - addPersonParam.setLabelIds(this.handlerLabelName(value, labelNameMap)); - continue; - } - if ("sysAccountId".equals(properties.getCode())) { - if (StringUtils.isBlank((CharSequence)value)) { - addPersonParam.setCreateSysAccount(Short.valueOf((short)0)); - addPersonParam.setSysAccountId(null); - continue; - } - addPersonParam.setCreateSysAccount(Short.valueOf((short)1)); - addPersonParam.setSysAccountId(value); - continue; - } - this.handlerPropertyTypeAndFillParam(properties, value, filePath, addPersonParam, importContext); - } - if (CollectionUtils.isEmpty((Collection)addPersonParam.getLabelIds()) && CollectionUtils.isEmpty((Collection)addPersonParam.getOrganizationIds())) { - this.logger.warn("组织/标签至少二选一"); - throw new ImageStoreException("53014020", "组织/标签至少二选一"); - } - } - - private String handlerZoneName(String value, Map zoneMap) { - String floorId = ""; - if (!StringUtils.isEmpty((CharSequence)value)) { - String[] floorArrs; - value = value.replaceAll("\\s+", ""); - for (String floor : floorArrs = value.split(",")) { - if (!zoneMap.containsKey(floor)) continue; - if (StringUtils.isNotEmpty((CharSequence)floorId)) { - floorId = floorId + ","; - } - floorId = floorId + zoneMap.get(floor).getId(); - } - } - return floorId; - } - - private List handlerOrgName(String value, Map orgNameMap) { - ArrayList orgIds = new ArrayList(); - if (!StringUtils.isEmpty((CharSequence)value)) { - String[] orgNameArr; - value = value.replaceAll("\\s+", ""); - for (String orgName : orgNameArr = value.split(";")) { - if (!orgNameMap.containsKey(orgName)) continue; - orgIds.add(orgNameMap.get(orgName).getId()); - } - } - return orgIds; - } - - private List handlerLabelName(String value, Map labelNameMap) { - ArrayList labelIds = new ArrayList(); - if (!StringUtils.isEmpty((CharSequence)value)) { - String[] labelNameArr; - value = value.replaceAll("\\s+", ""); - for (String labelName : labelNameArr = value.split(";")) { - if (!labelNameMap.containsKey(labelName)) continue; - labelIds.add(labelNameMap.get(labelName).getId()); - } - } - return labelIds; - } - - private void handlerPropertyTypeAndFillParam(ImgStorePersonProperties properties, String value, String filePath, AddImgPersonParam addPersonParam, BatchImportContext context) throws ImageStoreException, ServiceException { - switch (properties.getType()) { - case 4: { - long copyImageTimeStart = System.currentTimeMillis(); - String fullPath = filePath + File.separator + value; - try { - MultipartFile multipartFile = this.personFileService.buildMultipartFile(value, Files.readAllBytes(Paths.get(fullPath, new String[0]))); - CloudwalkResult result = null; - result = "comparePicture".equalsIgnoreCase(properties.getCode()) ? this.personFileService.uploadCompressImage2(multipartFile) : this.personFileService.uploadImage(multipartFile); - if (!result.isSuccess()) { - throw new ImageStoreException(result.getCode(), result.getMessage()); - } - context.getImageCopyTime().getAndAdd(System.currentTimeMillis() - copyImageTimeStart); - String relativePath = null != result.getData() ? (String)result.getData() : ""; - this.populateBeanValue(properties, relativePath, addPersonParam); - break; - } - catch (IOException e) { - throw new ImageStoreException("53014017", properties.getName() + "不存在/无效"); - } - } - case 3: { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date date = null; - try { - date = simpleDateFormat.parse(value); - } - catch (ParseException e) { - this.logger.warn("当前时间格式不合法", e); - throw new ImageStoreException("53014017", properties.getName() + "格式不合法"); - } - this.populateBeanValue(properties, date.getTime(), addPersonParam); - break; - } - case 1: - case 2: { - this.populateBeanValue(properties, value, addPersonParam); - break; - } - default: { - this.logger.warn("当前属性类型不合法"); - throw new ImageStoreException("53014017", "当前属性类型不合法"); - } - } - } - - private BatchDetailInsertBatchParam generateBatchDetail(BatchImportContext importContext, String personName, String remark, int status) { - BatchDetailInsertBatchParam batchDetail = new BatchDetailInsertBatchParam(); - batchDetail.setId(CloudwalkDateUtils.getUUID()); - batchDetail.setBatchId(importContext.getBatchImport().getId()); - batchDetail.setFileName(importContext.getBatchImport().getFileName()); - batchDetail.setCreateTime(importContext.getBatchImport().getCreateTime()); - batchDetail.setCreateUserId(importContext.getBatchImport().getCreateUserId()); - batchDetail.setPersonName(personName); - batchDetail.setRemark(remark); - batchDetail.setStatus(Integer.valueOf(status)); - return batchDetail; - } - - private void checkField(ImgStorePersonProperties properties, String cellValue) throws ImageStoreException { - short required; - short s = required = properties.getHasRequired() == null ? (short)0 : properties.getHasRequired().shortValue(); - if (required == 1 && StringUtils.isEmpty((CharSequence)cellValue)) { - throw new ImageStoreException("53014017", properties.getReminder()); - } - } - - private void populateBeanValue(ImgStorePersonProperties properties, S source, T target) throws ImageStoreException { - String fieldName = properties.getCode(); - Field targetField = ReflectionUtils.findField(target.getClass(), (String)fieldName); - if (targetField == null) { - throw new ImageStoreException("53014016", this.messageSource.getMessage("53014016", null, LocaleContextHolder.getLocale())); - } - targetField.setAccessible(true); - if ("createSysAccount".equals(fieldName)) { - ReflectionUtils.setField((Field)targetField, target, (Object)Short.valueOf(String.valueOf(source))); - } else { - if (StringUtils.isEmpty((CharSequence)String.valueOf(source))) { - source = null; - } - if (ImageStoreConstants.getCustProperties().contains(properties.getCode())) { - ReflectionUtils.setField((Field)targetField, target, (Object)String.valueOf(source)); - } else { - ReflectionUtils.setField((Field)targetField, target, source); - } - } - } - - public CloudwalkResult insert(BatchImportParam param, CloudwalkCallContext context) throws ServiceException { - BatchImport batchImport = new BatchImport(); - batchImport.setBatchNo(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())); - batchImport.setBusinessId(StringUtils.isEmpty((CharSequence)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId()); - batchImport.setId(CloudwalkDateUtils.getUUID()); - batchImport.setCreateTime(Long.valueOf(System.currentTimeMillis())); - batchImport.setCreateUserId(context.getUser().getCaller()); - batchImport.setStatus(Integer.valueOf(1)); - batchImport.setType(Integer.valueOf(2)); - batchImport.setOperation("1"); - batchImport.setFilePath(param.getFilePath()); - batchImport.setFileName(param.getFilePath().substring(param.getFilePath().lastIndexOf(File.separator) + 1)); - batchImport.setLoginName(context.getUser().getCallerName()); - int count = this.personBatchImportMapper.insert(batchImport); - if (count < 1) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult> page(BatchImportQueryParam param, CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException { - Object result; - BatchImport batchImportQuery = (BatchImport)BeanCopyUtils.copyProperties((Object)param, (Object)new BatchImport()); - batchImportQuery.setBusinessId(StringUtils.isEmpty((CharSequence)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId()); - CloudwalkPageAble pageAble = null; - try { - PageHelper.startPage((int)page.getCurrentPage(), (int)page.getPageSize()); - result = (Page)this.personBatchImportMapper.page(batchImportQuery); - pageAble = new CloudwalkPageAble((Collection)result.getResult(), page, result.getTotal()); - } - catch (Exception e) { - this.logger.error("分页查询批量导入记录列表信息失败,原因:", e); - throw new ServiceException(e); - } - result = BeanCopyUtils.copy((Collection)pageAble.getDatas(), BatchImportQueryResult.class); - return (CloudwalkResult) CloudwalkResult.success($$$); - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonManager.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonManager.java index 04c62958..fce35e1a 100644 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonManager.java +++ b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonManager.java @@ -27,7 +27,7 @@ import org.springframework.util.CollectionUtils; @Component public class ImgPersonManager { protected final Logger logger = LoggerFactory.getLogger(this.getClass()); - private static final List IMAGE_FILE_FORMAT = Lists.newArrayList((Object[])new String[]{"bmp", "jpg", "jpeg", "png", "BMP", "JPG", "PNG"}); + private static final List IMAGE_FILE_FORMAT = Lists.newArrayList("bmp", "jpg", "jpeg", "png", "BMP", "JPG", "PNG"); private static final String FILE_DOT = "."; @Autowired private AgImageService agImageService; diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/OrganizationTypeServiceImpl.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/OrganizationTypeServiceImpl.java deleted file mode 100644 index 5cfbf266..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/OrganizationTypeServiceImpl.java +++ /dev/null @@ -1,463 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.organization.common.constant.ImageStoreConstants; -import cn.cloudwalk.client.organization.common.enums.OrganizationTypeCodeEnum; -import cn.cloudwalk.client.organization.param.QueryOrgTypeParam; -import cn.cloudwalk.client.organization.param.organization.AddOrganizationTypeParam; -import cn.cloudwalk.client.organization.param.organization.DelOrganizationTypeParam; -import cn.cloudwalk.client.organization.param.organization.EditOrganizationTypeParam; -import cn.cloudwalk.client.organization.param.organization.OrganizationTypePropertyParam; -import cn.cloudwalk.client.organization.result.OrganizationTypeListResult; -import cn.cloudwalk.client.organization.result.OrganizationTypePropertyCommonResult; -import cn.cloudwalk.client.organization.result.OrganizationTypeResult; -import cn.cloudwalk.client.organization.service.OrganizationTypeService; -import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate; -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.cloud.utils.CloudwalkDateUtils; -import cn.cloudwalk.data.organization.dto.GetsOrganizationDTO; -import cn.cloudwalk.data.organization.dto.OrganizationTypeQueryDto; -import cn.cloudwalk.data.organization.entity.Organization; -import cn.cloudwalk.data.organization.entity.OrganizationType; -import cn.cloudwalk.data.organization.entity.OrganizationTypeProperties; -import cn.cloudwalk.data.organization.mapper.ImgStoreOrganizationMapper; -import cn.cloudwalk.data.organization.mapper.ImgStoreOrganizationTypeMapper; -import cn.cloudwalk.data.organization.mapper.ImgStoreOrganizationTypePropertiesMapper; -import cn.cloudwalk.service.organization.common.AbstractImagStoreService; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.annotation.Resource; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -@Primary -@Service -public class OrganizationTypeServiceImpl -extends AbstractImagStoreService -implements OrganizationTypeService { - @Resource - private ImgStoreOrganizationTypeMapper orgTypeMapper; - @Resource - private ImgStoreOrganizationTypePropertiesMapper orgTypePropertiesMapper; - @Resource - private ImgStoreOrganizationMapper imgStoreOrganizationMapper; - private static final String EXT = "ext"; - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult add(AddOrganizationTypeParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = StringUtils.isEmpty((Object)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId(); - if (businessId.equals("cloudwalk")) { - throw new ServiceException("53003818", this.getMessage("53003818")); - } - HashSet nameMap = new HashSet(); - List properties = param.getProperties(); - for (OrganizationTypePropertyParam propertyParam : properties) { - nameMap.add(propertyParam.getName()); - } - if (nameMap.size() < properties.size()) { - throw new ServiceException("53003805", this.getMessage("53003805")); - } - OrganizationTypeQueryDto organizationTypeQueryDto = (OrganizationTypeQueryDto)BeanCopyUtils.copyProperties((Object)param, OrganizationTypeQueryDto.class); - organizationTypeQueryDto.setStatus(Integer.valueOf(0)); - organizationTypeQueryDto.setBusinessId(businessId); - List select = this.orgTypeMapper.selectByCondition(organizationTypeQueryDto); - if (!CollectionUtils.isEmpty((Collection)select)) { - throw new ServiceException("53003803", this.getMessage("53003803")); - } - OrganizationType organizationType = (OrganizationType)BeanCopyUtils.copyProperties((Object)param, OrganizationType.class); - String uuid = CloudwalkDateUtils.getUUID(); - organizationType.setId(uuid); - organizationType.setBusinessId(businessId); - organizationType.setCreateTime(Long.valueOf(System.currentTimeMillis())); - organizationType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - organizationType.setCreateUserId(context.getUser().getCaller()); - organizationType.setLastUpdateUserId(context.getUser().getCaller()); - this.orgTypeMapper.insertSelective(organizationType); - int index = 1; - if (!CollectionUtils.isEmpty((Collection)properties)) { - for (OrganizationTypePropertyParam propertyParam : properties) { - OrganizationTypeProperties property = (OrganizationTypeProperties)BeanCopyUtils.copyProperties((Object)propertyParam, OrganizationTypeProperties.class); - property.setId(CloudwalkDateUtils.getUUID()); - property.setBusinessId(businessId); - property.setOrganizationTypeId(uuid); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateUserId(context.getUser().getCaller()); - property.setLastUpdateUserId(context.getUser().getCaller()); - property.setCode(EXT + index++); - this.orgTypePropertiesMapper.insertSelective(property); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Transactional(rollbackFor={Exception.class}) - @CloudwalkParamsValidate - public CloudwalkResult edit(EditOrganizationTypeParam param, CloudwalkCallContext context) throws ServiceException { - block18: { - List typePropertiesDB; - boolean hasOrganization; - List properties; - String businessId; - block19: { - businessId = StringUtils.isEmpty((Object)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId(); - if (businessId.equals("cloudwalk")) { - throw new ServiceException("53003818", this.getMessage("53003818")); - } - HashSet nameMap = new HashSet(); - properties = param.getProperties(); - for (OrganizationTypePropertyParam propertyParam : properties) { - nameMap.add(propertyParam.getName()); - } - if (nameMap.size() < properties.size()) { - throw new ServiceException("53003805", this.getMessage("53003805")); - } - OrganizationTypeQueryDto organizationTypeQuery = new OrganizationTypeQueryDto(); - organizationTypeQuery.setName(param.getName()); - organizationTypeQuery.setStatus(Integer.valueOf(0)); - organizationTypeQuery.setBusinessId(businessId); - List select = this.orgTypeMapper.selectByCondition(organizationTypeQuery); - if (!CollectionUtils.isEmpty((Collection)select)) { - for (OrganizationType type : select) { - if (type.getId().equals(param.getId())) continue; - throw new ServiceException("53003803", this.getMessage("53003803")); - } - } - hasOrganization = false; - boolean hasChildren = false; - GetsOrganizationDTO organizationDTO = new GetsOrganizationDTO(); - organizationDTO.setTypeId(param.getId()); - organizationDTO.setIsDel(Short.valueOf((short)0)); - List organizations = this.imgStoreOrganizationMapper.gets(organizationDTO); - if (!CollectionUtils.isEmpty((Collection)organizations)) { - hasOrganization = true; - ArrayList parentIds = new ArrayList(); - for (Organization organization : organizations) { - parentIds.add(organization.getId()); - } - organizationDTO = new GetsOrganizationDTO(); - organizationDTO.setIsDel(Short.valueOf((short)0)); - organizationDTO.setParentIds(parentIds); - List childrens = this.imgStoreOrganizationMapper.gets(organizationDTO); - if (childrens != null && childrens.size() > 0) { - hasChildren = true; - } - } - if (param.getHasLowerLevel() == 0 && hasChildren) { - throw new ServiceException("53003813", this.getMessage("53003813")); - } - OrganizationType organizationType = (OrganizationType)BeanCopyUtils.copyProperties((Object)organizationTypeQuery, OrganizationType.class); - organizationType.setId(param.getId()); - organizationType.setHasLowerLevel(param.getHasLowerLevel()); - organizationType.setLastUpdateUserId(context.getUser().getCaller()); - organizationType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - this.orgTypeMapper.updateByPrimaryKeySelective(organizationType); - OrganizationTypeProperties proQuery = new OrganizationTypeProperties(); - proQuery.setOrganizationTypeId(param.getId()); - typePropertiesDB = this.orgTypePropertiesMapper.select(proQuery); - if (properties == null) break block18; - if (!CollectionUtils.isEmpty((Collection)typePropertiesDB)) break block19; - int index = 1; - for (OrganizationTypePropertyParam propertyParam : properties) { - OrganizationTypeProperties property = (OrganizationTypeProperties)BeanCopyUtils.copyProperties((Object)propertyParam, OrganizationTypeProperties.class); - property.setId(CloudwalkDateUtils.getUUID()); - property.setBusinessId(businessId); - property.setOrganizationTypeId(param.getId()); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateUserId(context.getUser().getCaller()); - property.setLastUpdateUserId(context.getUser().getCaller()); - property.setCode(EXT + index++); - property.setStatus(Integer.valueOf(0)); - this.orgTypePropertiesMapper.insertSelective(property); - } - break block18; - } - HashMap DBMap = new HashMap(); - HashSet codeSet = new HashSet(); - for (OrganizationTypeProperties organizationTypeProperties : typePropertiesDB) { - String code = organizationTypeProperties.getCode(); - codeSet.add(code); - DBMap.put(organizationTypeProperties.getId(), organizationTypeProperties); - } - List newList = BeanCopyUtils.copy((Collection)properties, OrganizationTypeProperties.class); - ArrayList newListCopy = new ArrayList(newList); - newListCopy.retainAll(typePropertiesDB); - if (!CollectionUtils.isEmpty(newListCopy)) { - for (OrganizationTypeProperties organizationTypeProperties : newListCopy) { - Integer hasRequired; - if (hasOrganization && organizationTypeProperties.getHasRequired() == 1 && (hasRequired = ((OrganizationTypeProperties)DBMap.get(organizationTypeProperties.getId())).getHasRequired()) != null && hasRequired == 0) { - throw new ServiceException("53003815", this.getMessage("53003815")); - } - organizationTypeProperties.setStatus(Integer.valueOf(0)); - organizationTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - organizationTypeProperties.setLastUpdateUserId(context.getUser().getCaller()); - this.orgTypePropertiesMapper.updateByPrimaryKeySelective(organizationTypeProperties); - } - } - typePropertiesDB.removeAll(newListCopy); - if (!CollectionUtils.isEmpty((Collection)typePropertiesDB)) { - for (OrganizationTypeProperties organizationTypeProperties : typePropertiesDB) { - organizationTypeProperties.setStatus(Integer.valueOf(1)); - organizationTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - organizationTypeProperties.setLastUpdateUserId(context.getUser().getCaller()); - this.orgTypePropertiesMapper.updateByPrimaryKeySelective(organizationTypeProperties); - codeSet.remove(organizationTypeProperties.getCode()); - String typeId = param.getId(); - String codeProperty = organizationTypeProperties.getCode(); - this.imgStoreOrganizationMapper.removePropertyByTypeIdAndCode(typeId, codeProperty); - } - } - newList.removeAll(newListCopy); - if (CollectionUtils.isEmpty((Collection)newList)) break block18; - for (OrganizationTypeProperties organizationTypeProperties : newList) { - if (organizationTypeProperties.getHasRequired() == 1 && hasOrganization) { - throw new ServiceException("53003814", this.getMessage("53003814")); - } - organizationTypeProperties.setId(CloudwalkDateUtils.getUUID()); - organizationTypeProperties.setBusinessId(businessId); - organizationTypeProperties.setOrganizationTypeId(param.getId()); - organizationTypeProperties.setCreateTime(Long.valueOf(System.currentTimeMillis())); - organizationTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - organizationTypeProperties.setCreateUserId(context.getUser().getCaller()); - organizationTypeProperties.setLastUpdateUserId(context.getUser().getCaller()); - organizationTypeProperties.setCode(this.getCode(codeSet)); - organizationTypeProperties.setStatus(Integer.valueOf(0)); - this.orgTypePropertiesMapper.insertSelective(organizationTypeProperties); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private String getCode(Set codeSet) { - for (int i = 1; i <= 30; ++i) { - if (!codeSet.add(EXT + i)) continue; - return EXT + i; - } - return null; - } - - @Transactional(rollbackFor={Exception.class}) - public CloudwalkResult delete(DelOrganizationTypeParam param, CloudwalkCallContext context) throws ServiceException { - List ids = param.getIds(); - if (!CollectionUtils.isEmpty((Collection)ids)) { - for (String typeId : ids) { - GetsOrganizationDTO getsOrganizationDTO = new GetsOrganizationDTO(); - getsOrganizationDTO.setTypeId(typeId); - getsOrganizationDTO.setIsDel(Short.valueOf((short)0)); - List gets = this.imgStoreOrganizationMapper.gets(getsOrganizationDTO); - if (CollectionUtils.isEmpty((Collection)gets)) continue; - throw new ServiceException("53003304", this.getMessage("53003304")); - } - for (String id : ids) { - OrganizationType organizationType = this.orgTypeMapper.selectByPrimaryKey(id); - if (organizationType == null) { - throw new ServiceException("53003310", this.getMessage("53003310")); - } - organizationType.setId(id); - OrganizationType organizationTypeDB = this.orgTypeMapper.selectByPrimaryKey(id); - if ("cloudwalk".equals(organizationTypeDB.getBusinessId())) { - throw new ServiceException("53003818", this.getMessage("53003818")); - } - organizationType.setStatus(Integer.valueOf(1)); - organizationType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - organizationType.setLastUpdateUserId(context.getUser().getCaller()); - this.orgTypeMapper.updateByPrimaryKeySelective(organizationType); - OrganizationTypeProperties record = new OrganizationTypeProperties(); - record.setOrganizationTypeId(id); - record.setStatus(Integer.valueOf(1)); - record.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - record.setLastUpdateUserId(context.getUser().getCaller()); - this.orgTypePropertiesMapper.updateByTypeKey(record); - } - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult> page(QueryOrgTypeParam param, CloudwalkPageInfo page, CloudwalkCallContext context) throws ServiceException { - String businessId = context.getCompany().getCompanyId(); - ArrayList results = new ArrayList(); - OrganizationTypeQueryDto record = (OrganizationTypeQueryDto)BeanCopyUtils.copyProperties((Object)param, OrganizationTypeQueryDto.class); - record.setBusinessId(businessId); - record.setStatus(Integer.valueOf(0)); - try { - PageHelper.startPage((int)page.getCurrentPage(), (int)page.getPageSize()); - Page gets = (Page)this.orgTypeMapper.select(record); - List result = gets.getResult(); - Map deletableMap = OrganizationTypeCodeEnum.deletable(); - for (OrganizationType organizationType : result) { - OrganizationTypeListResult typeResult = (OrganizationTypeListResult)BeanCopyUtils.copyProperties((Object)organizationType, OrganizationTypeListResult.class); - typeResult.setDeletable(deletableMap.getOrDefault(organizationType.getCode(), 1)); - OrganizationTypeProperties recordQuery = new OrganizationTypeProperties(); - recordQuery.setStatus(Integer.valueOf(0)); - recordQuery.setOrganizationTypeId(organizationType.getId()); - List propertiesList = this.orgTypePropertiesMapper.select(recordQuery); - if (!CollectionUtils.isEmpty((Collection)propertiesList)) { - StringBuilder builder = new StringBuilder(); - for (OrganizationTypeProperties organizationTypeProperties : propertiesList) { - builder.append("," + organizationTypeProperties.getName()); - } - typeResult.setProperties(builder.substring(1)); - } else { - typeResult.setProperties(""); - } - results.add(typeResult); - } - CloudwalkPageAble pageAble = new CloudwalkPageAble(results, page, gets.getTotal()); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - catch (Exception e) { - this.logger.error("分页查询机构类型信息失败,原因:", e); - throw new ServiceException("53003804", this.getMessage("53003804")); - } - } - - public CloudwalkResult> getList(QueryOrgTypeParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = StringUtils.isEmpty((Object)param.getBusinessId()) ? context.getCompany().getCompanyId() : param.getBusinessId(); - Map deletableMap = OrganizationTypeCodeEnum.deletable((String)OrganizationTypeCodeEnum.UNIT.getGroup()); - ArrayList results = new ArrayList(); - OrganizationTypeQueryDto record = (OrganizationTypeQueryDto)BeanCopyUtils.copyProperties((Object)param, OrganizationTypeQueryDto.class); - record.setBusinessId(businessId); - record.setStatus(Integer.valueOf(0)); - List result = this.orgTypeMapper.select(record); - for (OrganizationType organizationType : result) { - OrganizationTypeListResult typeResult = (OrganizationTypeListResult)BeanCopyUtils.copyProperties((Object)organizationType, OrganizationTypeListResult.class); - typeResult.setDeletable(deletableMap.getOrDefault(organizationType.getCode(), 1)); - OrganizationTypeProperties recordQuery = new OrganizationTypeProperties(); - recordQuery.setStatus(Integer.valueOf(0)); - recordQuery.setOrganizationTypeId(organizationType.getId()); - List propertiesList = this.orgTypePropertiesMapper.select(recordQuery); - if (!CollectionUtils.isEmpty((Collection)propertiesList)) { - StringBuilder builder = new StringBuilder(); - for (OrganizationTypeProperties organizationTypeProperties : propertiesList) { - builder.append("," + organizationTypeProperties.getName()); - } - typeResult.setProperties(builder.substring(1)); - } else { - typeResult.setProperties(""); - } - results.add(typeResult); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult detail(QueryOrgTypeParam param, CloudwalkCallContext cloudwalkContext) throws ServiceException { - if (StringUtils.isEmpty((Object)param.getId())) { - throw new ServiceException("53060410", this.getMessage("53060410")); - } - OrganizationType organizationType = this.orgTypeMapper.selectByPrimaryKey(param.getId()); - OrganizationTypeResult result = (OrganizationTypeResult)BeanCopyUtils.copyProperties((Object)organizationType, OrganizationTypeResult.class); - OrganizationTypeProperties proQuery = new OrganizationTypeProperties(); - proQuery.setOrganizationTypeId(param.getId()); - List typeProperties = this.orgTypePropertiesMapper.select(proQuery); - result.setProperties(BeanCopyUtils.copy((Collection)typeProperties, OrganizationTypePropertyParam.class)); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult> commonList(CloudwalkCallContext cloudwalkContext) throws ServiceException { - List result = new ArrayList(); - OrganizationTypeProperties recordQuery = new OrganizationTypeProperties(); - recordQuery.setStatus(ImageStoreConstants.COMMON_PROPERTIES_STATUS); - recordQuery.setBusinessId("cloudwalk"); - List select = this.orgTypePropertiesMapper.select(recordQuery); - if (select != null && select.size() > 0) { - result = BeanCopyUtils.copy((Collection)select, OrganizationTypePropertyCommonResult.class); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Transactional(rollbackFor={Exception.class}) - public CloudwalkResult init(EditOrganizationTypeParam param, CloudwalkCallContext cloudwalkContext) { - List properties = param.getProperties(); - OrganizationTypeProperties recordQuery = new OrganizationTypeProperties(); - recordQuery.setStatus(ImageStoreConstants.COMMON_PROPERTIES_STATUS); - recordQuery.setBusinessId("cloudwalk"); - List select = this.orgTypePropertiesMapper.select(recordQuery); - if (select != null && select.size() > 0) { - for (OrganizationTypeProperties organizationTypeProperties : select) { - organizationTypeProperties.setStatus(Integer.valueOf(1)); - organizationTypeProperties.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - organizationTypeProperties.setLastUpdateUserId(cloudwalkContext.getUser().getCaller()); - this.orgTypePropertiesMapper.updateByPrimaryKeySelective(organizationTypeProperties); - } - } - if (properties != null && properties.size() > 0) { - List initList = BeanCopyUtils.copy((Collection)properties, OrganizationTypeProperties.class); - for (OrganizationTypeProperties property : initList) { - if (StringUtils.isEmpty((Object)property.getName())) continue; - property.setId(CloudwalkDateUtils.getUUID()); - property.setStatus(ImageStoreConstants.COMMON_PROPERTIES_STATUS); - property.setBusinessId("cloudwalk"); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setLastUpdateUserId(cloudwalkContext.getUser().getCaller()); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateUserId(cloudwalkContext.getUser().getCaller()); - this.orgTypePropertiesMapper.insertSelective(property); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - String[] initNameArray = new String[]{"地址", "邮编", "电话", "传真", "面积", "财务是否独立核算"}; - int index = 1; - for (String name : initNameArray) { - OrganizationTypeProperties property = new OrganizationTypeProperties(); - property.setId(CloudwalkDateUtils.getUUID()); - property.setName(name); - property.setOrderNum(Integer.valueOf(index++)); - property.setStatus(ImageStoreConstants.COMMON_PROPERTIES_STATUS); - property.setBusinessId("cloudwalk"); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setLastUpdateUserId(cloudwalkContext.getUser().getCaller()); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateUserId(cloudwalkContext.getUser().getCaller()); - this.orgTypePropertiesMapper.insertSelective(property); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @Transactional(rollbackFor={Exception.class}) - public CloudwalkResult defaultInit(CloudwalkCallContext cloudwalkContext) throws ServiceException { - this.logger.info("初始化机构类型"); - OrganizationType organizationType = new OrganizationType(); - String uuid = CloudwalkDateUtils.getUUID(); - organizationType.setId(uuid); - organizationType.setName("公司"); - organizationType.setBusinessId("cloudwalk"); - organizationType.setStatus(Integer.valueOf(0)); - organizationType.setHasDefault(Integer.valueOf(1)); - organizationType.setHasLowerLevel(Integer.valueOf(1)); - organizationType.setCreateTime(Long.valueOf(System.currentTimeMillis())); - organizationType.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - this.orgTypeMapper.insertSelective(organizationType); - String[] initNameArray = new String[]{"地址", "邮编", "电话", "负责人", "说明"}; - int index = 1; - for (String name : initNameArray) { - OrganizationTypeProperties property = new OrganizationTypeProperties(); - property.setId(CloudwalkDateUtils.getUUID()); - property.setOrganizationTypeId(uuid); - property.setName(name); - property.setOrderNum(Integer.valueOf(index++)); - property.setStatus(Integer.valueOf(0)); - property.setBusinessId("cloudwalk"); - property.setLastUpdateTime(Long.valueOf(System.currentTimeMillis())); - property.setCreateTime(Long.valueOf(System.currentTimeMillis())); - this.orgTypePropertiesMapper.insertSelective(property); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/SelfRegistryHandler.java b/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/SelfRegistryHandler.java deleted file mode 100644 index 6b126d65..00000000 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/SelfRegistryHandler.java +++ /dev/null @@ -1,255 +0,0 @@ -package cn.cloudwalk.service.organization.service; -// 业务服务 -import cn.cloudwalk.client.device.mgn.atomic.param.CoreDeviceQueryParam; -import cn.cloudwalk.client.device.mgn.atomic.service.AtomicDeviceService; -import cn.cloudwalk.client.organization.common.enums.DefaultPropertyEnum; -import cn.cloudwalk.client.organization.common.enums.RegistryTypeEnum; -import cn.cloudwalk.client.organization.common.enums.StatusEnum; -import cn.cloudwalk.client.organization.common.enums.UniquePropertyEnum; -import cn.cloudwalk.client.organization.service.store.param.AddPersonRegistryParam; -import cn.cloudwalk.client.organization.service.store.param.QueryPersonRegistryParam; -import cn.cloudwalk.client.organization.service.store.result.DeviceResult; -import cn.cloudwalk.client.organization.service.store.result.PersonPropertiesResult; -import cn.cloudwalk.client.organization.service.store.result.PersonRegistryResult; -import cn.cloudwalk.client.organization.service.store.service.IPersonRegistryHandler; -import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate; -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.data.organization.entity.ImgStorePersonProperties; -import cn.cloudwalk.data.organization.entity.PersonRegistry; -import cn.cloudwalk.data.organization.mapper.ImgStorePersonPropertiesMapper; -import cn.cloudwalk.data.organization.mapper.PersonRegistryDeviceMapper; -import cn.cloudwalk.data.organization.mapper.PersonRegistryPropertiesMapper; -import cn.cloudwalk.service.organization.common.AbstractImagStoreService; -import cn.cloudwalk.service.organization.service.CommonPersonRegistryService; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; -import javax.annotation.Resource; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import org.springside.modules.utils.Collections3; - -@Service(value="SelfRegistryHandler") -public class SelfRegistryHandler -extends AbstractImagStoreService -implements IPersonRegistryHandler { - @Resource - private CommonPersonRegistryService commonPersonRegistryService; - @Resource - private AtomicDeviceService atomicDeviceService; - @Resource - private ImgStorePersonPropertiesMapper imgStorePersonPropertiesMapper; - @Resource - private PersonRegistryPropertiesMapper personRegistryPropertiesMapper; - @Resource - private PersonRegistryDeviceMapper personRegistryDeviceMapper; - - @CloudwalkParamsValidate - @Transactional(propagation=Propagation.REQUIRED, rollbackFor={Exception.class}, value="transactionManager") - public CloudwalkResult save(AddPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = context.getCompany().getCompanyId(); - param.setBusinessId(businessId); - CloudwalkResult result = this.validateParams(param, context); - if (!result.isSuccess()) { - return result; - } - PersonRegistry personRegistry = this.commonPersonRegistryService.getByBusinessAndType(businessId, RegistryTypeEnum.SELF_REGISTRY.getValue()); - if (null != personRegistry) { - param.setId(personRegistry.getId()); - this.update(param, context); - } else { - this.insert(param, context); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private CloudwalkResult validateParams(AddPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - if (null == param.getCodeStatus()) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - if (CollectionUtils.isEmpty((Collection)param.getPropertyIdList())) { - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - List dbPersonProList = this.imgStorePersonPropertiesMapper.selectByIds(param.getBusinessId(), param.getPropertyIdList()); - if (CollectionUtils.isEmpty((Collection)dbPersonProList) || dbPersonProList.size() != param.getPropertyIdList().size()) { - this.logger.warn("注册属性不属于人员基本属性,注册属性Id列表:[{}]", (Object)JSONObject.toJSONString((Object)param.getPropertyIdList())); - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - for (DefaultPropertyEnum default_property : DefaultPropertyEnum.values()) { - Optional requiredOptional = dbPersonProList.stream().filter(property -> default_property.getValue().equals(property.getCode())).findFirst(); - if (requiredOptional.isPresent()) continue; - this.logger.warn("{}未勾选,注册属性Id列表:[{}]", (Object)default_property.getDescription(), (Object)JSONObject.toJSONString((Object)param.getPropertyIdList())); - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - if (Objects.equals(param.getDeviceStatus(), StatusEnum.CLOSE.getValue()) || Objects.equals(param.getCodeStatus(), StatusEnum.CLOSE.getValue())) { - ImgStorePersonProperties queryPersonPro = new ImgStorePersonProperties(); - queryPersonPro.setBusinessId(param.getBusinessId()); - queryPersonPro.setStatus(StatusEnum.VALID.getValue()); - queryPersonPro.setHasRequired(StatusEnum.REQUIRED.getValue()); - List requiredPersonProList = this.imgStorePersonPropertiesMapper.select(queryPersonPro); - if (!CollectionUtils.isEmpty((Collection)requiredPersonProList)) { - List requiredPersonProIdList = Collections3.extractToList((Collection)requiredPersonProList, (String)"id"); - if ((dbPersonProList = dbPersonProList.stream().filter(pro -> requiredPersonProIdList.contains(pro.getId())).collect(Collectors.toList())).size() != requiredPersonProList.size()) { - this.logger.warn("设备注册审核和扫码注册审核未同时打开,有未勾选的必填属性,注册属性Id列表:[{}]", (Object)JSONObject.toJSONString((Object)param.getPropertyIdList())); - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - } - } - this.commonPersonRegistryService.validateOrg(param); - this.commonPersonRegistryService.validateLabel(param); - this.commonPersonRegistryService.validateDevice(param, context); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private CloudwalkResult insert(AddPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - String id = this.getPrimaryId(); - this.commonPersonRegistryService.insertPersonRegistry(id, param, context); - this.commonPersonRegistryService.batchInsertPersonRegistryProperty(id, param); - this.commonPersonRegistryService.batchInsertPersonRegistryDevice(id, param, context, false); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private CloudwalkResult update(AddPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - this.commonPersonRegistryService.updatePersonRegistry(param, context); - this.commonPersonRegistryService.batchUpdatePersonRegistryProperty(param); - this.commonPersonRegistryService.batchUpdatePersonRegistryDevice(param, context, false); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @CloudwalkParamsValidate - public CloudwalkResult detail(QueryPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = param.getBusinessId(); - if (StringUtils.isBlank((CharSequence)businessId)) { - businessId = context.getCompany().getCompanyId(); - } - PersonRegistryResult result = new PersonRegistryResult(); - ImgStorePersonProperties queryPersonPro = new ImgStorePersonProperties(); - queryPersonPro.setBusinessId(businessId); - queryPersonPro.setStatus(StatusEnum.VALID.getValue()); - List personPropertyList = this.imgStorePersonPropertiesMapper.select(queryPersonPro); - if (CollectionUtils.isEmpty((Collection)personPropertyList)) { - this.logger.warn("不存在人员属性"); - return (CloudwalkResult) CloudwalkResult.fail($$$); - } - List proResultList = BeanCopyUtils.copy((Collection)personPropertyList, PersonPropertiesResult.class); - proResultList.forEach(propertyResult -> { - if (DefaultPropertyEnum.hasProperty((String)propertyResult.getCode())) { - propertyResult.setHasChecked(StatusEnum.CHECKED.getValue()); - propertyResult.setHasDisabled(StatusEnum.DISABLED.getValue()); - } - }); - proResultList = proResultList.stream().sorted(Comparator.comparing(PersonPropertiesResult::getOrderNum)).collect(Collectors.toList()); - result.setPropertyList(proResultList); - PersonRegistry dbPersonRegistry = this.commonPersonRegistryService.getByBusinessAndType(businessId, RegistryTypeEnum.SELF_REGISTRY.getValue()); - if (null != dbPersonRegistry) { - result = (PersonRegistryResult)BeanCopyUtils.copyProperties((Object)dbPersonRegistry, PersonRegistryResult.class); - result.setPropertyList(proResultList); - this.commonPersonRegistryService.setOrg(dbPersonRegistry, result); - this.commonPersonRegistryService.setLabel(dbPersonRegistry, result); - List dbPersonRegistryDeviceList = this.personRegistryDeviceMapper.select(dbPersonRegistry.getId(), null); - if (!CollectionUtils.isEmpty((Collection)dbPersonRegistryDeviceList)) { - CoreDeviceQueryParam coreDeviceQueryParam = new CoreDeviceQueryParam(); - coreDeviceQueryParam.setBusinessId(businessId); - coreDeviceQueryParam.setDeviceCodes(Collections3.extractToList((Collection)dbPersonRegistryDeviceList, (String)"deviceCode")); - CloudwalkResult deviceGetResult = this.atomicDeviceService.list(coreDeviceQueryParam, context); - if (!CollectionUtils.isEmpty((Collection)((Collection)deviceGetResult.getData()))) { - ArrayList deviceResultList = Lists.newArrayListWithCapacity((int)((List)deviceGetResult.getData()).size()); - ((List)deviceGetResult.getData()).forEach(device -> { - DeviceResult deviceResult = new DeviceResult(); - deviceResult.setDeviceCode(device.getDeviceCode()); - deviceResult.setDeviceName(device.getDeviceName()); - deviceResultList.add(deviceResult); - }); - result.setDeviceList((List)deviceResultList); - } - } - List dbPersonRegistryProList = this.personRegistryPropertiesMapper.select(dbPersonRegistry.getId(), null); - List personPropertyIdList = Collections3.extractToList((Collection)dbPersonRegistryProList, (String)"personPropertyId"); - result.getPropertyList().forEach(propertyResult -> { - if (personPropertyIdList.contains(propertyResult.getId())) { - propertyResult.setHasChecked(StatusEnum.CHECKED.getValue()); - } - }); - } - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @CloudwalkParamsValidate - public CloudwalkResult> getRegistryPropertyList(QueryPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = param.getBusinessId(); - if (StringUtils.isBlank((CharSequence)businessId)) { - businessId = context.getCompany().getCompanyId(); - } - PersonRegistry dbPersonRegistry = (PersonRegistry)this.commonPersonRegistryService.getResultByBusinessAndType(businessId, RegistryTypeEnum.SELF_REGISTRY.getValue()).getData(); - this.commonPersonRegistryService.validateDevice(param, dbPersonRegistry); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - @CloudwalkParamsValidate - public CloudwalkResult> getAuditPropertyList(QueryPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = param.getBusinessId(); - if (StringUtils.isBlank((CharSequence)businessId)) { - businessId = context.getCompany().getCompanyId(); - } - PersonRegistry dbPersonRegistry = (PersonRegistry)this.commonPersonRegistryService.getResultByBusinessAndType(businessId, RegistryTypeEnum.SELF_REGISTRY.getValue()).getData(); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - private List getPersonPropertyList(PersonRegistry personRegistry, boolean isChecked) { - List dbPersonRegistryProList = this.personRegistryPropertiesMapper.select(personRegistry.getId(), null); - List personProIdList = Collections3.extractToList((Collection)dbPersonRegistryProList, (String)"personPropertyId"); - ImgStorePersonProperties queryPersonPro = new ImgStorePersonProperties(); - queryPersonPro.setBusinessId(personRegistry.getBusinessId()); - queryPersonPro.setStatus(StatusEnum.VALID.getValue()); - List dbPersonProList = this.imgStorePersonPropertiesMapper.select(queryPersonPro); - List proResultList = BeanCopyUtils.copy((Collection)dbPersonProList, PersonPropertiesResult.class); - List defaultProList = BeanCopyUtils.copy((Collection)dbPersonProList, PersonPropertiesResult.class); - proResultList = proResultList.stream().filter(proResult -> personProIdList.contains(proResult.getId()) == isChecked).collect(Collectors.toList()); - defaultProList = defaultProList.stream().filter(proResult -> DefaultPropertyEnum.hasProperty((String)proResult.getCode())).collect(Collectors.toList()); - if (isChecked) { - proResultList.removeAll(defaultProList); - proResultList.addAll(defaultProList); - proResultList.forEach(proResult -> { - proResult.setHasChecked(StatusEnum.CHECKED.getValue()); - if (DefaultPropertyEnum.hasProperty((String)proResult.getCode())) { - proResult.setHasDisabled(StatusEnum.DISABLED.getValue()); - } - }); - } else { - proResultList.removeAll(defaultProList); - } - proResultList = proResultList.stream().sorted(Comparator.comparing(PersonPropertiesResult::getOrderNum)).collect(Collectors.toList()); - return proResultList; - } - - @CloudwalkParamsValidate - public CloudwalkResult getUniqueRegistryProperty(QueryPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - String businessId = param.getBusinessId(); - if (StringUtils.isBlank((CharSequence)businessId)) { - businessId = context.getCompany().getCompanyId(); - } - PersonRegistry dbPersonRegistry = (PersonRegistry)this.commonPersonRegistryService.getResultByBusinessAndType(businessId, RegistryTypeEnum.SELF_REGISTRY.getValue()).getData(); - List propertyList = this.getPersonPropertyList(dbPersonRegistry, true); - AtomicReference result = new AtomicReference(); - propertyList.stream().filter(property -> UniquePropertyEnum.hasProperty((String)property.getCode())).findFirst().ifPresent(personPropertiesResult -> result.set(personPropertiesResult)); - return (CloudwalkResult) CloudwalkResult.success($$$); - } - - public CloudwalkResult getBindProperty(QueryPersonRegistryParam param, CloudwalkCallContext context) throws ServiceException { - return null; - } -} - diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/common/AbstractImagStoreService.class b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/common/AbstractImagStoreService.class new file mode 100644 index 00000000..ec69f326 Binary files /dev/null and b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/common/AbstractImagStoreService.class differ diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/OrganizationServiceImpl.class b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/OrganizationServiceImpl.class new file mode 100644 index 00000000..0336e47e Binary files /dev/null and b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/OrganizationServiceImpl.class differ diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/feign/CrkAccessFeignClient.class b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/feign/CrkAccessFeignClient.class new file mode 100644 index 00000000..3b685a83 Binary files /dev/null and b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/feign/CrkAccessFeignClient.class differ diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/feign/ElevatorFeignClient.class b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/feign/ElevatorFeignClient.class new file mode 100644 index 00000000..9a5214a8 Binary files /dev/null and b/maven-ninca-common-component-organization/cwos-component-organization-service/target/classes/cn/cloudwalk/service/organization/service/feign/ElevatorFeignClient.class differ diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index e6ca2834..8d6e1e74 100644 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,2 +1,6 @@ +cn/cloudwalk/service/organization/service/feign/ElevatorFeignClient.class cn/cloudwalk/service/organization/common/FlushList.class +cn/cloudwalk/service/organization/service/feign/CrkAccessFeignClient.class +cn/cloudwalk/service/organization/service/OrganizationServiceImpl.class +cn/cloudwalk/service/organization/common/AbstractImagStoreService.class cn/cloudwalk/service/organization/common/FlushHandler.class diff --git a/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index a37bfb6c..a1611977 100644 --- a/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/maven-ninca-common-component-organization/cwos-component-organization-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -13,6 +13,7 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/schedule/DelayPersonValidateTask.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/PersonZoneRefServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/MessageCenterFeignClient.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/CrkAccessFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/ImageUtil.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStoreToolServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/CwosConst.java @@ -29,6 +30,7 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/PictureRevisionServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/schedule/PersonValidateTask.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonServiceImpl.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/VehicleFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/export/CommonAppExportExecuteTask.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CertRegistryHandler.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/utils/DateUtils.java @@ -38,13 +40,16 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/CommonDownloadDataConfig.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/UserFeignClient.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/DevicePersonSyncManager.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/MessageCenterFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/AreaServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonPropertiesServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/common/RequestAttributeHystrixConcurrencyStrategy.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/AbstractImagStoreService.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/CrkAccessFeignClient.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/FileUtil.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/DistrictFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/config/SaveSyncLogTaskExecutor.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/DeviceAppFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/task/CpImageStoreImageSyncTask.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/PersonAuditServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/AlarmAlarmDeviceManageServiceImpl.java @@ -57,6 +62,10 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/corp/handler/EnterpriseChangeHandler.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/Base64Utils.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/OrganizationUnitServiceImpl.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/PineappleEngineClientFallBack.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/UserFeignClientFallback.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/ImageStoreSyncClientFallback.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/ElevatorFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/FlushList.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/PersonRegistryServiceImpl.java @@ -72,6 +81,7 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/compare/NaturalOrderComparator.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonValidateManager.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/FileCompressUtil.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/SysLogFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/config/PersonImportTaskExecutor.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/export/CommonExRecordExcelByLabelCreater.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/FileContentType.java @@ -80,12 +90,9 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/ImageStoreSyncClient.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/common/AbstractFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/VehicleFeignClient.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/AreaTypeServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/listener/ComponentOrganizationEventListener.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStoreServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/PortalUserServiceImpl.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchServiceImpl.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/SelfRegistryHandler.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/ElevatorAppFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/ElevatorAppFeignClient.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/ByteUtil.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/export/CommonRecordExcelCreater.java @@ -96,15 +103,13 @@ /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonManager.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/FlushHandler.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpImageStorePersonSynManager.java +/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/corp/feign/EnterpriseFeignClientFallback.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/FolderUtil.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/ElevatorFeignClient.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/ImageEditUtils.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/ImgPersonBatchDetailServiceImpl.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/OrganizationTypeServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/export/CommonAppExportFileHandler.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/feign/DeviceAppFeignClient.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/schedule/BatchImportContext.java -/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/service/CpDeviceImagePersonServiceImpl.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/config/ChannelFileReader.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/common/PathUtils.java /media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/源码/maven-ninca-common-component-organization/cwos-component-organization-service/src/main/java/cn/cloudwalk/service/organization/task/DeviceNotificationTask.java