Commit 130561b8 by 丁伟峰

甘特图中的订单,增加了caption字段,用于返回技能类型;使用了SpringDataJPA的投影(Projection)功能实现

1 parent e5106a1d
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
/*/logs/ /*/logs/
/*/.gitignore /*/.gitignore
dispatchSolution-*.json dispatchSolution-*.json
/project-order/src/main/resources/application-dev.yaml
...@@ -2,14 +2,21 @@ package com.dituhui.pea.order.dao; ...@@ -2,14 +2,21 @@ package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.OrderRequestEntity; import com.dituhui.pea.order.entity.OrderRequestEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public interface OrderRequestDao extends JpaRepository <OrderRequestEntity, Long> { public interface OrderRequestDao extends JpaRepository<OrderRequestEntity, Long> {
OrderRequestEntity getByOrderId(String orderId); OrderRequestEntity getByOrderId(String orderId);
List<OrderRequestEntity> findAllByOrderIdIn(List<String> orderIds); List<OrderRequestEntity> findAllByOrderIdIn(List<String> orderIds);
@Query("SELECT o.orderId, s.skillCategory as skillCaption FROM OrderRequestEntity o JOIN SkillInfoEntity s on o.brand=s.brand and o.type=s.type and o.skill=s.skill WHERE o.orderId = :orderId")
OrderSkillProjection getOrderSkillCaptionByOrderId(@Param("orderId") String orderId);
} }
package com.dituhui.pea.order.dao;
public interface OrderSkillProjection {
String getOrderId();
String getSkillCaption();
}
...@@ -80,6 +80,8 @@ public class EngineersGanttDTO { ...@@ -80,6 +80,8 @@ public class EngineersGanttDTO {
* 工单ID * 工单ID
*/ */
private String orderId; private String orderId;
private String caption;
/** /**
* 排班状态 * 排班状态
*/ */
......
...@@ -117,7 +117,7 @@ public class CapacityQueryServiceImpl implements CapacityQueryService { ...@@ -117,7 +117,7 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
OrgTeamEntity orgTeamEntity = orgTeamDao.getByTeamId(teamId); OrgTeamEntity orgTeamEntity = orgTeamDao.getByTeamId(teamId);
SpanInfo r = new SpanInfo(); SpanInfo r = new SpanInfo();
if ("全天".equals(timeSpan)) { if ("全天".equals(timeSpan)) {
r.setTitle("全天都可以"); r.setTitle("全天");
r.setTimeBegin(String.format("%s %s:00", date, orgTeamEntity.getWorkOn())); r.setTimeBegin(String.format("%s %s:00", date, orgTeamEntity.getWorkOn()));
r.setTimeEnd(String.format("%s %s:00", date, orgTeamEntity.getWorkOff())); r.setTimeEnd(String.format("%s %s:00", date, orgTeamEntity.getWorkOff()));
} else { } else {
......
...@@ -2,16 +2,10 @@ package com.dituhui.pea.order.service.impl; ...@@ -2,16 +2,10 @@ package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.EngineerUtils; import com.dituhui.pea.order.common.EngineerUtils;
import com.dituhui.pea.order.dao.CapacityEngineerStatDao; import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dao.EngineerInfoDao;
import com.dituhui.pea.order.dao.OrderAppointmentDao;
import com.dituhui.pea.order.dao.OrderRequestDao;
import com.dituhui.pea.order.dto.EngineersGanttDTO; import com.dituhui.pea.order.dto.EngineersGanttDTO;
import com.dituhui.pea.order.dto.LabelValueDTO; import com.dituhui.pea.order.dto.LabelValueDTO;
import com.dituhui.pea.order.entity.CapacityEngineerStatEntity; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.entity.EngineerInfoEntity;
import com.dituhui.pea.order.entity.OrderAppointmentEntity;
import com.dituhui.pea.order.entity.OrderRequestEntity;
import com.dituhui.pea.order.service.EngineerGanttService; import com.dituhui.pea.order.service.EngineerGanttService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -63,6 +57,11 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -63,6 +57,11 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
order.setStartTime(e.getExpectStartTime()).setEndTime(e.getExpectEndTime()); order.setStartTime(e.getExpectStartTime()).setEndTime(e.getExpectEndTime());
order.setOrderId(e.getOrderId()).setPreStatus(e.getPreStatus()); order.setOrderId(e.getOrderId()).setPreStatus(e.getPreStatus());
order.setTips(getOrderTips(e.getOrderId())); order.setTips(getOrderTips(e.getOrderId()));
OrderSkillProjection orderSkill = orderRequestDao.getOrderSkillCaptionByOrderId(e.getOrderId());
if (orderSkill != null) {
order.setCaption(orderSkill.getSkillCaption());
}
order.setAppointmentStatus(mapOrderRequest.get(e.getOrderId()).getAppointmentStatus()); order.setAppointmentStatus(mapOrderRequest.get(e.getOrderId()).getAppointmentStatus());
List<EngineersGanttDTO.Order> orders = null; List<EngineersGanttDTO.Order> orders = null;
if (mapEngineers.containsKey(e.getEngineerCode())) { if (mapEngineers.containsKey(e.getEngineerCode())) {
...@@ -156,5 +155,4 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -156,5 +155,4 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
tips.add(new LabelValueDTO().setLabel("标签").setValue(order.getTags())); tips.add(new LabelValueDTO().setLabel("标签").setValue(order.getTags()));
return tips; return tips;
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!