Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi into 1.0
# Conflicts:
# xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/SysUserController.java
# xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/model/query/XpOperationsUserPageQuery.java
# xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysLoginService.java
# xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysUserServiceImpl.java
# xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java
# xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpQualificationAuditServiceImpl.java
# xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpTaskController.java
# xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpElectronicFenceManagementController.java
# xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpCouponController.java
# xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpInvitationCodeController.java
# xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpPricingController.java
# xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpWhitelistController.java
# xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpWhitelistServiceImpl.java
# xp-robotaxi-operation-boot/src/main/resources/mapper/operation/XpWhitelistMapper.xml
# xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/controller/XpFleetController.java
# xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/controller/XpVehicleController.java
# xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/service/impl/XpVehicleServiceImpl.java
| | |
| | | INDEX `idx_number`(`point_number` ASC) USING BTREE COMMENT '唯一ID' |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '点位管理' ROW_FORMAT = Dynamic; |
| | | |
| | | SET FOREIGN_KEY_CHECKS=1; |
| | | CREATE TABLE IF NOT EXISTS `xp_admin_operation_log` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'primary key', |
| | | `business_type` tinyint NOT NULL COMMENT 'business type', |
| | | `business_type_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'business type name', |
| | | `operator_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'operator name', |
| | | `operator_account` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'operator account', |
| | | `operator_account_id` bigint NULL DEFAULT NULL COMMENT 'operator account id', |
| | | `operation_type` tinyint NOT NULL COMMENT 'operation type', |
| | | `operation_type_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'operation type name', |
| | | `operation_content` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'operation content', |
| | | `operation_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'operation ip', |
| | | `request_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'request uri', |
| | | `request_method` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'request method', |
| | | `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'interface method', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT 'status: 0 success, 1 failed', |
| | | `error_msg` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'error message', |
| | | `operation_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'operation time', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | INDEX `idx_business_type` (`business_type`) USING BTREE, |
| | | INDEX `idx_operation_type` (`operation_type`) USING BTREE, |
| | | INDEX `idx_operator_account` (`operator_account`) USING BTREE, |
| | | INDEX `idx_operation_time` (`operation_time`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'admin operation log' ROW_FORMAT = Dynamic; |
| | | |
| | | SET FOREIGN_KEY_CHECKS=1; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * 用户信息 |
| | |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getId()); |
| | | SysUser sysUser = null; |
| | | if (StringUtils.isNotEmpty(user.getPhoneNumber())) { |
| | | sysUser = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | | .in(SysUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(user.getPhoneNumber())) |
| | | .last("LIMIT 1")); |
| | | } |
| | | SysUser sysUser = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | | .in(SysUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(user.getPhoneNumber())) |
| | | .last("LIMIT 1")); |
| | | |
| | | if (StringUtils.isNotEmpty(user.getPhoneNumber()) && (Objects.nonNull(sysUser) && !user.getId().equals(sysUser.getId()) )) { |
| | | throw new ServiceException("手机号已开通账号", I18nKeyConstant.ACCOUNT_PHONE_DUPLICATE); |
| | |
| | | return R.ok(java.util.Collections.emptyList()); |
| | | } |
| | | List<SysUser> list = userService.list(Wrappers.lambdaQuery(SysUser.class) |
| | | .in(SysUser::getPhoneNumber, phoneQueryValues)); |
| | | list.forEach(user -> user.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(user.getPhoneNumber()))); |
| | | .in(SysUser::getPhoneNumber, buildPhoneQueryValues(phoneList))); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | return R.ok(user); |
| | | } |
| | | |
| | | private List<String> buildPhoneQueryValues(List<String> phoneList) { |
| | | if (phoneList == null) { |
| | | return java.util.Collections.emptyList(); |
| | | } |
| | | return phoneList.stream() |
| | | .filter(StringUtils::isNotBlank) |
| | | .flatMap(phone -> SensitiveDataCryptoUtil.queryValues(phone).stream()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过账号查询用户 |
| | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | return userInfo; |
| | | } |
| | | |
| | | |
| | | public void logout(String loginName, HttpServletRequest request) { |
| | | recordLogService.recordLogininfor(request, null, loginName, Constants.LOGIN_SUCCESS_STATUS, "退出成功"); |
| | | } |
| | |
| | | throw new ServiceException("用户/验证码必须填写"); |
| | | } |
| | | // 查询运维用户信息 |
| | | XpOperationsUser operationsUser = operationsUserService.lambdaQuery().in( |
| | | XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(phoneNumber) |
| | | ).last("limit 1").one(); |
| | | XpOperationsUser operationsUser = operationsUserService.lambdaQuery() |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(phoneNumber)) |
| | | .last("limit 1").one(); |
| | |
| | | throw new ServiceException("用户/验证码必须填写"); |
| | | } |
| | | // 查询运维用户信息 |
| | | XpOperationsUser operationsUser = operationsUserService.lambdaQuery().in( |
| | | XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(phoneNumber) |
| | | ).last("limit 1").one(); |
| | | XpOperationsUser operationsUser = operationsUserService.lambdaQuery() |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(phoneNumber)) |
| | | .last("limit 1").one(); |
| | |
| | | return loginOperationUser; |
| | | } |
| | | |
| | | |
| | | public Boolean verificationCodeUpdate(UpdatePasswordDTO updatePasswordDTO, HttpServletRequest request) { |
| | | public Boolean verificationCodeUpdate(UpdatePasswordDTO updatePasswordDTO, HttpServletRequest request) { |
| | | String phoneNumber = updatePasswordDTO.getPhoneNumber(); |
| | | String code = updatePasswordDTO.getVerificationCode(); |
| | | phoneNumber = phoneNumber.trim(); |
| | | // 查询运维用户信息 |
| | | XpOperationsUser operationsUser = operationsUserService.lambdaQuery().in( |
| | | XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(phoneNumber) |
| | | ).last("limit 1").one(); |
| | | if (StringUtils.isNull(operationsUser)) { |
| | | throw new ServiceException("验证码错误!"); |
| | | } |
| | | if (!operationsUser.getStatus()){ |
| | | throw new ServiceException("账号已禁用!"); |
| | | } |
| | | if (StringUtils.isAnyBlank(phoneNumber, code)) { |
| | | throw new ServiceException("用户/验证码必须填写"); |
| | | } |
| | |
| | | package com.xiaopeng.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkPhoneUnique(SysUser user) { |
| | | Long userId = StringUtils.isNull(user.getId()) ? -1L : user.getId(); |
| | | SysUser info = lambdaQuery() |
| | | .in(SysUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(user.getPhoneNumber())) |
| | | .last("limit 1") |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public int updateUser(SysUser user) { |
| | | encryptPhone(user); |
| | |
| | | import com.xiaopeng.api.model.account.XpQualificationAudit; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.query.account.OptionalUsersPageListQuery; |
| | | import com.xiaopeng.api.query.account.OptionalUsersPageListQuery; |
| | | import com.xiaopeng.api.vo.account.*; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.Serializable; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.Serializable; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @Override |
| | | public PageInfo<XpOperationsUserWithRoleVO> selectUserPageByConditions(XpOperationsUserPageQuery query) { |
| | | query.setPhoneNumberQueryValues(SensitiveDataCryptoUtil.queryValues(query.getPhoneNumber())); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | query.setPhoneNumberQueryValues(SensitiveDataCryptoUtil.queryValues(query.getPhoneNumber())); |
| | | PageInfo<XpOperationsUserWithRoleVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | Page<XpOperationsUserWithRoleVO> page = baseMapper.selectUserPageByConditions(pageInfo, query); |
| | | decryptWithRolePhones(page.getRecords()); |
| | | decryptWithRolePhones(page.getRecords()); |
| | | if(!loginUser.getPhoneDesensitizationExempt()){ |
| | | for (XpOperationsUserWithRoleVO record : page.getRecords()) { |
| | |
| | | |
| | | @Override |
| | | public PageInfo<XpOperationsUserVO> pageList(XpOperationsUserQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | query.setPhoneNumberQueryValues(SensitiveDataCryptoUtil.queryValues(query.getPhoneNumber())); |
| | | PageInfo<XpOperationsUserVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<XpOperationsUserVO> list = this.baseMapper.pageList(pageInfo, query); |
| | |
| | | |
| | | @Override |
| | | public R<String> addOperationsUser(XpOperationsUserAddDTO dto) { |
| | | if (StringUtils.isNotBlank(dto.getPhoneNumber())) { |
| | | long userCount = this.count(Wrappers.lambdaQuery(XpOperationsUser.class) |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(dto.getPhoneNumber()))); |
| | | if (userCount > 0) { |
| | | throw new ServiceException("登录账号重复", I18nKeyConstant.ACCOUNT_DUPLICATE); |
| | | } |
| | | long userCount = StringUtils.isBlank(dto.getPhoneNumber()) ? 0 : this.count(Wrappers.lambdaQuery(XpOperationsUser.class) |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(dto.getPhoneNumber()))); |
| | | if (StringUtils.isNotBlank(dto.getPhoneNumber()) && userCount>0) { |
| | | throw new ServiceException("登录账号重复", I18nKeyConstant.ACCOUNT_DUPLICATE); |
| | | } |
| | | //校验编号是否唯一 |
| | | long numberCount = this.count(Wrappers.lambdaQuery(XpOperationsUser.class) |
| | |
| | | |
| | | @Override |
| | | public R<String> editOperationsUser(XpOperationsUserAddDTO dto) { |
| | | if (StringUtils.isNotBlank(dto.getPhoneNumber())) { |
| | | XpOperationsUser operationsUser = this.getOne(Wrappers.lambdaQuery(XpOperationsUser.class) |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(dto.getPhoneNumber())) |
| | | .last("LIMIT 1")); |
| | | if (Objects.nonNull(operationsUser) && !dto.getId().equals(operationsUser.getId())) { |
| | | throw new ServiceException("手机号已开通账号", I18nKeyConstant.ACCOUNT_PHONE_DUPLICATE); |
| | | } |
| | | XpOperationsUser operationsUser = StringUtils.isBlank(dto.getPhoneNumber()) ? null : this.getOne(Wrappers.lambdaQuery(XpOperationsUser.class) |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(dto.getPhoneNumber())) |
| | | .last("LIMIT 1")); |
| | | |
| | | if (StringUtils.isNotBlank(dto.getPhoneNumber()) && (Objects.nonNull(operationsUser) && !dto.getId().equals(operationsUser.getId()) )) { |
| | | throw new ServiceException("手机号已开通账号", I18nKeyConstant.ACCOUNT_PHONE_DUPLICATE); |
| | | } |
| | | if (dto.getPassword() != null && !dto.getPassword().isEmpty()) { |
| | | dto.setPassword(null); |
| | |
| | | |
| | | @Override |
| | | public PageInfo<XpQualificationAuditVO> pageList(XpQualificationAuditQuery query) throws UnsupportedEncodingException { |
| | | query.setPhoneNumberQueryValues(SensitiveDataCryptoUtil.queryValues(query.getPhoneNumber())); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | query.setPhoneNumberQueryValues(SensitiveDataCryptoUtil.queryValues(query.getPhoneNumber())); |
| | | PageInfo<XpQualificationAuditVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | |
| | | for (XpQualificationAuditVO xpQualificationAuditVO : list) { |
| | | xpQualificationAuditVO.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(xpQualificationAuditVO.getPhoneNumber())); |
| | | xpQualificationAuditVO.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(xpQualificationAuditVO.getPhoneNumber())); |
| | | if(!loginUser.getPhoneDesensitizationExempt()){ |
| | | xpQualificationAuditVO.setPhoneNumber(DesensitizedUtil.mobilePhone(xpQualificationAuditVO.getPhoneNumber())); |
| | | } |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * @author MiTao |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | |
| | | int time = 10*60*1000; |
| | | Long oneMinuteAgo = System.currentTimeMillis() - time; |
| | | query.addCriteria(Criteria.where("updateTime").gte(oneMinuteAgo)); |
| | | |
| | | |
| | | List<XpOperationsUserPositionDTO> vehiclePositions = mongoTemplate.find(query, XpOperationsUserPositionDTO.class); |
| | | if(CollUtil.isEmpty(vehiclePositions)){ |
| | | throw new ServiceException("未查询到运维人员"); |
| | |
| | | // 将查询结果转换为 Map,key 为 userId,value 为 XpFleetOperations 对象 |
| | | Map<Long, XpFleetOperations> fleetOperationsMap = findListByUserIdsR.getData().stream() |
| | | .collect(Collectors.toMap(XpFleetOperations::getOperationsUserId, Function.identity())); |
| | | |
| | | |
| | | for (XpOperationsUserWithRoleVO record : ret.getRecords()) { |
| | | if(fleetOperationsMap.containsKey(record.getId())){ |
| | | record.setFleetName(fleetOperationsMap.get(record.getId()).getFleetName()); |
| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.ArrayList; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.xiaopeng.map.service.serviceimpl.XpElectronicFenceServiceImpl.getPinyinInitials; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | content = "新增电子围栏", |
| | | appendRequestData = true |
| | | ) |
| | | public R add(@Valid @RequestBody ElectronicFenceAddDto dto) { |
| | | public R add(@Validated @RequestBody ElectronicFenceAddDto dto) { |
| | | validateFenceTime(dto.getStatus(), dto.getEffectType(), dto.getEffectTime(), dto.getFailureType(), dto.getFailureTime()); |
| | | return xpElectronicFenceService.addElectronic(dto); |
| | | } |
| | |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | |
| | | @Slf4j |
| | |
| | | ) |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑正式点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R edit(@Validated @RequestBody PointUpdateDto pointAddDto) { |
| | | XpPoint xpPoint = xpPointService.getById(pointAddDto.getId()); |
| | | if (xpPoint == null) { |
| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * App版本管理 Controller |
| | |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.regex.Pattern; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | content = "生成邀请码", |
| | | appendRequestData = true |
| | | ) |
| | | public R add(@RequestBody InvitationAddDto dto) { |
| | | public R add(@RequestBody InvitationAddDto dto){ |
| | | long existing = xpInvitationCodeService.count(); |
| | | long incoming = Arrays.stream(Optional.ofNullable(dto.getPhones()).orElse("").split(",")) |
| | | .map(String::trim) |
| | |
| | | @PutMapping("/api/v1/invitation/unbind") |
| | | @ResponseBody |
| | | @ApiOperation(value = "解绑") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "id", name = "id", dataType = "Long", required = true) |
| | | }) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.INVITATION_CODE_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | contentExpression = "'解绑邀请码,id=' + #p0", |
| | | appendRequestData = false |
| | | ) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "id", name = "id", dataType = "Long", required = true) |
| | | }) |
| | | public R unbind(@RequestParam("id") Long id) { |
| | | public R unbind(@RequestParam("id") Long id){ |
| | | UpdateWrapper<XpInvitationCode> xpInvitationCodeUpdateWrapper = new UpdateWrapper<>(); |
| | | xpInvitationCodeUpdateWrapper.eq("id", id); |
| | | xpInvitationCodeUpdateWrapper.set("status", 3); |
| | |
| | | contentExpression = "'批量删除邀请码,ids=' + #p0", |
| | | appendRequestData = false |
| | | ) |
| | | public R deleteByIds(String ids) { |
| | | public R deleteByIds(String ids){ |
| | | // 再转化为Long类型 |
| | | List<Long> longs = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList()); |
| | | xpInvitationCodeService.removeBatchByIds(longs); |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | appendRequestData = true |
| | | ) |
| | | @PostMapping("/api/v1/routePlan/add") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ROUTE_PLAN_MANAGEMENT, |
| | | operationType = AdminOperationType.ADD, |
| | | content = "新增路线规划配置", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> add(@Validated @RequestBody RoutePlanAddDTO dto) { |
| | | routePlanService.add(dto); |
| | | return R.ok(); |
| | |
| | | appendRequestData = true |
| | | ) |
| | | @PostMapping("/api/v1/routePlan/edit") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ROUTE_PLAN_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑路线规划配置", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> edit(@Validated @RequestBody RoutePlanEditDTO dto) { |
| | | routePlanService.edit(dto); |
| | | return R.ok(); |
| | |
| | | contentExpression = "'删除路线规划配置,id=' + #p0" |
| | | ) |
| | | @DeleteMapping("/api/v1/routePlan/deleteById/{id}") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ROUTE_PLAN_MANAGEMENT, |
| | | operationType = AdminOperationType.DELETE, |
| | | contentExpression = "'删除路线规划配置,id=' + #p0" |
| | | ) |
| | | public R<?> deleteById(@ApiParam(name = "id", value = "线路ID") @PathVariable Long id) { |
| | | routePlanService.deleteById(id); |
| | | return R.ok(); |
| | |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return value.substring(0, maxLength); |
| | | } |
| | | |
| | | private static List<String> buildAccountQueryValues(Collection<String> accounts) { |
| | | Set<String> values = new LinkedHashSet<>(); |
| | | if (accounts == null) { |
| | | return new ArrayList<>(); |
| | | private static List<String> buildAccountQueryValues(Set<String> accounts) { |
| | | if (CollectionUtils.isEmpty(accounts)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | for (String account : accounts) { |
| | | if (StringUtils.hasLength(account)) { |
| | | values.addAll(SensitiveDataCryptoUtil.queryValues(account)); |
| | | } |
| | | } |
| | | return new ArrayList<>(values); |
| | | return accounts.stream() |
| | | .filter(StringUtils::hasLength) |
| | | .flatMap(account -> SensitiveDataCryptoUtil.queryValues(account).stream()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @ApiOperation(value = "白名单导出") |
| | |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "白名单账号查询值,包含明文兼容值和密文值") |
| | | private List<String> accountQueryValues; |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.util.PhoneUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.dto.account.UcUserInfo; |
| | | import com.xiaopeng.api.feignClient.account.UserResourcesClient; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | |
| | | .list() |
| | | .stream() |
| | | .map(XpWhitelist::getAccount) |
| | | .map(SensitiveDataCryptoUtil::decryptIfPossible) |
| | | .filter(StringUtils::hasLength) |
| | | .collect(Collectors.toSet()); |
| | | existsAccounts = existsStoredAccounts.stream() |
| | |
| | | } |
| | | } |
| | | |
| | | private void decryptWhitelistAccounts(Collection<XpWhitelist> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | private static void decryptWhitelistAccounts(Collection<XpWhitelist> list) { |
| | | if (list == null) { |
| | | return; |
| | | } |
| | | for (XpWhitelist item : list) { |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * @author MiTao |
| | |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | .collect(java.util.stream.Collectors.toSet()); |
| | | existsVins = xpVehicleService.lambdaQuery() |
| | | .select(XpVehicle::getVehicleVin) |
| | | .in(XpVehicle::getVehicleVin, vinQueryValues) |
| | | .in(XpVehicle::getVehicleVin, buildVinQueryValues(vinSet)) |
| | | .list() |
| | | .stream() |
| | | .map(XpVehicle::getVehicleVin) |
| | |
| | | } |
| | | } |
| | | return duplicated; |
| | | } |
| | | |
| | | private static List<String> buildVinQueryValues(Iterable<String> vins) { |
| | | if (vins == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<String> values = new ArrayList<>(); |
| | | for (String vin : vins) { |
| | | values.addAll(SensitiveDataCryptoUtil.queryValues(vin)); |
| | | } |
| | | return values.stream().distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | private void uploadVehiclePicture(List<XpVehicleImportExcel> importList) { |
| | |
| | | */ |
| | | @PostMapping("/logan/inner/vehicle/queryVehiclePositionByVin") |
| | | public R<List<String>> queryVehiclePositionByVin(@RequestBody VehiclePositionByVinDto dto){ |
| | | if (dto == null) { |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<String> vinQueryValues = buildVinQueryValues(dto.getVinList()); |
| | | if (vinQueryValues.isEmpty()) { |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<XpVehicle> list = xpVehicleService.list(new LambdaQueryWrapper<XpVehicle>().eq(XpVehicle::getState, Optional.ofNullable(dto.getStatus()).orElse(0)) |
| | | .eq(XpVehicle::getOperatingStatus, 1).eq(XpVehicle::getElectronicId, dto.getFenceId()).in(XpVehicle::getVehicleVin, vinQueryValues)); |
| | | .eq(XpVehicle::getOperatingStatus, 1).eq(XpVehicle::getElectronicId, dto.getFenceId()).in(XpVehicle::getVehicleVin, buildVinQueryValues(dto.getVinList())))); |
| | | if (list.isEmpty()) { |
| | | return R.ok(new ArrayList<>()); |
| | | } else { |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/logan/inner/vehicle/findByVehicleVin") |
| | | public R<XpVehicle> findByVehicleVin(@RequestParam("vehicleVin") String vehicleVin) { |
| | | if (StringUtils.isBlank(vehicleVin)) { |
| | | return R.ok(); |
| | | } |
| | | public R<XpVehicle> findByVehicleVin(@RequestParam("vehicleVin") String vehicleVin){ |
| | | XpVehicle xpVehicle = xpVehicleService.getOne(new LambdaQueryWrapper<XpVehicle>().in(XpVehicle::getVehicleVin, SensitiveDataCryptoUtil.queryValues(vehicleVin))); |
| | | if (xpVehicle == null) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 获取车队 |
| | | XpFleetVehicle xpFleetVehicle = vehicleService.getOne(new LambdaQueryWrapper<XpFleetVehicle>().eq(XpFleetVehicle::getVehicleId, xpVehicle.getId())); |
| | | if(null == xpFleetVehicle){ |
| | | return R.fail("车队信息获取失败"); |
| | | if (Objects.nonNull(xpVehicle)) { |
| | | XpFleetVehicle xpFleetVehicle = vehicleService.getOne(new LambdaQueryWrapper<XpFleetVehicle>().eq(XpFleetVehicle::getVehicleId, xpVehicle.getId())); |
| | | if (Objects.nonNull(xpFleetVehicle)) { |
| | | xpVehicle.setFleetId(xpFleetVehicle.getFleetId()); |
| | | } |
| | | } |
| | | xpVehicle.setFleetId(xpFleetVehicle.getFleetId()); |
| | | return R.ok(xpVehicle); |
| | | } |
| | | |
| | |
| | | * @param updateVehicleStateDto |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/vi/vehicle/updateVehicleStatus") |
| | | public R<?> testUpdateVehicleStatus(@RequestBody UpdateVehicleStateDto updateVehicleStateDto) { |
| | | if (StringUtils.isBlank(updateVehicleStateDto.getVin())) { |
| | | return R.ok(); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | |
| | | //绑定XPUID |
| | | String vin = xpVehicle.getVehicleVin(); |
| | | R<String> xpuIdByVin = xpuVinClient.getXpuIdByVin(vin); |
| | | if(200 != xpuIdByVin.getCode()) { |
| | | throw new ServiceException(xpuIdByVin.getMsg()); |
| | | } |
| | | if (200 != xpuIdByVin.getCode()) { |
| | | throw new RuntimeException(xpuIdByVin.getMsg()); |
| | | } |
| | | String xpuid = xpuIdByVin.getData(); |
| | | xpVehicle.setXpuId(xpuid); |
| | | } |
| | | //绑定XPUID |
| | | String vin = xpVehicle.getVehicleVin(); |
| | | String encryptVin = SensitiveDataCryptoUtil.encrypt(vin); |
| | | xpVehicle.setVehicleVin(encryptVin); |
| | | xpVehicle.setOfficialPartnerId(officialPartnerId); |
| | | this.save(xpVehicle); |
| | | |
| | |
| | | } else { |
| | | xpVehicle.setXpuId(existingVehicle.getXpuId()); |
| | | } |
| | | |
| | | String encryptVin = SensitiveDataCryptoUtil.encrypt(xpVehicle.getVehicleVin()); |
| | | xpVehicle.setVehicleVin(encryptVin); |
| | | this.updateById(xpVehicle); |
| | | |
| | | // ADC推送:围栏绑定变更时触发单车推送 |
| | |
| | | vehicles.forEach(this::decryptVehicle); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public XpVehicle getById(Serializable id) { |
| | | XpVehicle vehicle = super.getById(id); |
| | | decryptVehicle(vehicle); |
| | | return vehicle; |
| | | } |
| | | |
| | | @Override |
| | | public boolean save(XpVehicle entity) { |
| | | encryptVehicle(entity); |
| | | try { |
| | | return super.save(entity); |
| | | } finally { |
| | | decryptVehicle(entity); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveBatch(Collection<XpVehicle> entityList) { |
| | | if (entityList != null) { |
| | | entityList.forEach(this::encryptVehicle); |
| | | } |
| | | try { |
| | | return super.saveBatch(entityList); |
| | | } finally { |
| | | decryptVehicles(entityList); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateById(XpVehicle entity) { |
| | | encryptVehicle(entity); |
| | | try { |
| | | return super.updateById(entity); |
| | | } finally { |
| | | decryptVehicle(entity); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<XpVehicle> list() { |
| | | List<XpVehicle> list = super.list(); |
| | | decryptVehicles(list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<XpVehicle> list(Wrapper<XpVehicle> queryWrapper) { |
| | | List<XpVehicle> list = super.list(queryWrapper); |
| | | decryptVehicles(list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public XpVehicle getOne(Wrapper<XpVehicle> queryWrapper) { |
| | | XpVehicle vehicle = super.getOne(queryWrapper); |
| | | decryptVehicle(vehicle); |
| | | return vehicle; |
| | | } |
| | | |
| | | private void encryptVehicle(XpVehicle vehicle) { |
| | | if (vehicle != null) { |
| | | vehicle.setVehicleVin(SensitiveDataCryptoUtil.encrypt(vehicle.getVehicleVin())); |
| | | } |
| | | } |
| | | |
| | | private void decryptVehicle(XpVehicle vehicle) { |
| | | if (vehicle != null) { |
| | | vehicle.setVehicleVin(SensitiveDataCryptoUtil.decryptIfPossible(vehicle.getVehicleVin())); |
| | | } |
| | | } |
| | | |
| | | private void decryptVehicles(Collection<? extends XpVehicle> vehicles) { |
| | | if (vehicles != null) { |
| | | vehicles.forEach(this::decryptVehicle); |
| | | } |
| | | } |
| | | } |