Commit c838ec90 by chamberone

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

…oject.git into develop
2 parents c140a1dc 950a2985
Showing with 364 additions and 201 deletions
......@@ -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()));
}
}
......
package com.dituhui.pea.order.controller;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dto.EngineerCalendarDTO;
import com.dituhui.pea.order.service.EngineerCalendarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/pea-order")
public class EngineerCalendarController {
@Autowired
EngineerCalendarService engineerCalendarService;
@GetMapping("/engineer/calendar")
public Result<?> getEngineerCalendar(@Validated EngineerCalendarDTO.Request reqDTO) {
Result<?> res = null;
try {
res = engineerCalendarService.getEngineersCalendar(reqDTO);
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return res;
}
@GetMapping("/engineer/calendar/type/list")
public Result<?> getCalendarTypeList() {
Result<?> res = null;
try {
res = engineerCalendarService.getCalendarTypeList();
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return res;
}
}
......@@ -41,6 +41,7 @@ public class EngineerCenterPoiController {
result.setGroup(engineerBusinessService.getGroupInfo(engineerReq));
result.setWarehouse(engineerBusinessService.getWareHouse(result.getGroup().getWarehouseId()));
result.setBlocks(engineerBusinessService.getBlocks(engineerReq));
res = Result.success(result);
} catch (BusinessException e) {
return Result.failed(e.getMessage());
......
......@@ -151,15 +151,4 @@ public class EngineerController {
}
return res;
}
@GetMapping("/engineer/calendar")
public Result<?> getEngineerCalendar(@Validated EngineerCalendarDTO.Request reqDTO) {
Result<?> res = null;
try {
res = engineerCalendarService.getEngineersCalendar(reqDTO);
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return res;
}
}
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.EngineerSkillGroupEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
public interface EngineerSkillGroupDao extends JpaRepository<EngineerSkillGroupEntity, Integer> {
List<EngineerSkillGroupEntity> findByEngineerCode(String engineerCode);
List<EngineerSkillGroupEntity> findByEngineerCodeAndStatus(String engineerCode, boolean status);
List<EngineerSkillGroupEntity> findByEngineerCodeInAndStatus(List<String> engineerCodes, boolean status);
List<EngineerSkillGroupEntity> findBySkillGroupCode(String skillGroupCode);
List<EngineerSkillGroupEntity> findBySkillGroupCodeAndStatus(String skillGroupCode, boolean status);
}
......@@ -13,6 +13,8 @@ public interface MapBlockInfoDao extends JpaRepository<MapBlockInfoEntity, Integ
List<MapBlockInfoEntity> findByBlockIdInAndLayerIdIn(List<String> blockIds, List<String> layerIds);
MapBlockInfoEntity findByBlockId(String blockId);
List<MapBlockInfoEntity> findByGroupId(String groupId);
List<MapBlockInfoEntity> findByLayerId(String layerId);
......
......@@ -8,10 +8,13 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
public interface OrderEventDao extends JpaRepository<OrderEventEntity, Integer> {
List<OrderEventEntity> findByOrderId(String orderId);
@Query("select a from OrderEventEntity a join OrderInfoEntity b on a.orderId=b.orderId where b.orgClusterId = :clusterId and DATE(a.createTime) = :date")
Page<OrderEventEntity> findAllByClusterId(String clusterId, Date date, Pageable pageable);
......
......@@ -9,6 +9,9 @@ import java.util.List;
public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long> {
OrderInfoEntity getByOrderId(String orderId);
OrderInfoEntity getByOrderIdAndDt(String orderId, LocalDate dt);
List<OrderInfoEntity> findByOrderId(String orderId);
List<OrderInfoEntity> findByDtAndEngineerCodeIn(LocalDate date, List<String> engineerCodes);
......
package com.dituhui.pea.order.dto;
import java.util.List;
public class CalendarBatAddDTO {
@lombok.Data
public static class Request {
/**
* 结束时间;如果是全天只需要填写日期;否则填写日期+时间
*/
private String end;
/**
* 技术员code列表
*/
private List<String> engineerCodes;
/**
* 是否全天
*/
private long isAllday;
/**
* 备注
*/
private String remark;
/**
* 重复截止日期
*/
private String repeatEndDate;
/**
* 重复类型
*/
private String repeatType;
/**
* 开始时间;如果是全天只需要填写日期;否则填写日期+时间
*/
private String start;
/**
* 日程类型
*/
private String type;
}
}
package com.dituhui.pea.order.dto;
import java.util.List;
public class CalendarBatDelDTO {
@lombok.Data
public static class Request {
/**
* 结束时间
*/
private String endDate;
/**
* 技术员code列表
*/
private List<String> engineerCodes;
/**
* 开始时间
*/
private String startDate;
/**
* 日程类型
*/
private String type;
}
}
package com.dituhui.pea.order.dto;
public class CalendarDeleteDTO {
@lombok.Data
public static class Request {
private String engineerCode;
private String planId;
}
}
package com.dituhui.pea.order.dto;
import java.time.LocalDateTime;
public class CalendarDetailDTO {
@lombok.Data
public static class Request {
private String engineerCode;
private String planId;
}
@lombok.Data
public static class Result {
private String endTime;
private String engineerCode;
private String engineerName;
private String operator;
private String phone;
private String remark;
private LocalDateTime startTime;
private String type;
private String typeName;
private LocalDateTime updateTime;
}
}
package com.dituhui.pea.order.dto;
public class CalendarQueryNumDTO {
@lombok.Data
public static class Request {
private String code;
private String message;
private Result result;
}
@lombok.Data
public static class Result {
private long planNum;
}
}
package com.dituhui.pea.order.dto;
import lombok.Data;
import java.util.List;
public class CalendarTypeDTO {
@lombok.Data
public static class Result {
private List<Type> types;
}
@lombok.Data
public static class Type {
private BarStyle barStyle;
private TagStyle tagStyle;
private String type;
private String typeName;
}
@lombok.Data
public static class BarStyle {
private String backgroundColor;
private String color;
}
@lombok.Data
public static class TagStyle {
private String backgroundColor;
}
}
package com.dituhui.pea.order.dto;
public class CalendarUpdateDTO {
@lombok.Data
public static class Request {
private String endTime;
/**
* 技术员code
*/
private String engineerCode;
/**
* 事件id
*/
private String planId;
private String remark;
private String startTime;
}
}
......@@ -28,7 +28,7 @@ public class EngineerBusinessDTO {
private Group group;
private WareHouse warehouse;
// @JsonIgnore
// private List<Blocks> blocks;
private List<Blocks> blocks;
}
......@@ -59,6 +59,14 @@ public class EngineerBusinessDTO {
private String location;
}
@lombok.Data
public static class Blocks {
private String blockId;
private String blockName;
private String blockData;
private String teamId;
}
@lombok.Data
public static class EngineerCenterUpdateReqDTO {
......
......@@ -34,10 +34,10 @@ public class CapacityEngineerCalendarEntity {
private String memo;
@Column(name = "create_time", nullable = false, updatable = false, columnDefinition = "timestamp default current_timestamp")
private Timestamp createTime;
private LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time", nullable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp")
private Timestamp updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
// 其他字段和关联关系的定义
// ...
......
......@@ -63,10 +63,10 @@ public class CapacityEngineerStatEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -68,11 +68,11 @@ public class CapacityOrgStatEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -58,9 +58,9 @@ public class CapacityTeamStatEntity implements Serializable {
private String memo;
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -69,11 +69,11 @@ public class EngineerBusinessEntity implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "create_time", nullable = false, updatable = false, columnDefinition = "timestamp default current_timestamp")
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "update_time", nullable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp")
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -100,12 +100,12 @@ public class EngineerInfoEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
public EngineerInfoEntity() {}
}
......@@ -24,7 +24,7 @@ public class OrderEventEntity {
private String suborderId;
@Column(name = "happen", nullable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp")
private LocalDateTime happen;
private LocalDateTime happen = LocalDateTime.now();
@Column(name = "event", nullable = false, length = 50, columnDefinition = "varchar(50) default ''")
private String event;
......@@ -45,10 +45,10 @@ public class OrderEventEntity {
private String memo;
@Column(name = "create_time", nullable = false, columnDefinition = "datetime default current_timestamp")
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time", nullable = false, columnDefinition = "datetime default current_timestamp")
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
// Getters and setters (省略)
}
......
......@@ -170,10 +170,10 @@ public class OrderInfoEntity {
private String extraInfo;
@Column(name = "create_time", nullable = true, columnDefinition = "timestamp default current_timestamp")
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time", nullable = true, columnDefinition = "timestamp default current_timestamp on update current_timestamp")
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
// Getters and setters (omitted for brevity)
}
package com.dituhui.pea.order.entity;
import lombok.Data;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@Entity
@Table(name = "order_request")
public class OrderRequestEntity {
@Id
private String id;
@Column(name = "order_id", nullable = false)
private String orderId;
@Column(nullable = false)
private LocalDate dt;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String phone;
@Column(nullable = false)
private String address;
@Column(nullable = false)
private String x;
@Column(nullable = false)
private String y;
@Column
private String province;
@Column
private String city;
@Column
private String county;
@Column(nullable = false)
private String brand;
@Column(nullable = false)
private String type;
@Column(nullable = false)
private String skill;
@Column(name = "apply_note")
private String applyNote;
@Column(name = "fault_describe")
private String faultDescribe;
@Column(name = "expect_time_begin", nullable = false, columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime expectTimeBegin;
@Column(name = "expect_time_end")
private LocalDateTime expectTimeEnd;
@Column(name = "expect_time_desc")
private String expectTimeDesc;
@Column
private String source;
@Column(name = "area_id")
private String areaId;
@Column(name = "order_priority")
private String orderPriority;
@Column(name = "order_tags")
private String orderTags;
@Column
private Integer priority;
@Column
private String tags;
@Column(nullable = false)
private String status;
@Column(name = "appointment_status", nullable = false)
private String appointmentStatus;
@Column(name = "appointment_method", nullable = false)
private String appointmentMethod;
@Column(name = "org_cluster_id")
private String orgClusterId;
@Column(name = "org_cluster_name")
private String orgClusterName;
@Column(name = "org_branch_id")
private String orgBranchId;
@Column(name = "org_branch_name")
private String orgBranchName;
@Column(name = "org_group_id")
private String orgGroupId;
@Column(name = "org_group_name")
private String orgGroupName;
@Column(name = "org_team_id")
private String orgTeamId;
@Column(name = "org_team_name")
private String orgTeamName;
@Column
private String description;
@Column(name = "create_time", nullable = false, columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createTime;
@Column(name = "update_time", nullable = false, columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private LocalDateTime updateTime;
// Getters and Setters
// ...
}
......@@ -19,6 +19,6 @@ public class OrderTagStrategyEntity {
private Integer priority;
private Integer disabled;
private String memo;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private LocalDateTime createTime = LocalDateTime.now();
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -45,10 +45,10 @@ public class OrgBranchEntity {
private String memo;
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
public OrgBranchEntity() {}
}
......@@ -37,10 +37,10 @@ public class OrgClusterEntity {
private String updateUser;
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
public OrgClusterEntity() {
}
......
......@@ -81,12 +81,12 @@ public class OrgGroupEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
public OrgGroupEntity() {}
}
......@@ -45,12 +45,12 @@ public class OrgTeamEngineerEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
public OrgTeamEngineerEntity() {
}
......
......@@ -90,11 +90,11 @@ public class OrgWarehouseInfoEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -50,10 +50,10 @@ public class PubParamsEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
/**
* 更新时间
*/
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
}
......@@ -30,10 +30,10 @@ public class SkillGroupEntity {
private String memo;
@Column(name = "create_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
// Getters and Setters
// ...
......
......@@ -58,10 +58,10 @@ public class SkillInfoEntity {
private String memo;
@Column(name = "create_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createTime;
private LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private LocalDateTime updateTime;
private LocalDateTime updateTime = LocalDateTime.now();
// Getters and Setters
// ...
......
......@@ -12,4 +12,6 @@ public interface EngineerBusinessService {
EngineerBusinessDTO.WareHouse getWareHouse(String wareHouseId);
void updateEngineerCenter(EngineerBusinessDTO.EngineerCenterUpdateReqDTO centerReq );
List<EngineerBusinessDTO.Blocks> getBlocks(EngineerBusinessDTO.Request engineerReq);
}
......@@ -6,4 +6,6 @@ import com.dituhui.pea.order.dto.EngineerCalendarDTO;
public interface EngineerCalendarService {
Result<?> getEngineersCalendar(EngineerCalendarDTO.Request engineerCalendarReq);
Result<?> getCalendarTypeList();
}
......@@ -180,10 +180,12 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
return Result.failure("区块已存在或者裁剪为空");
}
String blockId = saasResult.getResult();
String blockName = String.format("%s_%s", layerName, team.getTeamName()); //区块名称
MapBlockInfo block = new MapBlockInfo();
block.setBlockId(blockId);
block.setBlockName(team.getTeamName()); //默认使用team name;
block.setBlockName(blockName);
block.setBranchId(team.getBranchId());
block.setGroupId(team.getGroupId());
block.setTeamId(teamId);
......
......@@ -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;
}
}
}
package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.order.dao.EngineerBusinessDao;
import com.dituhui.pea.order.dao.EngineerInfoDao;
import com.dituhui.pea.order.dao.OrgGroupDao;
import com.dituhui.pea.order.dao.WarehouseInfoDao;
import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dto.EngineerBusinessDTO;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.EngineerBusinessService;
......@@ -37,6 +34,8 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
@Autowired
private WarehouseInfoDao warehouseInfoDao;
@Autowired
private MapBlockInfoDao mapBlockInfoDao;
@Autowired
private JdbcTemplate jdbcTemplate;
......@@ -115,4 +114,18 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
String[] xyArr = location.split(",");
engineerBusinessDao.updateEngineerCenter(centerReq.getAddress(), xyArr[0], xyArr[1], centerReq.getEngineerCode());
}
@Override
public List<EngineerBusinessDTO.Blocks> getBlocks(EngineerBusinessDTO.Request engineerReq) {
List<MapBlockInfoEntity> blockInfoList = mapBlockInfoDao.findByGroupId(engineerReq.getLevelValue());
return blockInfoList.stream().map(item -> {
EngineerBusinessDTO.Blocks block = new EngineerBusinessDTO.Blocks();
block.setBlockId(item.getBlockId());
block.setBlockName(item.getBlockName());
block.setBlockData(item.getAreaData());
block.setTeamId(item.getTeamId());
return block;
}).collect(Collectors.toList());
}
}
......@@ -7,11 +7,16 @@ import com.dituhui.pea.order.common.EngineerUtils;
import com.dituhui.pea.order.dao.CapacityEngineerCalendarDao;
import com.dituhui.pea.order.dao.OrgTeamDao;
import com.dituhui.pea.order.dao.OrgTeamEngineerDao;
import com.dituhui.pea.order.dao.PubParamsDao;
import com.dituhui.pea.order.dto.CalendarTypeDTO;
import com.dituhui.pea.order.dto.EngineerCalendarDTO;
import com.dituhui.pea.order.entity.CapacityEngineerCalendarEntity;
import com.dituhui.pea.order.entity.EngineerInfoEntity;
import com.dituhui.pea.order.entity.OrgTeamEntity;
import com.dituhui.pea.order.entity.PubParamsEntity;
import com.dituhui.pea.order.service.EngineerCalendarService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......@@ -44,6 +49,8 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
@Autowired
private OrgTeamDao orgTeamDao;
@Autowired
private PubParamsDao pubParamsDao;
@Override
public Result<?> getEngineersCalendar(EngineerCalendarDTO.Request req) {
......@@ -72,13 +79,32 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
return Result.success(rs);
}
@Override
public Result<?> getCalendarTypeList() {
List<PubParamsEntity> entities = pubParamsDao.findByCatalogAndBiztype("CalendarType", "CalendarType");
try {
List<CalendarTypeDTO.Type> types = entities.stream().map(e -> {
try {
return new ObjectMapper().readValue(e.getPvalue(), CalendarTypeDTO.Type.class);
} catch (JsonProcessingException ex) {
throw new RuntimeException(ex);
}
}).collect(Collectors.toList());
CalendarTypeDTO.Result rs = new CalendarTypeDTO.Result();
rs.setTypes(types);
return Result.success(rs);
} catch (Exception e) {
return Result.failed(e.getMessage());
}
}
private List<EngineerCalendarDTO.Calendar> getOneEngineerCalendars(String engineerCode, String bdate, String edate) {
// 返回某一个技术员,日期范围内的日历列表
List<EngineerCalendarDTO.Calendar> calendars = new ArrayList<>();
List<String> teamIds = orgTeamEngineerDao.getTeamIdsByEngineerCode(engineerCode);
if (teamIds == null || teamIds.size() == 0) {
if (teamIds == null || teamIds.isEmpty()) {
return new ArrayList<>();
}
LocalDate startDate = LocalDate.parse(bdate);
......
......@@ -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!