|
@@ -6,12 +6,9 @@ import com.jpsoft.bus.modules.bus.dto.RouteInfoDTO;
|
|
|
import com.jpsoft.bus.modules.bus.dto.RouteMapPathDTO;
|
|
|
import com.jpsoft.bus.modules.bus.dto.StationInfoDTO;
|
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
|
-import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
|
|
|
-import com.jpsoft.bus.modules.bus.service.StationInfoService;
|
|
|
-import com.jpsoft.bus.modules.bus.service.StationSubInfoService;
|
|
|
+import com.jpsoft.bus.modules.bus.service.*;
|
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.bus.modules.common.dto.Sort;
|
|
|
-import com.jpsoft.bus.modules.bus.service.RouteInfoService;
|
|
|
import com.jpsoft.bus.modules.common.utils.OSSUtil;
|
|
|
import com.jpsoft.bus.modules.common.utils.POIUtils;
|
|
|
import com.jpsoft.bus.modules.common.utils.PojoUtils;
|
|
@@ -69,6 +66,9 @@ public class RouteInfoController {
|
|
|
@Autowired
|
|
|
private StationSubInfoService stationSubInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RouteAccountService routeAccountService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
public MessageResult<RouteInfoDTO> create(){
|
|
@@ -129,6 +129,23 @@ public class RouteInfoController {
|
|
|
stationInfoService.insert(stationInfo);
|
|
|
}
|
|
|
|
|
|
+ if(dto.getAccounts() != null){
|
|
|
+ affectCount = routeAccountService.deleteByRouteId(dto.getId());
|
|
|
+
|
|
|
+ for (String accountId : dto.getAccounts()) {
|
|
|
+ RouteAccount ra = new RouteAccount();
|
|
|
+
|
|
|
+ ra.setId(UUID.randomUUID().toString());
|
|
|
+ ra.setRouteId(dto.getId());
|
|
|
+ ra.setAccountId(accountId);
|
|
|
+ ra.setCreateBy(subject);
|
|
|
+ ra.setCreateTime(new Date());
|
|
|
+ ra.setDelFlag(false);
|
|
|
+
|
|
|
+ affectCount += routeAccountService.insert(ra);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(routeInfoService.get(routeInfo.getId()));
|
|
|
} else {
|
|
@@ -209,6 +226,10 @@ public class RouteInfoController {
|
|
|
routeInfoDTO.setPathList(pathList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ List<RouteAccount> routeAccountList = routeAccountService.findByRouteId(id);
|
|
|
+ routeInfoDTO.setAccounts(routeAccountList.stream().map((routeAccount)->routeAccount.getAccountId()).collect(Collectors.toList()));
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(routeInfoDTO);
|
|
|
} else {
|
|
@@ -320,6 +341,23 @@ public class RouteInfoController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(dto.getAccounts() != null){
|
|
|
+ affectCount = routeAccountService.deleteByRouteId(dto.getId());
|
|
|
+
|
|
|
+ for (String accountId : dto.getAccounts()) {
|
|
|
+ RouteAccount ra = new RouteAccount();
|
|
|
+
|
|
|
+ ra.setId(UUID.randomUUID().toString());
|
|
|
+ ra.setRouteId(dto.getId());
|
|
|
+ ra.setAccountId(accountId);
|
|
|
+ ra.setCreateBy(subject);
|
|
|
+ ra.setCreateTime(new Date());
|
|
|
+ ra.setDelFlag(false);
|
|
|
+
|
|
|
+ affectCount += routeAccountService.insert(ra);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(routeInfoService.get(routeInfo.getId()));
|
|
|
} else {
|
|
@@ -438,7 +476,7 @@ public class RouteInfoController {
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
String companyId,String name,
|
|
|
- @RequestParam(value="regionI",defaultValue="") String regionId,
|
|
|
+ @RequestParam(value="regionId",defaultValue="") String regionId,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -467,6 +505,11 @@ public class RouteInfoController {
|
|
|
|
|
|
Page<RouteInfo> page = routeInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
+ for(RouteInfo routeInfo:page.getResult()){
|
|
|
+ List<RouteAccount> routeAccountList = routeAccountService.findByRouteId(routeInfo.getId());
|
|
|
+ routeInfo.setAccountNames(routeAccountList.stream().map((routeAccount)->routeAccount.getAccountName()).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|