refactor: 优化设备类型服务实现并增强日志

This commit is contained in:
曹鹏飞 2025-12-01 10:56:05 +08:00
parent cc53fb1b68
commit de13d0881f
2 changed files with 19 additions and 8 deletions

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.common.pojo.request; package com.nflg.mobilebroken.common.pojo.request;
import cn.hutool.core.util.StrUtil;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@ -28,6 +29,13 @@ public class TicketCallHangUpRequest {
@NotNull @NotNull
private Integer fromUserId; private Integer fromUserId;
public Integer getFromUserId() {
if (fromUserId < 2000000) {
return fromUserId;
}
return Integer.valueOf(StrUtil.removePrefix(String.valueOf(fromUserId).substring(1), "0"));
}
/** /**
* 是否拒绝接听 * 是否拒绝接听
*/ */

View File

@ -9,9 +9,11 @@ import com.nflg.mobilebroken.common.pojo.vo.CqmPersonVO;
import com.nflg.mobilebroken.repository.entity.TBaseDeviceType; import com.nflg.mobilebroken.repository.entity.TBaseDeviceType;
import com.nflg.mobilebroken.repository.mapper.TBaseDeviceTypeMapper; import com.nflg.mobilebroken.repository.mapper.TBaseDeviceTypeMapper;
import com.nflg.mobilebroken.repository.service.ITBaseDeviceTypeService; import com.nflg.mobilebroken.repository.service.ITBaseDeviceTypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -19,37 +21,38 @@ import java.util.stream.Collectors;
* <p> * <p>
* 设备类型 服务实现类 * 设备类型 服务实现类
* </p> * </p>
*
* @author 曹鹏飞 * @author 曹鹏飞
* @since 2025-01-24 * @since 2025-01-24
*/ */
@Slf4j
@Service @Service
public class TBaseDeviceTypeServiceImpl extends ServiceImpl<TBaseDeviceTypeMapper, TBaseDeviceType> implements ITBaseDeviceTypeService { public class TBaseDeviceTypeServiceImpl extends ServiceImpl<TBaseDeviceTypeMapper, TBaseDeviceType> implements ITBaseDeviceTypeService {
@Override @Override
public Page<TBaseDeviceType> getList(Page<PageBaseQuery> page, PageBaseQuery query) { public Page<TBaseDeviceType> getList(Page<PageBaseQuery> page, PageBaseQuery query) {
return this.getBaseMapper().getList(page, query); return this.getBaseMapper().getList(page, query);
} }
public List<String> getDistinctDeviceType(){ public List<String> getDistinctDeviceType() {
return this.getBaseMapper().getDistinctDeviceType(); return this.getBaseMapper().getDistinctDeviceType();
} }
public List<CqmPersonVO> getCqmPersonList(@Param("cqms") List<String> cqms){ public List<CqmPersonVO> getCqmPersonList(@Param("cqms") List<String> cqms) {
return this.getBaseMapper().getCqmPersonList(cqms); return this.getBaseMapper().getCqmPersonList(cqms);
} }
@Override @Override
public List<Integer> getCqmsByDeviceType(String deviceNo) { public List<Integer> getCqmsByDeviceType(String deviceNo) {
String cqms=this.getBaseMapper().getCqmsByDeviceType(deviceNo); String cqms = this.getBaseMapper().getCqmsByDeviceType(deviceNo);
if (StrUtil.isBlank(cqms)){ if (StrUtil.isBlank(cqms)) {
return null; log.warn("设备{}未设置CQM", deviceNo);
return Collections.emptyList();
} }
return StrUtil.split(cqms, ",").stream().map(Integer::parseInt).collect(Collectors.toList()); return StrUtil.split(cqms, ",").stream().map(Integer::parseInt).collect(Collectors.toList());
} }
public List<CqmPersionResultVO> getDeviceTypeCqmList(@Param("ids") List<Integer> ids){ public List<CqmPersionResultVO> getDeviceTypeCqmList(@Param("ids") List<Integer> ids) {
return this.getBaseMapper().getDeviceTypeCqmList(ids); return this.getBaseMapper().getDeviceTypeCqmList(ids);
} }
} }