Commit 81811923 by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents a662680b 0785312e
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.OrderChangeEntity;
import org.hibernate.annotations.Where;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.time.LocalDate;
import java.util.Date;
@Repository
@Where(clause = "status = 1")
public interface OrderChangeDao extends JpaRepository<OrderChangeEntity, Integer> {
@Query("select a from OrderChangeEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgClusterId = :clusterId and Date(a.createTime) = :date")
Page<OrderChangeEntity> findAllByClusterId(String clusterId, LocalDate date, Pageable pageable);
@Query("select a from OrderChangeEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgBranchId = :branchId and Date(a.createTime) = :date")
Page<OrderChangeEntity> findAllByBranchId(String branchId, LocalDate date, Pageable pageable);
@Query("select a from OrderChangeEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgGroupId = :groupId and Date(a.createTime) = :date")
Page<OrderChangeEntity> findAllByGroupId(String groupId, LocalDate date, Pageable pageable);
}
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.OrderEventEntity;
import org.hibernate.annotations.Where;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.time.LocalDate;
@Repository
@Where(clause = "status = 1")
public interface OrderEventDao extends JpaRepository<OrderEventEntity, Integer> {
@Query("select a from OrderEventEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgClusterId = :clusterId and Date(a.createTime) = :date")
Page<OrderEventEntity> findAllByClusterId(String clusterId, LocalDate date, Pageable pageable);
@Query("select a from OrderEventEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgBranchId = :branchId and Date(a.createTime) = :date")
Page<OrderEventEntity> findAllByBranchId(String branchId, LocalDate date, Pageable pageable);
@Query("select a from OrderEventEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgGroupId = :groupId and Date(a.createTime) = :date")
Page<OrderEventEntity> findAllByGroupId(String groupId, LocalDate date, Pageable pageable);
}
package com.dituhui.pea.order.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDateTime;
@Entity
@Data
@Accessors(chain = true)
public class OrderEventEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String orderId;
private String suborderId;
private LocalDateTime happen;
private String event;
private String operator;
private String operatorName;
private String source;
private String description;
private String memo;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}
......@@ -5,6 +5,6 @@ public interface CommonService {
String getTeamIdByInput(String location, String address, String layer);
void addOrderChange(String orderId, String subOrderId, String source, String operator, String content, String memo);
void addOrderEvent(String orderId, String subOrderId, String source, String operator, String event, String content, String memo);
}
......@@ -2,8 +2,8 @@ package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.order.dao.CapacityTeamStatDao;
import com.dituhui.pea.order.dao.MapBlockInfoDao;
import com.dituhui.pea.order.dao.OrderChangeDao;
import com.dituhui.pea.order.entity.OrderChangeEntity;
import com.dituhui.pea.order.dao.OrderEventDao;
import com.dituhui.pea.order.entity.OrderEventEntity;
import com.dituhui.pea.order.service.CommonService;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
......@@ -33,7 +33,7 @@ public class CommonServiceImpl implements CommonService {
private CapacityTeamStatDao capacityTeamStatDao;
@Autowired
private OrderChangeDao orderChangeDao;
private OrderEventDao orderEventDao;
public String getTeamIdByInput(String location, String address, String layer) {
// todo 目前会随机兜底,后面将合理化
......@@ -132,10 +132,11 @@ public class CommonServiceImpl implements CommonService {
private String areaName;
}
public void addOrderChange(String orderId, String subOrderId, String source, String operator, String content, String memo) {
OrderChangeEntity entity = new OrderChangeEntity();
entity.setOrderId(orderId).setSuborderId(subOrderId).setSource(source).setOperator(operator).setContent(content).setMemo(memo);
public void addOrderEvent(String orderId, String subOrderId, String source, String operator, String event, String content, String memo) {
OrderEventEntity entity = new OrderEventEntity();
entity.setOrderId(orderId).setSuborderId(subOrderId).setSource(source).setOperator(operator);
entity.setEvent(event).setDescription(content).setMemo(memo);
entity.setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now());
orderChangeDao.save(entity);
orderEventDao.save(entity);
}
}
......@@ -154,7 +154,7 @@ public class OrderAssignImpl implements OrderAssign {
orderRequestMPDao.update(null, wrapper);
// 工单变更登记
commonService.addOrderChange(orderId, "", "PEA-WEB", "API", "工单指派", "" );
commonService.addOrderEvent(orderId, "", "PEA-WEB", "API", "工单指派", "工单指派","" );
return Result.success(null);
}
......
......@@ -140,7 +140,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setCategoryId(catalogId);
orderRequestDao.save(entity);
// 登记
commonService.addOrderChange(orderId, "", req.getSource(), "API", "创建订单", "" );
commonService.addOrderEvent(orderId, "", req.getSource(), "API", "创建订单", "创建订单", "" );
return Result.success(null);
}
}
......@@ -22,9 +22,6 @@ import java.util.List;
public class WorkbenchServiceImpl implements WorkbenchService {
@Autowired
private OrderChangeDao orderChangeDao;
@Autowired
private OrderRequestDao orderRequestDao;
@Autowired
......@@ -36,6 +33,9 @@ public class WorkbenchServiceImpl implements WorkbenchService {
@Autowired
private CapacityEngineerStatDao capacityEngineerStatDao;
@Autowired
private OrderEventDao orderEventDao;
@Override
public Result<?> getOrderChangeList(OrderChangeListReqDTO reqDTO) {
Pageable pageable = PageRequest.of(reqDTO.getPage() - 1, reqDTO.getSize());
......@@ -43,11 +43,11 @@ public class WorkbenchServiceImpl implements WorkbenchService {
String levelType = reqDTO.getLevelType();
String levelValue = reqDTO.getLevelValue();
if ("cluster".equals(levelType)) {
changes = orderChangeDao.findAllByClusterId(levelValue, reqDTO.getDate(), pageable);
changes = orderEventDao.findAllByClusterId(levelValue, reqDTO.getDate(), pageable);
} else if ("branch".equals(levelType)) {
changes = orderChangeDao.findAllByBranchId(levelValue, reqDTO.getDate(), pageable);
changes = orderEventDao.findAllByBranchId(levelValue, reqDTO.getDate(), pageable);
} else {
changes = orderChangeDao.findAllByGroupId(levelValue, reqDTO.getDate(), pageable);
changes = orderEventDao.findAllByGroupId(levelValue, reqDTO.getDate(), pageable);
}
List<OrderChangeListRespDTO.Content> contents = new ArrayList<>();
for (Object e1 : changes.getContent()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!