Commit d8211205 by chamberone

Merge branch 'develop' of https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…

…oject.git into develop
2 parents b890dd07 a4a3fdbc
......@@ -108,6 +108,12 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter</artifactId>
<version>6.22.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -126,20 +126,18 @@ public class DispatchServiceImpl implements DispatchService {
public Result<?> getDispatchEngineerOrderList(DispatchEngineerOrderListReq reqDTO) throws BusinessException {
// 派工台技术员预约单列表
// 获取技能耗时
HashMap<String, Integer> skillTakeTime = this.querySkillTakeTime();
// 获取技能信息
HashMap<String, SkillInfo> skillInfo = this.querySkillInfo();
// 获取groupIds
List<String> groupIds = this.queryOrgGroupIds(reqDTO.getLevelType(), reqDTO.getLevelValue(), reqDTO.getBranchIds(),
List<String> teamIds = this.queryOrgTeamIds(reqDTO.getLevelType(), reqDTO.getLevelValue(), reqDTO.getBranchIds(),
reqDTO.getGroupIds(), reqDTO.getTeamIds());
if (groupIds.isEmpty()) {
if (teamIds.isEmpty()) {
throw new BusinessException("大区/分部/小组组织结构配置可能错误或缺失,请联系管理员/研发");
}
// 获取engineer列表
List<EngineerInfo> engineers = this.queryEngineers(groupIds, reqDTO.getEngineerCodes(), reqDTO.getKey());
List<EngineerInfo> engineers = this.queryEngineers(teamIds, reqDTO.getEngineerCodes(), reqDTO.getKey());
if (engineers.isEmpty()) {
// 该group下没有技术员,返回空
DispatchEngineerOrderListResp res = new DispatchEngineerOrderListResp();
......@@ -398,13 +396,16 @@ public class DispatchServiceImpl implements DispatchService {
}
private List<EngineerInfo> queryEngineers(List<String> groupIds, List<String> engineerCodes, String key) {
private List<EngineerInfo> queryEngineers(List<String> teamIds, List<String> engineerCodes, String key) {
// 通过groupIds获取技术员列表
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.in(EngineerInfo::getGroupId, groupIds);
lqw.eq(EngineerInfo::getBeanStatus, 1);
lqw.in(ListUtils.isNotEmpty(engineerCodes), EngineerInfo::getEngineerCode, engineerCodes);
String inTeamIds = "'" + teamIds.stream().map(Object::toString).collect(Collectors.joining("','")) + "'";
String sql = String.format("select 1 from org_team_engineer ot where ot.engineer_code = engineer_info.engineer_code and ot.team_id in (%s)", inTeamIds);
lqw.exists(sql);
if (StringUtils.isNotEmpty(key)) {
lqw.and(w ->
w.like(EngineerInfo::getPhone, key)
......@@ -418,7 +419,7 @@ public class DispatchServiceImpl implements DispatchService {
return engineerInfoMPDao.selectList(lqw);
}
private List<String> queryOrgGroupIds(String levelType, String levelIds, List<String> branchIds, List<String> groupIds, List<String> teamIds) {
private List<String> queryOrgTeamIds(String levelType, String levelIds, List<String> branchIds, List<String> groupIds, List<String> teamIds) {
LambdaQueryWrapper<OrgTeam> lqw = new LambdaQueryWrapper<>();
lqw.eq(levelType.equals("cluster"), OrgTeam::getClusterId, levelIds);
lqw.eq(levelType.equals("branch"), OrgTeam::getBranchId, levelIds);
......@@ -427,8 +428,8 @@ public class DispatchServiceImpl implements DispatchService {
lqw.in(ListUtils.isNotEmpty(groupIds), OrgTeam::getGroupId, groupIds);
lqw.in(ListUtils.isNotEmpty(teamIds), OrgTeam::getTeamId, teamIds);
List<OrgTeam> groups = orgTeamMPDao.selectList(lqw);
return groups.stream().map(OrgTeam::getGroupId).collect(Collectors.toList());
List<OrgTeam> teams = orgTeamMPDao.selectList(lqw);
return teams.stream().map(OrgTeam::getTeamId).collect(Collectors.toList());
}
private HashMap<String, Integer> querySkillTakeTime() {
......
......@@ -70,20 +70,20 @@ public class OrderAssignImpl implements OrderAssign {
String date = TimeUtils.timestamp2DateTime(order.getExpectTimeBegin(), TimeUtils.DATE_GAP_FORMAT);
// 获取group内的小组成
// 获取符合筛选条件的技术
List<String> engineerCodes = this.searchEngineerCodes(order, distance, key, recommend);
List<EngineerInfo> engineers = engineerInfoMPDao.selectByEngineerCodes(engineerCodes);
List<OrderAssignRecommendResp.Engineer> items = new ArrayList<>();
for (EngineerInfo engineer : engineers) {
OrderAssignCheck.Result result = orderAssignCheck.orderAssignCheck(orderId, engineer.getEngineerCode());
log.info("指派检查结果:{}", result);
if (!result.getCanAssign()) {
continue;
}
// 获取已技术员已指派订单列表
List<OrderAppointment> orderAppointments = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineer.getEngineerCode(), order.getDt());
// 获取订单tips
......@@ -306,13 +306,14 @@ public class OrderAssignImpl implements OrderAssign {
return new ArrayList<>();
}
/*
if (StringUtils.isEmpty(distance)) {
return new ArrayList<>(engineerCodes1);
}
//进行距离匹配TODO
*/
return null;
return new ArrayList<>(engineerCodes1);
}
private Set<String> searchEngineerByRecommend(OrderRequest order, String recommend) {
......
......@@ -120,7 +120,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setExpectTimeBegin(LocalDateTimeUtil.parse(req.getExpectBegin(), PATTERN_DATETIME));
entity.setExpectTimeEnd(LocalDateTimeUtil.parse(req.getExpectEnd(), PATTERN_DATETIME));
entity.setExpectTimeDesc(req.getExpectDesc());
entity.setDescription(req.getDescription());
entity.setApplyNote(req.getDescription()); // order_request的description字段,仅仅用于内部备注,不对外
entity.setDt(LocalDateTimeUtil.parseDate(req.getExpectBegin().substring(0, 10), PATTERN_DATE));
// location
LocationDTO location = req.getLocation();
......@@ -128,7 +128,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setCity(location.getCity());
entity.setCounty(location.getDistrict());
entity.setAddress(location.getFormattedAddress());
// 根据分单,填写clusterId/branchId/groupId/teamId等
List<String> blockIds = null;
List<String> layerIds = capacityUtils.getLayers(req.getBrand(), req.getType(), req.getSkill());
......@@ -152,6 +151,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 遍历工作队,每个工作队
String teamId = teamIds.get(0);
OrgTeamEntity teamEntity = orgTeamDao.getByTeamId(teamId);
// 根据分单,填写clusterId/branchId/groupId/teamId等
entity.setOrgClusterId(teamEntity.getClusterId());
entity.setOrgBranchId(teamEntity.getBranchId());
entity.setOrgGroupId(teamEntity.getGroupId());
......
......@@ -46,3 +46,12 @@ mybatis-plus:
id-type: auto
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
sentry:
dsn: http://85293a9310fc4a8187422a7a257fc1ba@sentry.zjhuixinyun.com/8
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
tracesSampleRate: 1.0
exception-resolver-order: -2147483647
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!