服务指令首页-工单轮播接口调整
This commit is contained in:
parent
1db4c6c6ee
commit
476c69460a
|
|
@ -324,4 +324,10 @@ public class DirectiveOrderEntity implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private java.math.BigDecimal totalPrice;
|
private java.math.BigDecimal totalPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指令集子列表(用于存储同一个指令集下的多个指令)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<DirectiveOrderEntity> directiveList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,9 @@
|
||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
ORDER BY t.serv_start_time ASC
|
ORDER BY t.serv_start_time ASC,
|
||||||
|
CASE WHEN t.service_attribute = 'ds' THEN 0 ELSE 1 END,
|
||||||
|
CASE WHEN CAST(t.service_duration AS UNSIGNED) = 0 THEN 999999 ELSE CAST(t.service_duration AS UNSIGNED) END
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 服务指令工单主表
|
* @Description: 服务指令工单主表
|
||||||
|
|
@ -81,8 +78,92 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
||||||
@Override
|
@Override
|
||||||
public IPage<DirectiveOrderEntity> queryOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req) {
|
public IPage<DirectiveOrderEntity> queryOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req) {
|
||||||
Page<DirectiveOrder> page = new Page<>(pageNo, pageSize);
|
Page<DirectiveOrder> page = new Page<>(pageNo, pageSize);
|
||||||
//workType工单类型 1待执行 2已执行 3已完成 4已过期 5待执行或者已执行未完成 空是全部
|
|
||||||
return baseMapper.queryOrderList(page, directiveOrderEntity);
|
// 查询原始数据
|
||||||
|
IPage<DirectiveOrderEntity> resultPage = baseMapper.queryOrderList(page, directiveOrderEntity);
|
||||||
|
List<DirectiveOrderEntity> records = resultPage.getRecords();
|
||||||
|
|
||||||
|
// 处理数据,将指令集合并
|
||||||
|
List<DirectiveOrderEntity> processedRecords = mergeDirectiveSet(records);
|
||||||
|
|
||||||
|
// 重新设置处理后的数据
|
||||||
|
resultPage.setRecords(processedRecords);
|
||||||
|
|
||||||
|
return resultPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并指令集数据
|
||||||
|
*
|
||||||
|
* @param records 原始查询结果
|
||||||
|
* @return 处理后的结果集
|
||||||
|
*/
|
||||||
|
private List<DirectiveOrderEntity> mergeDirectiveSet(List<DirectiveOrderEntity> records) {
|
||||||
|
if (records == null || records.isEmpty()) {
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用于存储合并后的结果
|
||||||
|
List<DirectiveOrderEntity> result = new ArrayList<>();
|
||||||
|
// 用于临时存储指令集的主对象(key: serv_start_time)
|
||||||
|
Map<String, DirectiveOrderEntity> directiveSetMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
for (DirectiveOrderEntity entity : records) {
|
||||||
|
// 判断是否是指令集(iz_multi = 'Y')
|
||||||
|
if ("Y".equals(entity.getIzMulti())) {
|
||||||
|
// 使用serv_start_time作为key
|
||||||
|
String key = entity.getServStartTime() != null ? entity.getServStartTime().toString() : "";
|
||||||
|
|
||||||
|
DirectiveOrderEntity mainEntity = directiveSetMap.get(key);
|
||||||
|
if (mainEntity == null) {
|
||||||
|
// 创建新的主对象,只包含指定字段
|
||||||
|
mainEntity = createDirectiveSetMainEntity(entity);
|
||||||
|
mainEntity.setDirectiveList(new ArrayList<>());
|
||||||
|
directiveSetMap.put(key, mainEntity);
|
||||||
|
result.add(mainEntity);
|
||||||
|
}
|
||||||
|
// 将完整指令信息添加到子列表中
|
||||||
|
mainEntity.getDirectiveList().add(entity);
|
||||||
|
} else {
|
||||||
|
// 非指令集,直接添加到结果中
|
||||||
|
result.add(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建指令集主对象(只包含必要的公共字段)
|
||||||
|
*
|
||||||
|
* @param source 源对象
|
||||||
|
* @return 主对象
|
||||||
|
*/
|
||||||
|
private DirectiveOrderEntity createDirectiveSetMainEntity(DirectiveOrderEntity source) {
|
||||||
|
DirectiveOrderEntity mainEntity = new DirectiveOrderEntity();
|
||||||
|
|
||||||
|
// 只设置你指定的公共字段
|
||||||
|
mainEntity.setNuId(source.getNuId());
|
||||||
|
mainEntity.setNuName(source.getNuName());
|
||||||
|
mainEntity.setElderId(source.getElderId());
|
||||||
|
mainEntity.setElderName(source.getElderName());
|
||||||
|
mainEntity.setBodyTagIds(source.getBodyTagIds());
|
||||||
|
mainEntity.setBodyTagNames(source.getBodyTagNames());
|
||||||
|
mainEntity.setBodyTagPrice(source.getBodyTagPrice());
|
||||||
|
mainEntity.setEmotionTagIds(source.getEmotionTagIds());
|
||||||
|
mainEntity.setEmotionTagNames(source.getEmotionTagNames());
|
||||||
|
mainEntity.setEmotionTagPrice(source.getEmotionTagPrice());
|
||||||
|
mainEntity.setEmployeeId(source.getEmployeeId());
|
||||||
|
mainEntity.setEmployeeName(source.getEmployeeName());
|
||||||
|
mainEntity.setOptType(source.getOptType());
|
||||||
|
mainEntity.setEmployeeIds(source.getEmployeeIds());
|
||||||
|
mainEntity.setEmployeeNames(source.getEmployeeNames());
|
||||||
|
mainEntity.setInstructionId(source.getInstructionId());
|
||||||
|
mainEntity.setInstructionName(source.getInstructionName());
|
||||||
|
mainEntity.setServStartTime(source.getServStartTime());
|
||||||
|
mainEntity.setIzMulti(source.getIzMulti());
|
||||||
|
|
||||||
|
return mainEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue