Commit 058a7f11 by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents 0b240194 9db5a71b
...@@ -19,6 +19,8 @@ package com.dituhui.pea.order.service.impl; ...@@ -19,6 +19,8 @@ package com.dituhui.pea.order.service.impl;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.CapacityUtils;
import com.dituhui.pea.order.common.SaasUtils;
import com.dituhui.pea.order.dao.OrderRequestDao; import com.dituhui.pea.order.dao.OrderRequestDao;
import com.dituhui.pea.order.dao.OrgTeamDao; import com.dituhui.pea.order.dao.OrgTeamDao;
import com.dituhui.pea.order.dao.ProductCategoryDao; import com.dituhui.pea.order.dao.ProductCategoryDao;
...@@ -59,6 +61,10 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -59,6 +61,10 @@ public class OrderCreateServiceImpl implements OrderCreateService {
@Autowired @Autowired
private CommonService commonService; private CommonService commonService;
@Autowired
private CapacityUtils capacityUtils;
@Autowired
private SaasUtils saasUtils;
private List<LabelValueDTO> getPriorities() { private List<LabelValueDTO> getPriorities() {
String[] priorities = {"紧急", "正常"}; String[] priorities = {"紧急", "正常"};
...@@ -116,9 +122,23 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -116,9 +122,23 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setCounty(location.getDistrict()); entity.setCounty(location.getDistrict());
entity.setAddress(location.getFormattedAddress()); entity.setAddress(location.getFormattedAddress());
// 根据分单,填写clusterId/branchId/groupId/teamId等 // 根据分单,填写clusterId/branchId/groupId/teamId等
String layer = productCategoryDao.getLayerByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill());
String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat()); String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat());
String teamId = commonService.getTeamIdByInput(loc, req.getAddress(), layer);
List<String> layerIds = capacityUtils.getLayers(req.getBrand(), req.getType(), req.getSkill());
List<String> blockIds = saasUtils .queryBlockIds(loc, req.getAddress());
if (blockIds == null || blockIds.size() == 0) {
log.error("分单接口没有查到对应的结果");
Result.failed(String.format("分单接口(address:%s)(location:%s) 没有查到配置区块", req.getAddress(), req.getLocation()));
}
List<String> teamIds = capacityUtils.getTeamIdsByBlockIdsAndLayerIds(blockIds, layerIds);
if (teamIds == null || teamIds.size() == 0) {
Result.failed("没有找到匹配的工作队");
}
// 选择一个工作队(理论上,只有1个合适的工作队),然后遍历下面的各个技术员,从符合技能的技术员中,汇总相关的容量
// 遍历工作队,每个工作队
String teamId = teamIds.get(0);
OrgTeamEntity teamEntity = orgTeamDao.getByTeamId(teamId); OrgTeamEntity teamEntity = orgTeamDao.getByTeamId(teamId);
entity.setOrgClusterId(teamEntity.getClusterId()); entity.setOrgClusterId(teamEntity.getClusterId());
entity.setOrgBranchId(teamEntity.getBranchId()); entity.setOrgBranchId(teamEntity.getBranchId());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!