Commit eecfd630 by wangli

简化代码

1 parent 99e32be7
......@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.jdbc.core.SqlProvider;
import java.util.List;
......
......@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
......
......@@ -38,7 +38,6 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
@Autowired
private ProductCategoryDao productCategoryDao;
@Autowired
private OrgGroupDao orgGroupDao;
......
......@@ -44,7 +44,7 @@ public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> getOrderAssignRecommendEngineers(String orderId, String key, String distance, String recommend) {
// 服务单指派-推荐技术员列表
OrderRequest order = this.queryOrderRequest(orderId);
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
if (order == null) {
throw new BusinessException("订单不存在");
}
......@@ -52,7 +52,7 @@ public class OrderAssignImpl implements OrderAssign {
String date = TimeUtils.timestamp2DateTime(order.getExpectTimeBegin(), TimeUtils.DATE_GAP_FORMAT);
// 获取group内的小组成员
List<EngineerInfo> engineers = this.queryEngineerInfoByGroupId(order.getOrgGroupId());
List<EngineerInfo> engineers = engineerInfoMPDao.selectByGroupId(order.getOrgGroupId());
List<OrderAssignRecommendResp.Engineer> items = new ArrayList<>();
......@@ -68,7 +68,7 @@ public class OrderAssignImpl implements OrderAssign {
HashMap<String, List<LabelValueDTO>> orderTips = new HashMap<>();
List<String> orderIds = orderAppointments.stream().map(OrderAppointment::getOrderId).collect(Collectors.toList());
if (!orderIds.isEmpty()) {
List<OrderRequest> orders = this.queryOrderRequestsByOrderIds(orderIds);
List<OrderRequest> orders = orderRequestMPDao.selectByOrderIds(orderIds);
orderTips = this.packOrderTips(orders);
}
......@@ -102,7 +102,7 @@ public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> orderAssign(String orderId, String engineerCode) throws BusinessException {
// 服务单指派-指派提交
OrderRequest order = this.queryOrderRequest(orderId);
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
if (order == null) {
throw new BusinessException("订单不存在");
}
......@@ -111,7 +111,7 @@ public class OrderAssignImpl implements OrderAssign {
throw new BusinessException("订单已指派成功,不必重新指派");
}
EngineerInfo engineer = this.queryEngineerInfo(engineerCode);
EngineerInfo engineer = engineerInfoMPDao.getByEngineerCode(engineerCode);
String date = TimeUtils.timestamp2DateTime(order.getExpectTimeBegin(), TimeUtils.DATE_GAP_FORMAT);
List<OrderAppointment> orderAppointments = this.queryOrderAppointments(engineerCode, date);
......@@ -152,36 +152,12 @@ public class OrderAssignImpl implements OrderAssign {
return Result.success(null);
}
private OrderRequest queryOrderRequest(String orderId) {
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderRequest::getOrderId, orderId);
return orderRequestMPDao.selectOne(lqw);
}
private List<OrderRequest> queryOrderRequestsByOrderIds(List<String> orderIds) {
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.in(OrderRequest::getOrderId, orderIds);
return orderRequestMPDao.selectList(lqw);
}
private List<OrderAppointment> queryOrderAppointments(String engineerCode, String date) {
LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderAppointment::getEngineerCode, engineerCode);
return orderAppointmentMPDao.selectList(lqw);
}
private EngineerInfo queryEngineerInfo(String engineerCode) {
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(EngineerInfo::getEngineerCode, engineerCode);
return engineerInfoMPDao.selectOne(lqw);
}
private List<EngineerInfo> queryEngineerInfoByGroupId(String groupId) {
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(EngineerInfo::getGroupId, groupId);
return engineerInfoMPDao.selectList(lqw);
}
private List<TimeLineDTO> packTimelines(List<OrderAppointment> orders, HashMap<String, List<LabelValueDTO>> orderTips) {
List<LabelValueDTO> empty = new ArrayList<>();
......
......@@ -45,7 +45,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Override
public Result<?> getOrderServiceDetail(String orderId) {
OrderRequest order = this.queryOrderDetail(orderId);
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
List<KV> items = this.packOrderDetail(order);
......@@ -156,7 +156,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
List<String> block = new ArrayList<>();
// 获取订单详情
OrderRequest order = this.queryOrderDetail(orderId);
OrderRequest order = orderRequestMPDao.getByOrderId(orderId);
OrderTeamBlockResp res = new OrderTeamBlockResp();
res.setOrderId(orderId);
......@@ -166,13 +166,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return Result.success(res);
}
private OrderRequest queryOrderDetail(String orderId) {
// 获取服务单记录
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderRequest::getOrderId, orderId);
return orderRequestMPDao.selectOne(lqw);
}
private List<OrderAppointment> queryOrderAppointments(String orderId) {
// 获取指派单记录列表
LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!