Commit cc7d2804 by 丁伟峰

分单相关的地方修改

1 parent d615067a
......@@ -19,7 +19,8 @@ import java.util.List;
@Slf4j
public class SaasUtils {
@Value("${SaaS.ak}")
// todo
@Value("284c57cbabad4755a9c657885a8df3e2")
String ak;
@Value("${SaaS.url}")
......@@ -56,9 +57,9 @@ public class SaasUtils {
assert rs != null;
for (SaasXyFendanDTO.AreaInfo r : rs.getResult()) {
// 分单接口暂时无图层返回
if (r.getField2() != null && r.getField1() != null) {
if (r.getField3() != null && r.getField1() != null) {
blocks.add(new BlockInfo()
.setBlockId(r.getField2())
.setBlockId(r.getField3())
.setBlockName(r.getField1()));
}
}
......
......@@ -51,8 +51,8 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
public Result<?> queryMatchCapacityData(CapacityOrderQueryDTO.Request reqDTO) {
// 单条容量查询
log.info("===> queryMatchCapacityData()");
List<String> layerIds = capacityUtils.getLayers(reqDTO.getBrand(), reqDTO.getType(), reqDTO.getSkill());
String peaBrand = fixBrand(reqDTO.getBrand());
List<String> layerIds = capacityUtils.getLayers(peaBrand, reqDTO.getType(), reqDTO.getSkill());
// 同步到saas,返回blockId
List<String> blockIds = null;
......@@ -61,12 +61,12 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
} else {
blockIds = saasUtils.queryBlocksByAddress(reqDTO.getAddress()).stream().map(SaasUtils.BlockInfo::getBlockId).collect(Collectors.toList());
}
if (blockIds.size() == 0) {
if (blockIds.isEmpty()) {
log.error("分单接口没有查到对应的结果");
Result.failed(String.format("分单接口(address:%s)(location:%s) 没有查到配置区块", reqDTO.getAddress(), reqDTO.getLocation()));
}
List<String> teamIds = capacityUtils.getTeamIdsByBlockIdsAndLayerIds(blockIds, layerIds);
if (teamIds == null || teamIds.size() == 0) {
if (teamIds == null || teamIds.isEmpty()) {
return Result.failed("没有找到匹配的工作队");
}
......@@ -77,13 +77,13 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
.map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
log.info("======= enginerCode: {}", engineerCodes);
List<String> matchEngineerCodes = engineerSkillDao.findAllByBrandAndTypeAndSkillAndEngineerCodeIn(reqDTO.getBrand(), reqDTO.getType(), reqDTO.getSkill(), engineerCodes).stream()
List<String> matchEngineerCodes = engineerSkillDao.findAllByBrandAndTypeAndSkillAndEngineerCodeIn(peaBrand, reqDTO.getType(), reqDTO.getSkill(), engineerCodes).stream()
.map(EngineerSkillEntity::getEngineerCode).collect(Collectors.toList());
log.info("======= matchEngineerCodes: {}", matchEngineerCodes);
log.info("符合技能要求的工作队[{}]符合技能要求的技术员[{}]", teamId, matchEngineerCodes);
SkillInfoEntity skillInfoEntity = skillInfoDao.getByBrandAndTypeAndSkill(reqDTO.getBrand(), reqDTO.getType(), reqDTO.getSkill());
SkillInfoEntity skillInfoEntity = skillInfoDao.getByBrandAndTypeAndSkill(peaBrand, reqDTO.getType(), reqDTO.getSkill());
List<CapacityOrderQueryDTO.CalendarDTO> calendars = getSummaryOfEngineersCapacity(teamId, matchEngineerCodes, reqDTO.getStartDate(), reqDTO.getEndDate(), skillInfoEntity.getTakeTime());
CapacityOrderQueryDTO.Result rs = new CapacityOrderQueryDTO.Result();
......@@ -179,4 +179,12 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
calendar.setTimes(List.of(timeDTO));
return calendar;
}
private String fixBrand(String brand){
if (!brand.equals("嘉格纳")){
return "博世/西门子以及其他品牌";
} else {
return brand;
}
}
}
......@@ -120,7 +120,8 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setName(req.getName());
entity.setPhone(req.getPhone());
entity.setBeanBrand(req.getBrand());
entity.setBrand(fixBrand(req.getBrand()));
String peaBrand = fixBrand(req.getBrand());
entity.setBrand(peaBrand);
entity.setType(req.getType());
entity.setSkill(req.getSkill());
entity.setFaultDescribe(req.getFaultDescribe());
......@@ -151,7 +152,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setAppointmentMethod("AUTO_NOW");
entity.setWorkshop(false);
SkillInfoEntity skillInfoEntity = skillInfoDao.getByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill());
SkillInfoEntity skillInfoEntity = skillInfoDao.getByBrandAndTypeAndSkill(peaBrand, req.getType(), req.getSkill());
assert skillInfoEntity != null;
entity.setTakeTime(skillInfoEntity.getTakeTime());
// 基础保存
......@@ -159,19 +160,19 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 分单处理
List<String> blockIds = null;
List<String> layerIds = capacityUtils.getLayers(req.getBrand(), req.getType(), req.getSkill());
List<String> layerIds = capacityUtils.getLayers(peaBrand, req.getType(), req.getSkill());
if (req.getLocation() != null) {
String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat());
blockIds = saasUtils.queryBlocksByLocation(loc).stream().map(SaasUtils.BlockInfo::getBlockId).collect(Collectors.toList());
} else {
blockIds = saasUtils.queryBlocksByAddress(req.getAddress()).stream().map(SaasUtils.BlockInfo::getBlockId).collect(Collectors.toList());
}
if (blockIds.size() == 0) {
if (blockIds.isEmpty()) {
log.error("分单接口没有查到对应的结果");
return 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) {
if (teamIds == null || teamIds.isEmpty()) {
return Result.failed("没有找到匹配的工作队");
}
// 选择一个工作队(理论上,只有1个合适的工作队),然后遍历下面的各个技术员,从符合技能的技术员中,汇总相关的容量
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!