更新代码
This commit is contained in:
parent
8c430cae91
commit
a4462afdac
@ -29,6 +29,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -193,7 +194,7 @@ public class CompanyController {
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
// 这里可能出现查不到的情况,直接抛个系统错误先,不能影响后续操作
|
||||
if (ObjectUtil.isEmpty(dept)){
|
||||
throw exception(CommonErrorCodeConstants.SYSTEM_ERROR);
|
||||
throw exception0(500, "无法获取当前门店信息,请手动选择");
|
||||
}
|
||||
return success(companyService.getById(dept.getCorpId()));
|
||||
}
|
||||
|
@ -74,5 +74,18 @@ public class DlRepairSoController {
|
||||
dlRepairSoService.voidRepairSo(repairSoReqVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购单/领料单 查看
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:34 2024/9/22
|
||||
* @param id 主键
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "采购单/领料单 查看")
|
||||
public CommonResult<?> getRepairSoById(@RequestParam("id") String id){
|
||||
return success(dlRepairSoService.getRepairSoById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
@ -47,5 +49,18 @@ public class DlRepairSoiController{
|
||||
Page<DlRepairSoi> page = new Page<>(pageNo, pageSize);
|
||||
return success(dlRepairSoiService.getRepairSoiPage(repairSoiReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购单领料单子表详细 按ID查
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:24 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "采购单领料单子表详细 按ID查")
|
||||
public CommonResult<?> getRepairSoiByIds(@RequestParam(value = "ids") List<String> ids){
|
||||
return success(dlRepairSoiService.getRepairSoiByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,4 +40,13 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
* @param repairSoReqVO 作废对象
|
||||
**/
|
||||
void voidRepairSo(DlRepairSoReqVO repairSoReqVO);
|
||||
|
||||
/**
|
||||
* 采购单/领料单 查看
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:34 2024/9/22
|
||||
* @param id 主键
|
||||
**/
|
||||
DlRepairSoRespVO getRepairSoById(String id);
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.service;
|
||||
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiQueryRespVO;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_soi(采购单领料单子表)】的数据库操作Service
|
||||
* @author 小李
|
||||
@ -21,4 +24,13 @@ public interface DlRepairSoiService extends IService<DlRepairSoi> {
|
||||
* @param repairSoiReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page);
|
||||
|
||||
/**
|
||||
* 采购单领料单子表详细 按ID查
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:24 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
List<DlRepairSoiQueryRespVO> getRepairSoiByIds(List<String> ids);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
@ -7,6 +8,7 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoMapper;
|
||||
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
|
||||
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
|
||||
@ -23,6 +25,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
@ -70,7 +74,10 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
if (CollectionUtil.isEmpty(repairSoRespVO.getGoodsList())){
|
||||
throw exception(RepairErrorCodeConstants.GOODS_IS_EMPTY);
|
||||
}
|
||||
repairSoRespVO.getGoodsList().forEach(item -> item.setSoId(repairSoRespVO.getId()));
|
||||
repairSoRespVO.getGoodsList().forEach(item -> {
|
||||
item.setSoId(repairSoRespVO.getId());
|
||||
item.setSoiType(repairSoRespVO.getSoType());
|
||||
});
|
||||
repairSoiService.saveBatch(repairSoRespVO.getGoodsList());
|
||||
}
|
||||
|
||||
@ -97,6 +104,25 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
public void voidRepairSo(DlRepairSoReqVO repairSoReqVO){
|
||||
baseMapper.updateById(repairSoReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购单/领料单 查看
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:34 2024/9/22
|
||||
* @param id 主键
|
||||
**/
|
||||
@Override
|
||||
public DlRepairSoRespVO getRepairSoById(String id){
|
||||
// 查主表
|
||||
DlRepairSo dlRepairSo = baseMapper.selectById(id);
|
||||
DlRepairSoRespVO result = BeanUtil.toBean(dlRepairSo, DlRepairSoRespVO.class);
|
||||
|
||||
// 查子表
|
||||
List<DlRepairSoi> list = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, result.getId()));
|
||||
result.setGoodsList(list);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,14 +1,27 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoiMapper;
|
||||
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
|
||||
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiQueryRespVO;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_soi(采购单领料单子表)】的数据库操作Service实现
|
||||
*
|
||||
@ -19,17 +32,55 @@ import org.springframework.stereotype.Service;
|
||||
public class DlRepairSoiServiceImpl extends ServiceImpl<DlRepairSoiMapper, DlRepairSoi>
|
||||
implements DlRepairSoiService {
|
||||
|
||||
@Resource
|
||||
private RepairWaresService waresService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlRepairSoService soService;
|
||||
|
||||
/**
|
||||
* 采购单领料单子表 分页
|
||||
*
|
||||
* @param repairSoiReqVO 查询对象
|
||||
* @author 小李
|
||||
* @date 10:44 2024/9/18
|
||||
* @param repairSoiReqVO 查询对象
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page){
|
||||
public IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page) {
|
||||
return baseMapper.getRepairSoiPage(repairSoiReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购单领料单子表详细 按ID查
|
||||
*
|
||||
* @param ids ids
|
||||
* @author 小李
|
||||
* @date 11:24 2024/9/22
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairSoiQueryRespVO> getRepairSoiByIds(List<String> ids) {
|
||||
List<DlRepairSoi> repairSois = baseMapper.selectBatchIds(ids);
|
||||
List<DlRepairSoiQueryRespVO> result = repairSois.stream()
|
||||
.map(item -> BeanUtil.toBean(item, DlRepairSoiQueryRespVO.class))
|
||||
.collect(Collectors.toList());
|
||||
List<String> goodsIds = result.stream().map(DlRepairSoiQueryRespVO::getGoodsId).collect(Collectors.toList());
|
||||
List<RepairWares> repairWares = waresService.listByIds(goodsIds);
|
||||
result.forEach(item -> {
|
||||
List<RepairWares> wares = repairWares.stream().filter(i -> i.getId().equals(item.getGoodsId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(wares)){
|
||||
item.setRepairWares(wares.get(0));
|
||||
}
|
||||
});
|
||||
|
||||
// 反查主表(时间紧迫,直接先这样)
|
||||
Set<String> soIds = repairSois.stream().map(DlRepairSoi::getSoId).collect(Collectors.toSet());
|
||||
List<DlRepairSo> dlRepairSos = soService.listByIds(soIds);
|
||||
result.forEach(item -> {
|
||||
dlRepairSos.stream().filter(i -> i.getId().equals(item.getSoId())).findFirst().ifPresent(item::setSo);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用于查详情
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:25 2024/9/22
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairSoiQueryRespVO extends DlRepairSoi {
|
||||
|
||||
/** 配件的详细信息 */
|
||||
private RepairWares repairWares;
|
||||
|
||||
/** 主表 */
|
||||
private DlRepairSo so;
|
||||
}
|
@ -26,4 +26,7 @@ public class DlRepairSoiReqVO extends DlRepairSoi {
|
||||
|
||||
@Schema(pattern = "门店")
|
||||
private String corpId;
|
||||
|
||||
@Schema(pattern = "查询关键字")
|
||||
private String query;
|
||||
}
|
||||
|
@ -59,5 +59,32 @@ public class DlRepairStController{
|
||||
Page<DlRepairSt> page = new Page<>(pageNo, pageSize);
|
||||
return success(dlRepairStService.getStPage(repairStReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 作废
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:11 2024/9/22
|
||||
* @param repairStReqVO 请求对象
|
||||
**/
|
||||
@PostMapping("/void")
|
||||
@Operation(summary = "调拨单(出库、入库) 作废")
|
||||
public CommonResult<?> voidSt(@RequestBody DlRepairStReqVO repairStReqVO){
|
||||
dlRepairStService.voidSt(repairStReqVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 详情查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:52 2024/9/22
|
||||
* @param id 查询ID
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "调拨单(出库、入库) 详情查询")
|
||||
public CommonResult<?> getSt(@RequestParam("id") String id){
|
||||
return success(dlRepairStService.getSt(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
@ -47,5 +49,18 @@ public class DlRepairStiController{
|
||||
Page<DlRepairSti> page = new Page<>(pageNo, pageSize);
|
||||
return success(dlRepairStiService.getStiPage(repairStiReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单子表 配件详情
|
||||
*
|
||||
* @author 小李
|
||||
* @date 18:33 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
@GetMapping("/getWares")
|
||||
@Operation(summary = "调拨单子表 配件详情")
|
||||
public CommonResult<?> getStIsWares(@RequestParam("ids") List<String> ids){
|
||||
return success(dlRepairStiService.getStIsWares(ids));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,4 +32,22 @@ public interface DlRepairStService extends IService<DlRepairSt> {
|
||||
* @param repairStReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairSt> getStPage(DlRepairStReqVO repairStReqVO, Page<DlRepairSt> page);
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 作废
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:11 2024/9/22
|
||||
* @param repairStReqVO 请求对象
|
||||
**/
|
||||
void voidSt(DlRepairStReqVO repairStReqVO);
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 详情查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:52 2024/9/22
|
||||
* @param id 查询ID
|
||||
**/
|
||||
DlRepairStRespVO getSt(String id);
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.service;
|
||||
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiQueryVO;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_sti(调拨单子表)】的数据库操作Service
|
||||
* @author 小李
|
||||
@ -21,4 +24,13 @@ public interface DlRepairStiService extends IService<DlRepairSti> {
|
||||
* @param repairStiReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairSti> getStiPage(DlRepairStiReqVO repairStiReqVO, Page<DlRepairSti> page);
|
||||
|
||||
/**
|
||||
* 调拨单子表 配件详情
|
||||
*
|
||||
* @author 小李
|
||||
* @date 18:33 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
List<DlRepairStiQueryVO> getStIsWares(List<String> ids);
|
||||
}
|
||||
|
@ -1,13 +1,19 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
|
||||
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStiService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStReqVO;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStRespVO;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiQueryVO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -17,6 +23,11 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
@ -32,6 +43,9 @@ public class DlRepairStServiceImpl extends ServiceImpl<DlRepairStMapper, DlRepai
|
||||
@Resource
|
||||
private DlRepairStiService repairStiService;
|
||||
|
||||
@Resource
|
||||
private RepairWaresService waresService;
|
||||
|
||||
/**
|
||||
* 调拨单 新增
|
||||
*
|
||||
@ -66,6 +80,44 @@ public class DlRepairStServiceImpl extends ServiceImpl<DlRepairStMapper, DlRepai
|
||||
public IPage<DlRepairSt> getStPage(DlRepairStReqVO repairStReqVO, Page<DlRepairSt> page){
|
||||
return baseMapper.getStPage(repairStReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 作废
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:11 2024/9/22
|
||||
* @param repairStReqVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
public void voidSt(DlRepairStReqVO repairStReqVO){
|
||||
baseMapper.updateById(repairStReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 详情查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:52 2024/9/22
|
||||
* @param id 查询ID
|
||||
**/
|
||||
@Override
|
||||
public DlRepairStRespVO getSt(String id){
|
||||
// 查主表
|
||||
DlRepairSt dlRepairSt = baseMapper.selectById(id);
|
||||
DlRepairStRespVO result = BeanUtil.toBean(dlRepairSt, DlRepairStRespVO.class);
|
||||
// 查子表
|
||||
List<DlRepairSti> repairStis = repairStiService.list(new LambdaQueryWrapper<DlRepairSti>().eq(DlRepairSti::getStId, result.getId()));
|
||||
Set<String> goodIds = repairStis.stream().map(DlRepairSti::getGoodsId).collect(Collectors.toSet());
|
||||
List<DlRepairStiQueryVO> items = repairStis.stream().map(item -> BeanUtil.toBean(item, DlRepairStiQueryVO.class)).collect(Collectors.toList());
|
||||
// 查商品
|
||||
List<RepairWares> repairWares = waresService.listByIds(goodIds);
|
||||
// 映射
|
||||
items.forEach(item -> {
|
||||
repairWares.stream().filter(i -> i.getId().equals(item.getGoodsId())).findFirst().ifPresent(item::setWares);
|
||||
});
|
||||
result.setItems(items);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,14 +1,26 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
|
||||
import cn.iocoder.yudao.module.stockTransfer.mapper.DlRepairStiMapper;
|
||||
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStiService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiQueryVO;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStiReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_sti(调拨单子表)】的数据库操作Service实现
|
||||
*
|
||||
@ -19,6 +31,13 @@ import org.springframework.stereotype.Service;
|
||||
public class DlRepairStiServiceImpl extends ServiceImpl<DlRepairStiMapper, DlRepairSti>
|
||||
implements DlRepairStiService {
|
||||
|
||||
@Resource
|
||||
private RepairWaresService waresService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlRepairStService stService;
|
||||
|
||||
/**
|
||||
* 调拨单子表 分页
|
||||
*
|
||||
@ -31,6 +50,32 @@ public class DlRepairStiServiceImpl extends ServiceImpl<DlRepairStiMapper, DlRep
|
||||
return baseMapper.getStiPage(repairStiReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单子表 配件详情
|
||||
*
|
||||
* @author 小李
|
||||
* @date 18:33 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairStiQueryVO> getStIsWares(List<String> ids){
|
||||
// 查子表
|
||||
List<DlRepairSti> dlRepairStis = baseMapper.selectBatchIds(ids);
|
||||
List<DlRepairStiQueryVO> result = dlRepairStis.stream().map(item -> BeanUtil.toBean(item, DlRepairStiQueryVO.class)).collect(Collectors.toList());
|
||||
// 查配件
|
||||
Set<String> goodsIds = result.stream().map(DlRepairStiQueryVO::getGoodsId).collect(Collectors.toSet());
|
||||
List<RepairWares> wares = waresService.listByIds(goodsIds);
|
||||
// 查主表
|
||||
Set<String> stIds = result.stream().map(DlRepairStiQueryVO::getStId).collect(Collectors.toSet());
|
||||
List<DlRepairSt> dlRepairSts = stService.listByIds(stIds);
|
||||
// 映射
|
||||
result.forEach(item -> {
|
||||
wares.stream().filter(i -> i.getId().equals(item.getGoodsId())).findFirst().ifPresent(item::setWares);
|
||||
dlRepairSts.stream().filter(i -> i.getId().equals(item.getStId())).findFirst().ifPresent(item::setSt);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,13 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 调拨单 请求VO
|
||||
@ -10,4 +16,8 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairStReqVO extends DlRepairSt {
|
||||
|
||||
@Schema(description = "时间区间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] searchTimeArray;
|
||||
}
|
||||
|
@ -16,4 +16,7 @@ public class DlRepairStRespVO extends DlRepairSt {
|
||||
|
||||
// 商品列表
|
||||
private List<DlRepairSti> goodsList;
|
||||
|
||||
// 商品详情列表(上面那个在别的地方用了,节约时间就不改了)
|
||||
private List<DlRepairStiQueryVO> items;
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调拨单(出库、入库) 用于查询
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:50 2024/9/22
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairStiQueryVO extends DlRepairSti {
|
||||
|
||||
@Schema(pattern = "配件信息")
|
||||
private RepairWares wares;
|
||||
|
||||
@Schema(pattern = "主表信息")
|
||||
private DlRepairSt st;
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 调拨单子表 请求VO
|
||||
@ -10,4 +16,17 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairStiReqVO extends DlRepairSti {
|
||||
|
||||
@Schema(description = "时间区间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] searchTimeArray;
|
||||
|
||||
/** 调入门店 */
|
||||
private String inCorpId;
|
||||
|
||||
/** 调出门店 */
|
||||
private String outCorpId;
|
||||
|
||||
/** 查询关键字 */
|
||||
private String query;
|
||||
}
|
||||
|
@ -72,5 +72,19 @@ public class DlRepairTicketsController {
|
||||
public CommonResult<?> getTicketsById(@RequestParam("id") String id){
|
||||
return success(dlRepairTicketsService.getTicketsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单表 作废
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:46 2024/9/22
|
||||
* @param repairTicketsReqVO 工单对象
|
||||
**/
|
||||
@PostMapping("/void")
|
||||
@Operation(summary = "维修工单表 作废")
|
||||
public CommonResult<?> setTicketsVoid(@RequestBody DlRepairTicketsReqVO repairTicketsReqVO){
|
||||
dlRepairTicketsService.setTicketsVoid(repairTicketsReqVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,4 +41,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param id 工单ID
|
||||
**/
|
||||
DlRepairTicketsRespVO getTicketsById(String id);
|
||||
|
||||
/**
|
||||
* 维修工单表 作废
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:46 2024/9/22
|
||||
* @param repairTicketsReqVO 工单对象
|
||||
**/
|
||||
void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO);
|
||||
}
|
||||
|
@ -5,6 +5,12 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.other.entity.DlRepairOther;
|
||||
import cn.iocoder.yudao.module.other.service.DlRepairOtherService;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairProjectService;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
@ -14,6 +20,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -25,6 +32,7 @@ import javax.annotation.Resource;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -45,6 +53,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private RepairProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private RepairWaresService waresService;
|
||||
|
||||
@Resource
|
||||
private DlRepairOtherService otherService;
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
*
|
||||
@ -113,11 +130,46 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 查工单主表
|
||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||
// 工单子表
|
||||
// 查工单子表
|
||||
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
|
||||
result.setItemList(itemList);
|
||||
List<DlRepairTitemReqVO> items = itemList.stream().map(item -> BeanUtil.toBean(item, DlRepairTitemReqVO.class)).collect(Collectors.toList());
|
||||
// 取项目
|
||||
List<DlRepairTitemReqVO> projects = items.stream().filter(item -> item.getItemType().equals("01")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(projects)){
|
||||
Set<String> ids = projects.stream().map(DlRepairTitemReqVO::getProjectId).collect(Collectors.toSet());
|
||||
List<RepairProject> repairProjects = projectService.listByIds(ids);
|
||||
items.forEach(item -> repairProjects.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setProject));
|
||||
}
|
||||
|
||||
// 取配件
|
||||
List<DlRepairTitemReqVO> wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(wares)){
|
||||
Set<String> ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet());
|
||||
List<RepairWares> repairWares = waresService.listByIds(ids);
|
||||
items.forEach(item -> repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare));
|
||||
}
|
||||
// 取附加
|
||||
List<DlRepairTitemReqVO> others = items.stream().filter(item -> item.getItemType().equals("03")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(others)){
|
||||
Set<String> ids = others.stream().map(DlRepairTitemReqVO::getOtherId).collect(Collectors.toSet());
|
||||
List<DlRepairOther> dlRepairOthers = otherService.listByIds(ids);
|
||||
items.forEach(item -> dlRepairOthers.stream().filter(i -> i.getId().equals(item.getOtherId())).findFirst().ifPresent(item::setOther));
|
||||
}
|
||||
result.setItems(items);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单表 作废
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:46 2024/9/22
|
||||
* @param repairTicketsReqVO 工单对象
|
||||
**/
|
||||
@Override
|
||||
public void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO){
|
||||
baseMapper.updateById(repairTicketsReqVO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,4 +16,7 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
|
||||
|
||||
/** 子表数组 */
|
||||
private List<DlRepairTitem> itemList;
|
||||
|
||||
/** 上面有地方在用,只能新用一个了,子表数组 */
|
||||
private List<DlRepairTitemReqVO> items;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.other.entity.DlRepairOther;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import lombok.Data;
|
||||
|
||||
@ -10,4 +13,14 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairTitemReqVO extends DlRepairTitem {
|
||||
|
||||
// 项目详情
|
||||
private RepairProject project;
|
||||
|
||||
// 配件详情
|
||||
private RepairWares ware;
|
||||
|
||||
// 附加详情
|
||||
private DlRepairOther other;
|
||||
|
||||
}
|
||||
|
@ -52,10 +52,18 @@
|
||||
|
||||
<select id="getRepairSoPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL"/>
|
||||
and so_type = #{map.soType} and purchase_type = #{map.purchaseType}
|
||||
<if test="map.soType != null and map.soType">
|
||||
and so_type = #{map.soType}
|
||||
</if>
|
||||
<if test="map.purchaseType != null and map.purchaseType != ''">
|
||||
and purchase_type = #{map.purchaseType}
|
||||
</if>
|
||||
<if test="map.soStatus != null and map.soStatus != ''">
|
||||
and so.so_status = #{map.soStatus}
|
||||
</if>
|
||||
<if test="map.soStatus == null">
|
||||
and so.so_status != '06'
|
||||
</if>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and (so.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
|
||||
</if>
|
||||
@ -71,6 +79,9 @@
|
||||
<if test="map.soNo != null and map.soNo != ''">
|
||||
and (so.so_no like concat('%', #{map.soNo}, '%') or so.remark like concat('%', #{map.soNo}, '%'))
|
||||
</if>
|
||||
<if test="map.userId != null and map.userId != ''">
|
||||
and (so.user_id = #{map.userId})
|
||||
</if>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -33,7 +33,8 @@
|
||||
left join
|
||||
dl_repair_so so
|
||||
on soi.so_id = so.id
|
||||
where soi.deleted = '0'
|
||||
left join dl_repair_wares drw on soi.goods_id = drw.id
|
||||
where soi.deleted = '0' and so.so_status != '06'
|
||||
</sql>
|
||||
|
||||
<select id="getRepairSoiPage" resultMap="BaseResultMap">
|
||||
@ -53,5 +54,19 @@
|
||||
<if test="map.corpId != null and map.corpId != ''">
|
||||
and so.corp_id = #{map.corpId}
|
||||
</if>
|
||||
<if test="map.wareId != null and map.wareId != ''">
|
||||
and soi.ware_id = #{map.wareId}
|
||||
</if>
|
||||
<if test="map.query != null and map.query != null">
|
||||
and (
|
||||
so.so_no like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drw.name like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drw.code like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drw.model like concat('%', #{map.query}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -37,7 +37,8 @@
|
||||
st_status,
|
||||
st_time,
|
||||
remark,
|
||||
dept_id
|
||||
dept_id,
|
||||
create_time
|
||||
from dl_repair_st st
|
||||
where st.deleted = '0'
|
||||
</sql>
|
||||
@ -50,5 +51,17 @@
|
||||
<if test="map.inCorpId != null and map.inCorpId != ''">
|
||||
and st.in_corp_id = #{map.inCorpId}
|
||||
</if>
|
||||
<if test="map.stStatus != null and map.stStatus != ''">
|
||||
and st.st_status = #{map.stStatus}
|
||||
</if>
|
||||
<if test="map.stStatus == null">
|
||||
and st.st_status != '04'
|
||||
</if>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and (st.st_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
|
||||
</if>
|
||||
<if test="map.stNo != null and map.stNo != ''">
|
||||
and (st.st_no like concat('%', #{map.stNo}, '%') or st.remark like concat('%', #{map.stNo}, '%'))
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -14,17 +14,40 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
select id,
|
||||
select sti.id as id,
|
||||
st_id,
|
||||
goods_id,
|
||||
goods_count,
|
||||
goods_price,
|
||||
remark
|
||||
sti.remark as remark
|
||||
from dl_repair_sti sti
|
||||
left join dl_repair_st st on sti.st_id = st.id
|
||||
left join dl_repair_wares drw on sti.goods_id = drw.id
|
||||
where sti.deleted = '0'
|
||||
and st.st_status != '04'
|
||||
</sql>
|
||||
|
||||
<select id="getStiPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL" />
|
||||
<include refid="Base_SQL"/>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and (st.st_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
|
||||
</if>
|
||||
<if test="map.query != null and map.query != ''">
|
||||
and (
|
||||
st.st_no like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drw.name like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drw.code like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drw.model like concat('%', #{map.query}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="map.inCorpId != null and map.inCorpId != ''">
|
||||
and st.in_corp_id = #{map.inCorpId}
|
||||
</if>
|
||||
<if test="map.outCorpId != null and map.outCorpId != ''">
|
||||
and st.out_corp_id = #{map.outCorpId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -34,7 +34,7 @@
|
||||
<result property="partPrice" column="part_price"/>
|
||||
<result property="otherPrice" column="other_price"/>
|
||||
<result property="totalPrice" column="total_price"/>
|
||||
<result property="ticketsStatus" column="ticket_status"/>
|
||||
<result property="ticketsStatus" column="tickets_status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="inTime" column="in_time" />
|
||||
<result property="outTime" column="out_time" />
|
||||
@ -88,9 +88,12 @@
|
||||
|
||||
<select id="getTicketsPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL"/>
|
||||
<if test="map.ticketsStatus != null and map.ticketsStatus != ''">
|
||||
<if test="map.ticketsStatus != null and map.ticketsStatus != '' and map.ticketsStatus != '01'">
|
||||
and drt.tickets_status = #{map.ticketsStatus}
|
||||
</if>
|
||||
<if test="map.ticketsStatus != null and map.ticketsStatus != '' and map.ticketsStatus == '01'">
|
||||
and (drt.tickets_status = #{map.ticketsStatus} or drt.tickets_status = '06')
|
||||
</if>
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
|
Loading…
Reference in New Issue
Block a user