Commit bc5e0695 authored by hanbing's avatar hanbing

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

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