1
This commit is contained in:
parent
ff3f9547e4
commit
41b433933b
@ -7,9 +7,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.*;
|
||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairRecords;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
@ -365,7 +367,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public DlRepairTicketsRespVO getTicketsById(String id,Boolean ifApp) {
|
||||
// 查工单主表
|
||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||
//翻译维修类型
|
||||
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
|
||||
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||
result.setRepairTypeText(repairTypeMap.getOrDefault(dlRepairTickets.getRepairType(),""));
|
||||
|
||||
//查是否存在总检完成的记录,取出他的时间
|
||||
LambdaQueryWrapper<RepairRecords> queryWrapper = new LambdaQueryWrapper<RepairRecords>()
|
||||
.eq(RepairRecords::getTicketId,id)
|
||||
.eq(RepairRecords::getType,RecordTypeEnum.ZJ.getCode())
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
List<RepairRecords> repairRecords = repairRecordsService.list(queryWrapper);
|
||||
if(!repairRecords.isEmpty()){
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String formattedString = repairRecords.get(0).getCreateTime().format(formatter);
|
||||
result.setRealOverDate(formattedString);
|
||||
}
|
||||
|
||||
AdminUserDO user = userService.getUser(Long.valueOf(dlRepairTickets.getAdviserId()));
|
||||
result.setLinkPhone(user.getMobile());
|
||||
//查车辆
|
||||
@ -380,15 +399,54 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 查工单子表
|
||||
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
|
||||
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());
|
||||
//pc原逻辑
|
||||
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));
|
||||
}
|
||||
result.setProjects(projects);
|
||||
if(ifApp){
|
||||
//app新增逻辑
|
||||
if (CollectionUtil.isNotEmpty(projects)) {
|
||||
List<AppWaresGroupVO> projectList = new ArrayList<>();
|
||||
//查所有服务分类(项目分类)
|
||||
List<BaseType> baseTypeList = baseTypeService.list();
|
||||
Map<String,String> baseTypeMap = baseTypeList.stream().collect(Collectors.toMap(BaseType::getId,BaseType::getName));
|
||||
//先过滤出itenTypeId为null或空为单独一个组
|
||||
List<DlRepairTitemReqVO> nullList = projects.stream().filter(item->StringUtils.isEmpty(item.getItemTypeId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(nullList)) {
|
||||
AppWaresGroupVO waresGroupVO = new AppWaresGroupVO();
|
||||
waresGroupVO.setWares(nullList);
|
||||
waresGroupVO.setGroupName("未知分组");
|
||||
waresGroupVO.setNums(nullList.size());
|
||||
waresGroupVO.setShowAll(false);
|
||||
waresGroupVO.setServicer(nullList.get(0).getSaleName());
|
||||
waresGroupVO.setWorker(nullList.get(0).getRepairNames());
|
||||
projectList.add(waresGroupVO);
|
||||
}
|
||||
//过滤出有分类的进行分组
|
||||
Map<String,List<DlRepairTitemReqVO>> groupListMap = projects.stream().filter(item->StringUtils.isNotEmpty(item.getItemTypeId())).collect(Collectors.groupingBy(DlRepairTitem::getItemTypeId));
|
||||
for (String key:groupListMap.keySet()){
|
||||
AppWaresGroupVO waresGroupVO = new AppWaresGroupVO();
|
||||
waresGroupVO.setWares(groupListMap.get(key));
|
||||
waresGroupVO.setGroupName(baseTypeMap.get(key));
|
||||
waresGroupVO.setGroupId(key);
|
||||
waresGroupVO.setNums(groupListMap.get(key).size());
|
||||
waresGroupVO.setShowAll(false);
|
||||
waresGroupVO.setServicer(groupListMap.get(key).get(0).getSaleName());
|
||||
waresGroupVO.setWorker(groupListMap.get(key).get(0).getRepairNames());
|
||||
projectList.add(waresGroupVO);
|
||||
}
|
||||
result.setProjectList(projectList);
|
||||
}
|
||||
}
|
||||
|
||||
//处理配件
|
||||
if(ifApp){
|
||||
//app的逻辑
|
||||
List<AppWaresGroupVO> waresGroupList = new ArrayList<>();
|
||||
|
@ -7,12 +7,14 @@ import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app使用的配件明细,按分类分组后的
|
||||
* app使用的配件明细(项目),按分类分组后的
|
||||
* @author vinjor-M
|
||||
* @date 10:10 2024/11/19
|
||||
**/
|
||||
@Data
|
||||
public class AppWaresGroupVO {
|
||||
/** 是否展开数据 */
|
||||
private Boolean showAll;
|
||||
/** 分组ID(分类ID) */
|
||||
private String groupId;
|
||||
/** 分组名称(分类名称) */
|
||||
@ -23,7 +25,7 @@ public class AppWaresGroupVO {
|
||||
private Integer nums;
|
||||
/** 总价 */
|
||||
private BigDecimal totalAmount;
|
||||
/** 配件明细 */
|
||||
/** 配件/项目明细 */
|
||||
private List<DlRepairTitemReqVO> wares;
|
||||
/** 配件申请单配件明细 */
|
||||
private List<DlTwItemRespVO> twItemList;
|
||||
@ -36,4 +38,9 @@ public class AppWaresGroupVO {
|
||||
private Integer waitingNum;
|
||||
/** 审核不通过数量-- */
|
||||
private Integer noNum;
|
||||
|
||||
/** 服务顾问人名 */
|
||||
private String servicer;
|
||||
/** 维修工人名 */
|
||||
private String worker;
|
||||
}
|
||||
|
@ -65,4 +65,11 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
|
||||
|
||||
/** app分组回显专用--配件明细 */
|
||||
List<AppWaresGroupVO> waresGroupList;
|
||||
/** app分组回显专用--项目明细 */
|
||||
List<AppWaresGroupVO> projectList;
|
||||
|
||||
/** 维修类型文本 */
|
||||
private String repairTypeText;
|
||||
/** 车辆实际竣工(总检完成)时间 */
|
||||
private String realOverDate;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user