Commit d4c3e888 by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents a2fe7924 bfa0d97c
package com.dituhui.pea.order.dto; package com.dituhui.pea.order.dto;
import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.List; import java.util.List;
@lombok.Data @lombok.Data
@Accessors(chain = true) public class OrganizationTreeDTO {
public class OrganizationTreeRespDTO {
@Data
public static class Request {
private String levelType;
private String levelValue;
}
@lombok.Data
@Accessors(chain = true)
public static class Result {
private String levelType;
private String levelValue;
private List<?> clusters; private List<?> clusters;
}
@lombok.Data @lombok.Data
@Accessors(chain = true) @Accessors(chain = true)
...@@ -74,4 +88,3 @@ public class OrganizationTreeRespDTO { ...@@ -74,4 +88,3 @@ public class OrganizationTreeRespDTO {
private String type; private String type;
} }
} }
package com.dituhui.pea.order.dto;
@lombok.Data
public class OrganizationTreeReqDTO {
private String levelType;
private String levelValue;
}
...@@ -57,7 +57,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -57,7 +57,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
Map<String, OrderRequestEntity> mapOrderRequest = getOrdersByOrderIds(orderIds); Map<String, OrderRequestEntity> mapOrderRequest = getOrdersByOrderIds(orderIds);
HashMap<String, List<EngineersGanttDTO.Order>> mapEngineers = new HashMap<>(); HashMap<String, List<EngineersGanttDTO.Order>> mapEngineers = new HashMap<>();
for (OrderAppointmentEntity e : orderAppointments) { for (OrderAppointmentEntity e : orderAppointments) {
log.info("===== order_id: [{}]", e.getOrderId()); // log.info("===== order_id: [{}]", e.getOrderId());
EngineersGanttDTO.Order order = new EngineersGanttDTO.Order(); EngineersGanttDTO.Order order = new EngineersGanttDTO.Order();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX // todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
order.setStartTime(e.getExpectStartTime()).setEndTime(e.getExpectEndTime()); order.setStartTime(e.getExpectStartTime()).setEndTime(e.getExpectEndTime());
...@@ -89,7 +89,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -89,7 +89,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
if (capacityEngineerStat == null) { if (capacityEngineerStat == null) {
log.warn("技术员当日的容量数据不存在,{}{}", engineerCode, reqDTO.getDate()); log.warn("技术员当日的容量数据不存在,{}{}", engineerCode, reqDTO.getDate());
} else { } else {
log.info("====== {} ==== {} ", capacityEngineerStat.getCapTotal(), capacityEngineerStat.getCapUsed()); log.info("====== {}", capacityEngineerStat);
engineer.setCapTotal(capacityEngineerStat.getCapTotal().toString()).setCapUsed(capacityEngineerStat.getCapUsed().toString()); engineer.setCapTotal(capacityEngineerStat.getCapTotal().toString()).setCapUsed(capacityEngineerStat.getCapUsed().toString());
} }
if (mapEngineers.containsKey(engineerCode)) { if (mapEngineers.containsKey(engineerCode)) {
......
...@@ -31,13 +31,14 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -31,13 +31,14 @@ public class OrganizationServiceImpl implements OrganizationService {
private EngineerInfoDao engineerInfoDao; private EngineerInfoDao engineerInfoDao;
@Autowired @Autowired
private OrgTeamDao orgTeamDao; private OrgTeamDao orgTeamDao;
@Autowired @Autowired
private EngineerUtils engineerUtils; private EngineerUtils engineerUtils;
@Override @Override
public Result<?> getOrganizationTree(String levelType, String levelValue) { public Result<?> getOrganizationTree(String levelType, String levelValue) {
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容 // 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
OrganizationTreeDTO.Result rs = new OrganizationTreeDTO.Result();
rs.setLevelType(levelType).setLevelValue(levelValue);
if ("group".equals(levelType)) { if ("group".equals(levelType)) {
OrgGroupEntity orgGroupEntity = orgGroupDao.getByGroupId(levelValue); OrgGroupEntity orgGroupEntity = orgGroupDao.getByGroupId(levelValue);
if (orgGroupEntity == null) { if (orgGroupEntity == null) {
...@@ -48,7 +49,7 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -48,7 +49,7 @@ public class OrganizationServiceImpl implements OrganizationService {
List<?> branchs = new ArrayList<>(Collections.singletonList(branchEntityh2Dto(orgBranchEntity).setChildren(groups))); List<?> branchs = new ArrayList<>(Collections.singletonList(branchEntityh2Dto(orgBranchEntity).setChildren(groups)));
OrgClusterEntity orgClusterEntity = orgClusterDao.getByClusterId(orgGroupEntity.getClusterId()); OrgClusterEntity orgClusterEntity = orgClusterDao.getByClusterId(orgGroupEntity.getClusterId());
List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs))); List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs)));
return Result.success(new OrganizationTreeRespDTO().setClusters(clusters)); rs.setClusters(clusters);
} else if ("branch".equals(levelType)) { } else if ("branch".equals(levelType)) {
OrgBranchEntity orgBranchEntity = orgBranchDao.getByBranchId(levelValue); OrgBranchEntity orgBranchEntity = orgBranchDao.getByBranchId(levelValue);
if (orgBranchEntity == null) { if (orgBranchEntity == null) {
...@@ -58,7 +59,7 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -58,7 +59,7 @@ public class OrganizationServiceImpl implements OrganizationService {
List<?> groups = getChildByBranch(levelValue); List<?> groups = getChildByBranch(levelValue);
List<?> branchs = new ArrayList<>(Collections.singletonList(branchEntityh2Dto(orgBranchEntity).setChildren(groups))); List<?> branchs = new ArrayList<>(Collections.singletonList(branchEntityh2Dto(orgBranchEntity).setChildren(groups)));
List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs))); List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs)));
return Result.success(new OrganizationTreeRespDTO().setClusters(clusters)); rs.setClusters(clusters);
} else if ("cluster".equals(levelType)) { } else if ("cluster".equals(levelType)) {
OrgClusterEntity orgClusterEntity = orgClusterDao.getByClusterId(levelValue); OrgClusterEntity orgClusterEntity = orgClusterDao.getByClusterId(levelValue);
if (orgClusterEntity == null) { if (orgClusterEntity == null) {
...@@ -66,10 +67,11 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -66,10 +67,11 @@ public class OrganizationServiceImpl implements OrganizationService {
} }
List<?> branchs = getChildByCluster(levelValue); List<?> branchs = getChildByCluster(levelValue);
List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs))); List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs)));
return Result.success(new OrganizationTreeRespDTO().setClusters(clusters)); rs.setClusters(clusters);
} else { } else {
return Result.success(new OrganizationTreeRespDTO().setClusters(getTreeByRoot())); rs.setClusters(getTreeByRoot());
} }
return Result.success(rs);
} }
@Override @Override
...@@ -128,7 +130,7 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -128,7 +130,7 @@ public class OrganizationServiceImpl implements OrganizationService {
} }
private List<?> getTreeByRoot() { private List<?> getTreeByRoot() {
List<OrganizationTreeRespDTO.Cluster> clusters = new ArrayList<>(); List<OrganizationTreeDTO.Cluster> clusters = new ArrayList<>();
for (OrgClusterEntity c : orgClusterDao.findAll()) { for (OrgClusterEntity c : orgClusterDao.findAll()) {
clusters.add(clusterEntity2Dto(c).setChildren(getChildByCluster(c.getClusterId()))); clusters.add(clusterEntity2Dto(c).setChildren(getChildByCluster(c.getClusterId())));
} }
...@@ -136,7 +138,7 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -136,7 +138,7 @@ public class OrganizationServiceImpl implements OrganizationService {
} }
private List<?> getChildByCluster(String clusterId) { private List<?> getChildByCluster(String clusterId) {
List<OrganizationTreeRespDTO.Branch> branches = new ArrayList<>(); List<OrganizationTreeDTO.Branch> branches = new ArrayList<>();
for (OrgBranchEntity b : orgBranchDao.findAllByClusterId(clusterId)) { for (OrgBranchEntity b : orgBranchDao.findAllByClusterId(clusterId)) {
branches.add(branchEntityh2Dto(b).setChildren(getChildByBranch(b.getBranchId()))); branches.add(branchEntityh2Dto(b).setChildren(getChildByBranch(b.getBranchId())));
} }
...@@ -145,30 +147,29 @@ public class OrganizationServiceImpl implements OrganizationService { ...@@ -145,30 +147,29 @@ public class OrganizationServiceImpl implements OrganizationService {
private List<?> getChildByBranch(String branchId) { private List<?> getChildByBranch(String branchId) {
// 获取branch及下面的group // 获取branch及下面的group
List<OrganizationTreeRespDTO.Group> groups = new ArrayList<>(); List<OrganizationTreeDTO.Group> groups = new ArrayList<>();
for (OrgGroupEntity g : orgGroupDao.findAllByBranchId(branchId)) { for (OrgGroupEntity g : orgGroupDao.findAllByBranchId(branchId)) {
groups.add(groupEntity2Dto(g)); groups.add(groupEntity2Dto(g));
} }
return groups; return groups;
} }
private OrganizationTreeDTO.Group groupEntity2Dto(OrgGroupEntity orgGroupEntity) {
private OrganizationTreeRespDTO.Group groupEntity2Dto(OrgGroupEntity orgGroupEntity) { return new OrganizationTreeDTO.Group()
return new OrganizationTreeRespDTO.Group()
.setType("group") .setType("group")
.setId(orgGroupEntity.getGroupId()) .setId(orgGroupEntity.getGroupId())
.setTitle(orgGroupEntity.getGroupName()); .setTitle(orgGroupEntity.getGroupName());
} }
private OrganizationTreeRespDTO.Branch branchEntityh2Dto(OrgBranchEntity orgBranchEntity) { private OrganizationTreeDTO.Branch branchEntityh2Dto(OrgBranchEntity orgBranchEntity) {
return new OrganizationTreeRespDTO.Branch() return new OrganizationTreeDTO.Branch()
.setType("branch") .setType("branch")
.setId(orgBranchEntity.getBranchId()) .setId(orgBranchEntity.getBranchId())
.setTitle(orgBranchEntity.getBranchName()); .setTitle(orgBranchEntity.getBranchName());
} }
private OrganizationTreeRespDTO.Cluster clusterEntity2Dto(OrgClusterEntity orgClusterEntity) { private OrganizationTreeDTO.Cluster clusterEntity2Dto(OrgClusterEntity orgClusterEntity) {
return new OrganizationTreeRespDTO.Cluster() return new OrganizationTreeDTO.Cluster()
.setType("cluster") .setType("cluster")
.setId(orgClusterEntity.getClusterId()) .setId(orgClusterEntity.getClusterId())
.setTitle(orgClusterEntity.getName()); .setTitle(orgClusterEntity.getName());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!