- 新增物流预览和快递问题相关的实体类、Mapper、Service和Controller - 实现物流预览列表查询、导出、详情获取、新增、修改和删除功能 - 实现快递问题列表查询、详情获取、新增、修改和删除功能 - 添加百世、顺丰、申通快递的路由查询工具类 - 更新pom.xml,添加fastjson2等依赖 - 修改application-stage.yml,禁用xxl-job
151 lines
4.8 KiB
Java
151 lines
4.8 KiB
Java
package com.klp.service.impl;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
import com.klp.common.helper.LoginHelper;
|
|
import com.klp.common.utils.StringUtils;
|
|
import com.klp.domain.WmsExpressQuestion;
|
|
import com.klp.domain.bo.WmsExpressQuestionBo;
|
|
import com.klp.domain.vo.WmsExpressQuestionVo;
|
|
import com.klp.mapper.WmsExpressQuestionMapper;
|
|
import com.klp.service.IWmsExpressQuestionService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 快递问题Service业务层处理
|
|
*
|
|
* @author hdka
|
|
* @date 2025-07-21
|
|
*/
|
|
@RequiredArgsConstructor
|
|
@Service
|
|
public class WmsExpressQuestionServiceImpl implements IWmsExpressQuestionService {
|
|
|
|
private final WmsExpressQuestionMapper baseMapper;
|
|
|
|
/**
|
|
* 查询快递问题
|
|
*/
|
|
@Override
|
|
public WmsExpressQuestionVo queryById(Long questionId){
|
|
return baseMapper.selectVoById(questionId);
|
|
}
|
|
|
|
/**
|
|
* 查询快递问题列表
|
|
*/
|
|
@Override
|
|
public TableDataInfo<WmsExpressQuestionVo> queryPageList(WmsExpressQuestionBo bo, PageQuery pageQuery) {
|
|
QueryWrapper<WmsExpressQuestion> lqw = buildQueryWrapperPlus(bo);
|
|
Page<WmsExpressQuestionVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
|
return TableDataInfo.build(result);
|
|
}
|
|
|
|
/**
|
|
* 查询快递问题列表
|
|
*/
|
|
@Override
|
|
public List<WmsExpressQuestionVo> queryList(WmsExpressQuestionBo bo) {
|
|
LambdaQueryWrapper<WmsExpressQuestion> lqw = buildQueryWrapper(bo);
|
|
return baseMapper.selectVoList(lqw);
|
|
}
|
|
private LambdaQueryWrapper<WmsExpressQuestion> buildQueryWrapper(WmsExpressQuestionBo bo) {
|
|
Map<String, Object> params = bo.getParams();
|
|
LambdaQueryWrapper<WmsExpressQuestion> lqw = new LambdaQueryWrapper<>();
|
|
|
|
if (bo.getExpressId() != null) {
|
|
lqw.eq(WmsExpressQuestion::getExpressId, bo.getExpressId());
|
|
}
|
|
if (StringUtils.isNotBlank(bo.getDescription())) {
|
|
lqw.eq(WmsExpressQuestion::getDescription, bo.getDescription());
|
|
}
|
|
if (bo.getReportTime() != null) {
|
|
lqw.eq(WmsExpressQuestion::getReportTime, bo.getReportTime());
|
|
}
|
|
if (StringUtils.isNotBlank(bo.getReportBy())) {
|
|
lqw.eq(WmsExpressQuestion::getReportBy, bo.getReportBy());
|
|
}
|
|
if (bo.getStatus() != null) {
|
|
lqw.eq(WmsExpressQuestion::getStatus, bo.getStatus());
|
|
}
|
|
return lqw;
|
|
}
|
|
|
|
private QueryWrapper<WmsExpressQuestion> buildQueryWrapperPlus(WmsExpressQuestionBo bo) {
|
|
Map<String, Object> params = bo.getParams();
|
|
QueryWrapper<WmsExpressQuestion> qw = new QueryWrapper<>();
|
|
// 设置表别名
|
|
if (bo.getExpressId() != null) {
|
|
qw.eq("oeq.express_id", bo.getExpressId());
|
|
}
|
|
if (StringUtils.isNotBlank(bo.getDescription())) {
|
|
qw.eq("oeq.description", bo.getDescription());
|
|
}
|
|
if (bo.getReportTime() != null) {
|
|
qw.eq("oeq.report_time", bo.getReportTime());
|
|
}
|
|
if (StringUtils.isNotBlank(bo.getReportBy())) {
|
|
qw.eq("oeq.report_by", bo.getReportBy());
|
|
}
|
|
if (bo.getStatus() != null) {
|
|
qw.eq("oeq.status", bo.getStatus());
|
|
}
|
|
// 逻辑删除
|
|
qw.eq("oeq.del_flag", 0);
|
|
|
|
return qw;
|
|
}
|
|
|
|
/**
|
|
* 新增快递问题
|
|
*/
|
|
@Override
|
|
public Boolean insertByBo(WmsExpressQuestionBo bo) {
|
|
WmsExpressQuestion add = BeanUtil.toBean(bo, WmsExpressQuestion.class);
|
|
validEntityBeforeSave(add);
|
|
add.setReportBy(LoginHelper.getNickName());
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
if (flag) {
|
|
bo.setQuestionId(add.getQuestionId());
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
/**
|
|
* 修改快递问题
|
|
*/
|
|
@Override
|
|
public Boolean updateByBo(WmsExpressQuestionBo bo) {
|
|
WmsExpressQuestion update = BeanUtil.toBean(bo, WmsExpressQuestion.class);
|
|
validEntityBeforeSave(update);
|
|
return baseMapper.updateById(update) > 0;
|
|
}
|
|
|
|
/**
|
|
* 保存前的数据校验
|
|
*/
|
|
private void validEntityBeforeSave(WmsExpressQuestion entity){
|
|
//TODO 做一些数据校验,如唯一约束
|
|
}
|
|
|
|
/**
|
|
* 批量删除快递问题
|
|
*/
|
|
@Override
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
if(isValid){
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
}
|
|
return baseMapper.deleteBatchIds(ids) > 0;
|
|
}
|
|
}
|