选择配件生成采购单展示的数据、展示修改为折叠框

This commit is contained in:
xiaofajia 2024-11-18 19:33:18 +08:00
parent 1d190df750
commit a00cc57f96
8 changed files with 122 additions and 3 deletions

View File

@ -101,6 +101,4 @@ public class BaseTypeController {
public CommonResult<List<BaseTypeRespVO>> getBaseTypeList(@Valid BaseTypeListReqVO listReqVO) { public CommonResult<List<BaseTypeRespVO>> getBaseTypeList(@Valid BaseTypeListReqVO listReqVO) {
return success(baseTypeService.getBaseTypeList(listReqVO)); return success(baseTypeService.getBaseTypeList(listReqVO));
} }
} }

View File

@ -77,7 +77,8 @@ public class CarBrandController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得车辆品牌") @Operation(summary = "获得车辆品牌")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:car-brand:query')") // 有些地方要用但是又没有权限故把查看单个的权限公开---小李
// @PreAuthorize("@ss.hasPermission('base:car-brand:query')")
public CommonResult<CarBrandRespVO> getCarBrand(@RequestParam("id") String id) { public CommonResult<CarBrandRespVO> getCarBrand(@RequestParam("id") String id) {
CarBrand carBrand = carBrandService.getCarBrand(id); CarBrand carBrand = carBrandService.getCarBrand(id);
return success(BeanUtils.toBean(carBrand, CarBrandRespVO.class)); return success(BeanUtils.toBean(carBrand, CarBrandRespVO.class));

View File

@ -390,5 +390,18 @@ public class DlRepairTicketsController {
dlRepairTicketsService.removeTicketById(id); dlRepairTicketsService.removeTicketById(id);
return CommonResult.ok(); return CommonResult.ok();
} }
/**
* 根据工单ID查客户和车辆信息
*
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
@GetMapping("/getCusAndCarById")
@Operation(summary = "根据工单ID查客户和车辆信息")
public CommonResult<?> getCusAndCarById(@RequestParam("id") String id) {
return success(dlRepairTicketsService.getCusAndCarById(id));
}
} }

View File

@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/** /**
@ -195,5 +197,18 @@ public class DlTicketWaresController {
dlTicketWaresService.updateSafe(respVO); dlTicketWaresService.updateSafe(respVO);
return CommonResult.ok(); return CommonResult.ok();
} }
/**
* 根据选择的配件生成采购单需要的数据
*
* @author 小李
* @date 18:14 2024/11/18
* @param ids ids
**/
@GetMapping("/getByIds")
@Operation(summary = "根据选择的配件生成采购单需要的数据")
public CommonResult<?> getByIds(@RequestParam("ids") List<String> ids){
return success(dlTicketWaresService.getByIds(ids));
}
} }

View File

@ -252,4 +252,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @date 15:00 2024/11/16 * @date 15:00 2024/11/16
**/ **/
Boolean hasPrice(String id); Boolean hasPrice(String id);
/**
* 根据工单ID查客户和车辆信息
*
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
CustomerAndCarVO getCusAndCarById(String id);
} }

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.tickets.service;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares; import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO; import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO; import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -113,4 +114,13 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
* @param respVO 对象 * @param respVO 对象
**/ **/
void updateSafe(DlTicketWaresRespVO respVO); void updateSafe(DlTicketWaresRespVO respVO);
/**
* 根据选择的配件生成采购单需要的数据
*
* @author 小李
* @date 18:14 2024/11/18
* @param ids ids
**/
Map<String, List<DlTwItemRespVO>> getByIds(List<String> ids);
} }

View File

@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.service.BaseTypeService; import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.custom.entity.*; import cn.iocoder.yudao.module.custom.entity.*;
import cn.iocoder.yudao.module.custom.service.*; import cn.iocoder.yudao.module.custom.service.*;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO; import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo; import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
@ -1746,6 +1747,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 记录日志 // 记录日志
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage()); repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage());
} }
/**
* 根据工单ID查客户和车辆信息
*
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
@Override
public CustomerAndCarVO getCusAndCarById(String id){
// 查工单
DlRepairTickets tickets = baseMapper.selectById(id);
// 查用户
CustomerMain customerMain = customerService.getById(tickets.getUserId());
// 查车辆
CarMain carMain = carMainService.getById(tickets.getCarId());
// 映射
CustomerAndCarVO customerAndCarVO = new CustomerAndCarVO();
customerAndCarVO.setUserInfo(customerMain);
customerAndCarVO.setCarInfo(BeanUtil.toBean(carMain, CarMainReqVO.class));
return customerAndCarVO;
}
} }

View File

@ -11,6 +11,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.entity.RepairWares;
@ -33,6 +35,7 @@ import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
import cn.iocoder.yudao.module.tickets.service.DlTwItemService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO; import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO; import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -104,6 +107,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Resource @Resource
private CustomerMainService customerMainService; private CustomerMainService customerMainService;
@Resource
private BaseTypeService baseTypeService;
/** /**
* 分页查询 * 分页查询
* *
@ -652,6 +658,50 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 更新 // 更新
baseMapper.update(lambdaUpdate); baseMapper.update(lambdaUpdate);
} }
/**
* 根据选择的配件生成采购单需要的数据
*
* @author 小李
* @date 18:14 2024/11/18
* @param ids ids
**/
@Override
public Map<String, List<DlTwItemRespVO>> getByIds(List<String> ids){
// 查配件申请表子表
List<DlTwItem> twItems = twItemService.listByIds(ids);
// 查配件
List<String> waresIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
List<RepairWares> wares = repairWaresService.listByIds(waresIds);
// 关联配件申请表子项和配件
List<DlTwItemRespVO> newTwItems = twItems.stream().map(item -> {
DlTwItemRespVO twItem = BeanUtil.toBean(item, DlTwItemRespVO.class);
RepairWares ware = wares.stream().filter(i -> i.getId().equals(item.getWaresId())).findFirst().orElse(null);
if (ware != null) {
twItem.setWares(ware);
}
return twItem;
}).collect(Collectors.toList());
// 分组
Map<String, List<DlTwItemRespVO>> map = newTwItems.stream().collect(Collectors.groupingBy(item -> {
String key = item.getWares().getType();
return key != null && !key.isEmpty() ? key : "default";
}));
// 查分类
List<BaseType> baseTypes = baseTypeService.listByIds(map.keySet());
Map<String, String> TypeMap = baseTypes.stream().collect(Collectors.toMap(BaseType::getId, BaseType::getName));
// 映射
Map<String, List<DlTwItemRespVO>> result = new HashMap<>();
for (Map.Entry<String, List<DlTwItemRespVO>> entry : map.entrySet()) {
String key = entry.getKey();
String newKey = TypeMap.get(key);
if (newKey == null || newKey.isEmpty()) {
newKey = "未分类";
}
result.put(newKey, entry.getValue());
}
return result;
}
} }