Commit bc5e0695 authored by hanbing's avatar hanbing

方案管理-运行计划,更新时段列表

parent 6d8e6123
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.feign.pojo.result.JsonViewObject;
import net.wanji.web.dto.CrossIdDTO;
import net.wanji.web.dto.RunningPlanDTO;
import net.wanji.web.service.scheme.impl.RunningPlanServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -45,18 +46,18 @@ public class RunningPlanController {
return jsonViewObject.success();
}
//
// @ApiOperation(value = "渠化配置/灯组设置、车道配置列表", notes = "渠化配置/灯组设置、车道配置列表", response = JsonViewObject.class,
// produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
// @PostMapping(value = "/listLaneInfo",
// produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
// @ApiResponses({
// @ApiResponse(code = 200, message = "OK", response = SaveLaneInfoDTO.class),
// })
// public JsonViewObject listLaneInfo(@RequestBody CrossIdDTO crossIdDTO) {
// SaveLaneInfoDTO saveLaneInfoDTO = crossConfigService.listLaneInfo(crossIdDTO);
// JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//
// return jsonViewObject.success(saveLaneInfoDTO);
// }
@ApiOperation(value = "运行计划列表", notes = "运行计划列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/listRunningPlan",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningPlanDTO.class),
})
public JsonViewObject listRunningPlan(@RequestBody CrossIdDTO crossIdDTO) {
RunningPlanDTO runningPlanDTO = runningPlanService.listRunningPlan(crossIdDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(runningPlanDTO);
}
}
......@@ -39,6 +39,12 @@ public class RunningPlanDTO {
private String planNo;
@ApiModelProperty(value = "日计划名", required = true)
private String name;
@ApiModelProperty(value = "开始时间结束时间列表", required = true)
private List<TimeListElement> timeList;
}
@NoArgsConstructor
@Data
public static class TimeListElement {
@ApiModelProperty(value = "开始时间", required = true)
private String startTime;
@ApiModelProperty(value = "结束时间", required = true)
......
package net.wanji.web.service.scheme;
import net.wanji.web.dto.CrossIdDTO;
import net.wanji.web.dto.RunningPlanDTO;
/**
......@@ -8,4 +9,6 @@ import net.wanji.web.dto.RunningPlanDTO;
*/
public interface RunningPlanService {
void saveRunningPlan(RunningPlanDTO runningPlanDTO);
RunningPlanDTO listRunningPlan(CrossIdDTO crossIdDTO);
}
package net.wanji.web.service.scheme.impl;
import net.wanji.web.common.exception.WeekException;
import net.wanji.web.dto.CrossIdDTO;
import net.wanji.web.dto.RunningPlanDTO;
import net.wanji.web.mapper.scheme.CrossPlanMapper;
import net.wanji.web.mapper.scheme.CrossSchedulesMapper;
......@@ -16,6 +17,7 @@ import net.wanji.web.service.scheme.RunningPlanService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -58,6 +60,26 @@ public class RunningPlanServiceImpl implements RunningPlanService {
saveCrossSchedules(runningPlanDTO, crossId);
}
@Override
public RunningPlanDTO listRunningPlan(CrossIdDTO crossIdDTO) {
RunningPlanDTO runningPlanDTO = new RunningPlanDTO();
String crossId = crossIdDTO.getCrossId();
runningPlanDTO.setCrossId(crossId);
// 构造dailyPlanList
List<RunningPlanDTO.DailyPlanListElement> dailyPlanList = buildDailyPlanList(crossId);
runningPlanDTO.setDailyPlanList(dailyPlanList);
// 构造schedulesPlanList
// 构造week列表
return runningPlanDTO;
}
private List<RunningPlanDTO.DailyPlanListElement> buildDailyPlanList(String crossId) {
List<RunningPlanDTO.DailyPlanListElement> dailyPlanList = new ArrayList<>();
return dailyPlanList;
}
private void saveCrossSchedules(RunningPlanDTO runningPlanDTO, String crossId) {
List<RunningPlanDTO.SchedulesPlanListElement> schedulesPlanList = runningPlanDTO.getSchedulesPlanList();
for (RunningPlanDTO.SchedulesPlanListElement schedulesPlan : schedulesPlanList) {
......@@ -106,20 +128,23 @@ public class RunningPlanServiceImpl implements RunningPlanService {
crossPlanPO.setCrossId(crossId);
crossPlanMapper.insertOne(crossPlanPO);
Integer crossPlanId = crossPlanPO.getId();
List<RunningPlanDTO.TimeListElement> timeList = dailyPlan.getTimeList();
for (RunningPlanDTO.TimeListElement time : timeList) {
// 根据路口ID和方案名获取方案ID
String schemeName = dailyPlan.getSchemeName();
String schemeName = time.getSchemeName();
CrossSchemePO crossSchemePO = crossSchemeMapper.selectByCrossIdAndSchemeName(crossId, schemeName);
Integer schemeId = crossSchemePO.getId();
// 更新时段表
updateCrossSection(crossId, dailyPlan, crossPlanId, schemeId);
updateCrossSection(crossId, dailyPlan, crossPlanId, schemeId, time);
}
}
}
private void updateCrossSection(String crossId, RunningPlanDTO.DailyPlanListElement dailyPlan,
Integer crossPlanId, Integer schemeId) {
Integer crossPlanId, Integer schemeId, RunningPlanDTO.TimeListElement time) {
CrossSectionPO crossSectionPO = new CrossSectionPO();
String startTime = dailyPlan.getStartTime();
String endTime = dailyPlan.getEndTime();
String startTime = time.getStartTime();
String endTime = time.getEndTime();
String s = startTime + endTime;
String sectionNo = s.replaceAll(":", "");
crossSectionPO.setSectionNo(sectionNo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment