Commit ca7a3a38 authored by hanbing's avatar hanbing

[add] 快速特勤,设置自动解锁

parent f54e936d
......@@ -10,7 +10,6 @@ import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.vo.LockControlVO;
import net.wanji.web.bo.*;
import net.wanji.web.service.SpecialServiceService;
import net.wanji.web.vo.specialService.RouteElementVO;
import net.wanji.web.vo.specialService.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Set;
/**
* 快速特勤
......@@ -167,41 +165,14 @@ public class SpecialServiceController {
return JsonViewObject.newInstance().success();
}
@AspectLog(description = "更新路口", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "更新路口", notes = "更新路口", response = JsonViewObject.class,
@AspectLog(description = "自动解锁", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "自动解锁", notes = "自动解锁", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updateCross",
@PostMapping(value = "/autoUnlock",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject updateCross(@RequestBody UpdateCrossInVO updateCrossInVO) {
specialServiceService.updateCross(updateCrossInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@AspectLog(description = "删除路口", operationType = BaseEnum.OperationTypeEnum.DELETE)
@ApiOperation(value = "删除路口", notes = "删除路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/deleteCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject deleteCross(@RequestBody DeleteCrossInVO deleteCrossInVO) {
specialServiceService.deleteCross(deleteCrossInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
public JsonViewObject autoUnlock(@RequestBody GroupListVO groupListVO) {
specialServiceService.autoUnlock(groupListVO);
return JsonViewObject.newInstance().success();
}
@AspectLog(description = "路口进口列表", operationType = BaseEnum.OperationTypeEnum.QUERY)
@ApiOperation(value = "路口进口列表", notes = "路口进口列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossInList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject crossInList(@RequestBody CrossIdVO crossIdVO) {
String crossId = crossIdVO.getCrossId();
Set<String> crossInList = specialServiceService.crossInList(crossId);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossInList);
}
}
......@@ -50,4 +50,6 @@ public interface SpecialServiceCrossMapper {
void updateGroupName(String crossId, String groupName);
void deleteGroup(Integer specialServiceId, String groupName);
void updateAutoUnlock(String crossId, Integer autoUnlock);
}
......@@ -2,11 +2,9 @@ package net.wanji.web.service;
import net.wanji.databus.vo.LockControlVO;
import net.wanji.web.bo.*;
import net.wanji.web.vo.specialService.RouteElementVO;
import net.wanji.web.vo.specialService.*;
import java.util.List;
import java.util.Set;
/**
* @author Kent HAN
......@@ -21,12 +19,6 @@ public interface SpecialServiceService {
void deleteSpecialService(Integer id);
void updateCross(UpdateCrossInVO updateCrossInVO);
void deleteCross(DeleteCrossInVO deleteCrossInVO);
Set<String> crossInList(String crossId);
List<List<RouteElementVO>> specialServiceRoute(SpecialServiceRouteBO specialServiceRouteBO);
void isValidPoint(IsValidPointBO isValidPointBO);
......@@ -46,4 +38,6 @@ public interface SpecialServiceService {
void updateGroup(GroupListVO groupListVO);
void deleteGroup(GroupNameBO groupNameBO);
void autoUnlock(GroupListVO groupListVO);
}
......@@ -19,7 +19,6 @@ import net.wanji.feign.service.UtcFeignClients;
import net.wanji.web.bo.*;
import net.wanji.web.common.enums.CrossDirEnum;
import net.wanji.web.mapper.*;
import net.wanji.web.po.CrossDirTurnPO;
import net.wanji.web.po.SpecialServiceCrossPO;
import net.wanji.web.po.SpecialServicePO;
import net.wanji.web.service.SpecialServiceService;
......@@ -292,59 +291,6 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
specialServiceCrossMapper.deleteCrossBySpecialServiceId(id);
}
@Override
@Transactional
public void updateCross(UpdateCrossInVO updateCrossInVO) {
Integer specialServiceId = updateCrossInVO.getSpecialServiceId();
String crossId = updateCrossInVO.getCrossId();
String dirInAndOut = updateCrossInVO.getDirInAndOut();
// 获取方向(东西南北...)
int length = dirInAndOut.length();
String dirStr = dirInAndOut.substring(0, length - 2);
Integer dir = CrossDirEnum.getCodeByMsg(dirStr);
specialServiceCrossMapper.updatDir(specialServiceId, crossId, dir);
// 更新当前路口转向
Integer sort = updateCrossInVO.getSort();
Integer nextSort = sort + 1;
String endCrossid = specialServiceCrossMapper.selectCrossIdBySort(specialServiceId, nextSort);
String startCrossOutDirId = customRidInfoMapper.selectStartCrossOutDir(crossId, endCrossid);
String startCrossInDirId = crossId + "_" + dir + "_2_1";
CrossDirTurnPO crossDirTurnPO = crossDirTurnMapper.selectOneByInAndOutIds(startCrossInDirId, startCrossOutDirId);
String turntype = crossDirTurnPO.getTurntype();
specialServiceCrossMapper.updateTurn(specialServiceId, crossId, turntype);
}
@Override
@Transactional
public void deleteCross(DeleteCrossInVO deleteCrossInVO) {
String crossId = deleteCrossInVO.getCrossId();
Integer specialServiceId = deleteCrossInVO.getSpecialServiceId();
Integer sort = deleteCrossInVO.getSort();
if (sort > 1) {
Integer preSort = sort - 1;
String preCrossid = specialServiceCrossMapper.selectCrossIdBySort(specialServiceId, preSort);
// 减少路线长度
Double roadLength = customRidInfoMapper.selectRoadLength(preCrossid, crossId);
Double oldLength = specialServiceMapper.selectRoadLength(specialServiceId);
oldLength -= roadLength;
specialServiceMapper.updateLength(specialServiceId, oldLength);
// 删除上一个路口转向
specialServiceCrossMapper.updateTurn(specialServiceId, preCrossid, null);
}
specialServiceCrossMapper.deleteCross(specialServiceId, crossId);
}
@Override
public Set<String> crossInList(String crossId) {
List<String> crossInIdList = crossDirTurnMapper.crossInList(crossId);
Set<String> res = new HashSet<>();
for (String crossInId : crossInIdList) {
String crossIn = getCrossIn(crossInId);
res.add(crossIn);
}
return res;
}
private String getCrossIn(String crossInId) {
// 从 13FNK0C6790_1_2_1 中获取 “北进口”
int length = crossInId.length();
......@@ -703,6 +649,19 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
specialServiceCrossMapper.deleteGroup(specialServiceId, groupName);
}
@Override
public void autoUnlock(GroupListVO groupListVO) {
List<GroupListVO.GroupListElement> groupList = groupListVO.getGroupList();
for (GroupListVO.GroupListElement groupListElement : groupList) {
List<CrossListElement> crossList = groupListElement.getCrossList();
for (CrossListElement crossListElement : crossList) {
String crossId = crossListElement.getCrossId();
Integer autoUnlock = crossListElement.getAutoUnlock();
specialServiceCrossMapper.updateAutoUnlock(crossId, autoUnlock);
}
}
}
private List<GroupListVO.GroupListElement> buildGroupList(SpecialServicePO specialServicePO) {
List<GroupListVO.GroupListElement> groupList = new ArrayList<>();
......@@ -807,6 +766,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
crossListElement.setRouteEnd(streetName2 + ourDirMsg);
}
crossListElement.setStatus(currentCrossElement.getStatus());
crossListElement.setAutoUnlock(currentCrossElement.getAutoUnlock());
crossListElement.setSort(currentCrossElement.getSort());
crossList.add(crossListElement);
}
......@@ -834,6 +794,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
setElementStartEnd(specialServiceCrossList, i, currentCrossId, crossListElement);
crossListElement.setStatus(currentCross.getStatus());
crossListElement.setAutoUnlock(currentCross.getAutoUnlock());
crossListElement.setSort(currentCross.getSort());
crossList.add(crossListElement);
......
......@@ -33,6 +33,8 @@ public class SpecialServiceDetailVO {
private String routeEnd;
@ApiModelProperty(value = "锁定状态:1锁定;0解锁")
private Integer status;
@ApiModelProperty(name = "自动解锁:1是;0否",notes = "")
private Integer autoUnlock ;
@ApiModelProperty(value = "路口顺序号")
private Integer sort;
}
......
......@@ -62,6 +62,12 @@
where cross_id = #{crossId}
</update>
<update id="updateAutoUnlock">
update t_special_service_cross
set auto_unlock = #{autoUnlock}
where cross_id = #{crossId}
</update>
<delete id="deleteCross">
delete from t_special_service_cross
where special_service_id = #{specialServiceId} and cross_id = #{crossId}
......
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