Commit 8df57e96 by Ren Ping

Merge remote-tracking branch 'origin/develop' into develop

2 parents c5f4e25d 862c3837
...@@ -145,6 +145,8 @@ public enum StatusCodeEnum { ...@@ -145,6 +145,8 @@ public enum StatusCodeEnum {
TEAM_UNMATCHED("029", "工程师没有匹配到工作队", false), TEAM_UNMATCHED("029", "工程师没有匹配到工作队", false),
ORDER_FINISHED("030", "订单已结束,请勿操作", false), ORDER_FINISHED("030", "订单已结束,请勿操作", false),
FENDAN_IS_TRANSCEND_AND_SPECIAL("031", "分单超派和特殊时间", false),
; ;
/** /**
......
...@@ -90,7 +90,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -90,7 +90,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
" WHERE esg.status = 1 AND esg.skill_group_code IN( :skillGroupCodes) group by esg.engineer_code having count(esg.skill_group_code) = :skillGroupNumber " + " WHERE esg.status = 1 AND esg.skill_group_code IN( :skillGroupCodes) group by esg.engineer_code having count(esg.skill_group_code) = :skillGroupNumber " +
" ) AS tabA ON tabA.engineer_code = ote.engineer_code " + " ) AS tabA ON tabA.engineer_code = ote.engineer_code " +
" LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " + " LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " +
" WHERE ote.team_id = :teamId AND ei.id is not null" + " WHERE ote.team_id = :teamId AND ote.status = 1 AND ei.id is not null" +
" order by ei.engineer_code desc", nativeQuery = true) " order by ei.engineer_code desc", nativeQuery = true)
Set<EngineerInfoEntity> listBySkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("teamId") String teamId); Set<EngineerInfoEntity> listBySkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("teamId") String teamId);
......
...@@ -19,6 +19,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS ...@@ -19,6 +19,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List<OrderInfoEntity> findByDtAndEngineerCodeIn(LocalDate date, List<String> engineerCodes); List<OrderInfoEntity> findByDtAndEngineerCodeIn(LocalDate date, List<String> engineerCodes);
List<OrderInfoEntity> findByDtAndServiceStatusNotAndEngineerCodeIn(LocalDate date, String serviceSatus, List<String> engineerCodes);
List<OrderInfoEntity> findByDtAndEngineerCode(LocalDate date, String engineerCode); List<OrderInfoEntity> findByDtAndEngineerCode(LocalDate date, String engineerCode);
@Query("SELECT o.orderId, s.skillCategory as skillCaption FROM OrderInfoEntity o JOIN SkillInfoEntity s on o.brand=s.brand and o.type=s.type and o.skill=s.skill WHERE o.orderId = :orderId and o.dt = :dt") @Query("SELECT o.orderId, s.skillCategory as skillCaption FROM OrderInfoEntity o JOIN SkillInfoEntity s on o.brand=s.brand and o.type=s.type and o.skill=s.skill WHERE o.orderId = :orderId and o.dt = :dt")
......
...@@ -29,10 +29,10 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp ...@@ -29,10 +29,10 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp
@Query("select t from OrgTeamEntity t where t.teamId = :teamId and t.status=1") @Query("select t from OrgTeamEntity t where t.teamId = :teamId and t.status=1")
List<OrgTeamEntity> findAllByTeamId(String teamId); List<OrgTeamEntity> findAllByTeamId(String teamId);
@Query("select t from OrgTeamEntity t where t.groupId = :groupId and t.status=1") @Query("select t from OrgTeamEntity t where t.groupId = :groupId and t.status=1 ORDER BY t.groupId,t.teamName DESC")
Page<OrgTeamEntity> findAllByGroupId(String groupId, Pageable pageable); Page<OrgTeamEntity> findAllByGroupId(String groupId, Pageable pageable);
@Query("select t from OrgTeamEntity t where t.branchId = :branchId and t.status=1") @Query("select t from OrgTeamEntity t where t.branchId = :branchId and t.status=1 ORDER BY t.groupId,t.teamName DESC")
Page<OrgTeamEntity> findAllByBranchId(String branchId, Pageable pageable); Page<OrgTeamEntity> findAllByBranchId(String branchId, Pageable pageable);
OrgTeamEntity getByTeamId(String teamId); OrgTeamEntity getByTeamId(String teamId);
...@@ -43,6 +43,7 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp ...@@ -43,6 +43,7 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp
@Query("UPDATE OrgTeamEntity tt SET tt.status = :status WHERE tt.teamId = :teamId") @Query("UPDATE OrgTeamEntity tt SET tt.status = :status WHERE tt.teamId = :teamId")
void updateStatusByTeamId(String teamId, int status); void updateStatusByTeamId(String teamId, int status);
@Query("select t from OrgTeamEntity t where t.teamId in :ids and t.status=1")
public List<OrgTeamEntity> findByTeamIdIn(List<String> ids); public List<OrgTeamEntity> findByTeamIdIn(List<String> ids);
public List<OrgTeamEntity> findByClusterIdIn(List<String> ids); public List<OrgTeamEntity> findByClusterIdIn(List<String> ids);
......
...@@ -209,6 +209,11 @@ public class BusinessTeamServiceImpl implements BusinessTeamService { ...@@ -209,6 +209,11 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
// 技术员列表 // 技术员列表
List<String> engineerCodes = req.getEngineerCodes(); List<String> engineerCodes = req.getEngineerCodes();
if (engineerCodes.isEmpty()) {
//移除原有关系映射
final String targetTeamId = String.valueOf(entity.getTeamId());
orgTeamEngineerDao.deleteByTeamId(targetTeamId);
}
if (engineerCodes != null && !engineerCodes.isEmpty()) { if (engineerCodes != null && !engineerCodes.isEmpty()) {
final String targetTeamId = String.valueOf(entity.getTeamId()); final String targetTeamId = String.valueOf(entity.getTeamId());
List<String> targetTeamWorkDayOfWeek = List.of(entity.getWorkdays().split(",")); List<String> targetTeamWorkDayOfWeek = List.of(entity.getWorkdays().split(","));
......
...@@ -59,6 +59,7 @@ import java.util.ArrayList; ...@@ -59,6 +59,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -97,7 +98,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -97,7 +98,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
@Override @Override
public Result<?> getEngineersCalendar(EngineerCalendarDTO.Request req) { public Result<?> getEngineersCalendar(EngineerCalendarDTO.Request req) {
// 技术员日历,查询 capacity_engineer_calendar表,如果当日有各种事项,进行显示;否则显示正常上班; // 技术员日历,查询 capacity_engineer_calendar表,如果当日有各种事项,进行显示;否则显示正常上班;
List<EngineerCalendarDTO.Engineer> engineers = new ArrayList<>();
List<String> allCodes = engineerUtil.getEngineersByLevel(req.getLevelType(), req.getLevelValue()).stream() List<String> allCodes = engineerUtil.getEngineersByLevel(req.getLevelType(), req.getLevelValue()).stream()
.map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList()); .map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
...@@ -105,6 +105,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -105,6 +105,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
Page<EngineerInfoEntity> page = engineerUtil.filterEngineersByKeyAndPage(allCodes, req.getKey(), req.getPage(), req.getSize()); Page<EngineerInfoEntity> page = engineerUtil.filterEngineersByKeyAndPage(allCodes, req.getKey(), req.getPage(), req.getSize());
String edate = DateUtils.localDateFromStr(req.getDate()).plusDays(14).toString(); String edate = DateUtils.localDateFromStr(req.getDate()).plusDays(14).toString();
List<EngineerCalendarDTO.Engineer> engineers = new ArrayList<>();
for (EngineerInfoEntity e : page.getContent()) { for (EngineerInfoEntity e : page.getContent()) {
EngineerCalendarDTO.Engineer engineer = new EngineerCalendarDTO.Engineer(); EngineerCalendarDTO.Engineer engineer = new EngineerCalendarDTO.Engineer();
engineer.setEngineerCode(e.getEngineerCode()); engineer.setEngineerCode(e.getEngineerCode());
...@@ -117,6 +118,8 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -117,6 +118,8 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
rs.setPages(page.getTotalPages()); rs.setPages(page.getTotalPages());
rs.setPageSize(page.getSize()); rs.setPageSize(page.getSize());
rs.setPageCurrent(page.getNumber() + 1); rs.setPageCurrent(page.getNumber() + 1);
engineers = engineers.stream().sorted(Comparator.comparing(EngineerCalendarDTO.Engineer::getName).reversed()).collect(Collectors.toList());
rs.setEngineers(engineers); rs.setEngineers(engineers);
return Result.success(rs); return Result.success(rs);
} }
......
...@@ -10,6 +10,7 @@ import com.dituhui.pea.order.dto.EngineersGanttDTO; ...@@ -10,6 +10,7 @@ import com.dituhui.pea.order.dto.EngineersGanttDTO;
import com.dituhui.pea.order.dto.LabelValueDTO; import com.dituhui.pea.order.dto.LabelValueDTO;
import com.dituhui.pea.order.entity.*; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.enums.OrderFlowEnum; import com.dituhui.pea.order.enums.OrderFlowEnum;
import com.dituhui.pea.order.enums.ServiceStatusEnum;
import com.dituhui.pea.order.service.EngineerGanttService; import com.dituhui.pea.order.service.EngineerGanttService;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -61,7 +62,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService { ...@@ -61,7 +62,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
} }
LocalDate localDate = LocalDate.parse(reqDTO.getDate()); LocalDate localDate = LocalDate.parse(reqDTO.getDate());
List<OrderInfoEntity> orders = orderInfoDao.findByDtAndEngineerCodeIn(localDate, engineerCodes); List<OrderInfoEntity> orders = orderInfoDao.findByDtAndServiceStatusNotAndEngineerCodeIn(localDate, ServiceStatusEnum.CANCELED.getCode(), engineerCodes);
HashMap<String, List<EngineersGanttDTO.Slot>> mapEngineers = new HashMap<>(); HashMap<String, List<EngineersGanttDTO.Slot>> mapEngineers = new HashMap<>();
for (OrderInfoEntity order : orders) { for (OrderInfoEntity order : orders) {
// 服务工单本体 // 服务工单本体
......
...@@ -13,6 +13,7 @@ import com.dituhui.pea.order.dto.param.OrgTeamInfo; ...@@ -13,6 +13,7 @@ import com.dituhui.pea.order.dto.param.OrgTeamInfo;
import com.dituhui.pea.order.entity.*; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.CapacityQueryService; import com.dituhui.pea.order.service.CapacityQueryService;
import com.dituhui.pea.order.service.FendanService; import com.dituhui.pea.order.service.FendanService;
import com.dituhui.pea.order.utils.CommonUtil;
import com.dituhui.pea.pojo.fendan.FendanDTO; import com.dituhui.pea.pojo.fendan.FendanDTO;
import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq; import com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq;
import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp; import com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp;
...@@ -311,6 +312,13 @@ public class FendanServiceImpl implements FendanService { ...@@ -311,6 +312,13 @@ public class FendanServiceImpl implements FendanService {
return Result.success(orgGroupInfo.getTeamInfos().get(0)); return Result.success(orgGroupInfo.getTeamInfos().get(0));
} }
} }
// 超派情况判断特殊时间
//特殊时间段
Integer special = CommonUtil.isSpecial(startTime, endTime, orgGroupTeamInfos.get(0).getTeamInfos().get(0).getWorkOn(),
orgGroupTeamInfos.get(0).getTeamInfos().get(0).getWorkOff());
if (special == 1) {
return Result.failed(StatusCodeEnum.FENDAN_IS_TRANSCEND_AND_SPECIAL);
}
return Result.failed(StatusCodeEnum.FENDAN_IS_TRANSCEND); return Result.failed(StatusCodeEnum.FENDAN_IS_TRANSCEND);
} }
......
...@@ -355,6 +355,11 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -355,6 +355,11 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 处理超派 // 处理超派
entity.setTranscend(1); entity.setTranscend(1);
} }
if (fendanResult.getCode().equals(StatusCodeEnum.FENDAN_IS_TRANSCEND_AND_SPECIAL.getCode())) {
// 处理超派和特殊时间
entity.setTranscend(1);
entity.setIsSpecialTime(1);
}
OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCity() + "%"); OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCity() + "%");
entity.setOrgClusterId(branchEntity.getClusterId()); entity.setOrgClusterId(branchEntity.getClusterId());
entity.setOrgBranchId(branchEntity.getBranchId()); entity.setOrgBranchId(branchEntity.getBranchId());
......
...@@ -418,6 +418,11 @@ public class OrderInfoServiceImpl implements OrderInfoService { ...@@ -418,6 +418,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
} else { } else {
cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), null); cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), null);
} }
// 当日单指派策略为人工指派,次日单动态排班自动批量
if (isToday || cutoff == 1) {
order.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
order.setAppointmentStatus(OrderFlowEnum.INIT.name());
}
order.setIsCutoff(cutoff); order.setIsCutoff(cutoff);
order.setIsSpecialTime(special); order.setIsSpecialTime(special);
order.setOrgClusterId(clusterId); order.setOrgClusterId(clusterId);
...@@ -684,6 +689,26 @@ public class OrderInfoServiceImpl implements OrderInfoService { ...@@ -684,6 +689,26 @@ public class OrderInfoServiceImpl implements OrderInfoService {
//处理超派,特殊时间段 //处理超派,特殊时间段
// order.setIsSpecialTime(CommonUtil.isSpecial(order.getExpectTimeBegin().toLocalTime(), // order.setIsSpecialTime(CommonUtil.isSpecial(order.getExpectTimeBegin().toLocalTime(),
// order.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff())); // order.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff()));
//特殊时间段
Integer special = CommonUtil.isSpecial(order.getExpectTimeBegin().toLocalTime(),
order.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff());
Integer cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), teamInfo.getWorkOff());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean isTomorrow = DateUtil.judgeTimeIsisTomorrow(order.getExpectTimeBegin());
//次日单自动批量
if (isTomorrow) {
order.setAppointmentMethod(AppointmentMethodEnum.AUTO_BATCH.name());
}
// 特殊时间段,当天单,cutoff需要人工处理
if (cutoff == 1 || special == 1) {
//判断是否在今天cutoff之后
order.setIsCutoff(cutoff);
order.setIsSpecialTime(special);
order.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
order.setAppointmentStatus(OrderFlowEnum.INIT.name());
//发送通知分部消息
sendMsg(order.getOrgBranchId(), order.getOrderId(), req.getExpectBegin());
}
} }
return order; return order;
} }
......
...@@ -37,9 +37,11 @@ import org.locationtech.spatial4j.shape.Rectangle; ...@@ -37,9 +37,11 @@ import org.locationtech.spatial4j.shape.Rectangle;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.MessageFormat;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
...@@ -186,6 +188,14 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService { ...@@ -186,6 +188,14 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
orderInfo.setPlanStartTime(planStartTime); orderInfo.setPlanStartTime(planStartTime);
orderInfo.setPlanEndTime(planEndTime); orderInfo.setPlanEndTime(planEndTime);
LocalDate date = planStartTime.toLocalDate();
orderInfo.setDt(date);
LocalTime exceptStartHour = LocalTime.of(planStartTime.getHour(), 0);
orderInfo.setExpectTimeBegin(LocalDateTime.of(date, exceptStartHour));
LocalTime exceptEndHour = exceptStartHour.plusHours(2);
orderInfo.setExpectTimeEnd(LocalDateTime.of(date, exceptEndHour));
orderInfo.setExpectTimeDesc(MessageFormat.format("{0}月{1}日{2}-{3}点", date.getMonthValue(), date.getDayOfMonth(), exceptStartHour.getHour(), exceptEndHour.getHour()));
orderInfo.setApplyNote(MessageFormat.format("{0}-{1}", DateTimeUtil.formatTime(exceptStartHour), DateTimeUtil.formatTime(exceptEndHour)));
} }
orderInfo.setReasonForFailure(request.getReasonForFailure()); orderInfo.setReasonForFailure(request.getReasonForFailure());
......
...@@ -356,7 +356,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -356,7 +356,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
Long started = summary.getOrDefault("STARTED", 0L); Long started = summary.getOrDefault("STARTED", 0L);
Long finished = summary.getOrDefault("FINISHED", 0L) + summary.getOrDefault("UNFINISHED", 0L); Long finished = summary.getOrDefault("FINISHED", 0L) + summary.getOrDefault("UNFINISHED", 0L);
Long cancel = summary.getOrDefault("1", 0L); Long cancel = summary.getOrDefault("CANCELED", 0L);
// 服务状态:INIT-初始化/PENDING待服务/CONTACTED已排期/STARTED-已开始/FINISHED已完成/UNFINISHED-已上门未完成 // 服务状态:INIT-初始化/PENDING待服务/CONTACTED已排期/STARTED-已开始/FINISHED已完成/UNFINISHED-已上门未完成
// - 待上门:服务状态为“待服务、已排期”的工单. // - 待上门:服务状态为“待服务、已排期”的工单.
HashMap<String, List<String>> p1 = this.packParams("appointmentStatus", "CONTACTED", "PENDING"); HashMap<String, List<String>> p1 = this.packParams("appointmentStatus", "CONTACTED", "PENDING");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!