init
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.sl;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableFeignClients
|
||||
@SpringBootApplication
|
||||
public class WebManagerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebManagerApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sl.ms.web.manager.config;
|
||||
|
||||
import com.sl.transport.common.interceptor.TokenInterceptor;
|
||||
import com.sl.transport.common.interceptor.UserInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 配置拦截器
|
||||
* 包含用户信息拦截器和token拦截器
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class ManagerWebConfig implements WebMvcConfigurer {
|
||||
|
||||
//拦截的时候过滤掉swagger相关路径和登录相关接口
|
||||
private static final String[] EXCLUDE_PATH_PATTERNS = new String[]{"/swagger-ui.html",
|
||||
"/webjars/**",
|
||||
"/swagger-resources",
|
||||
"/v2/api-docs",
|
||||
"/login/**",
|
||||
"/captcha",
|
||||
"/workspace/**"};
|
||||
@Resource
|
||||
private UserInterceptor userInterceptor;
|
||||
@Resource
|
||||
private TokenInterceptor tokenInterceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 用户信息拦截器
|
||||
registry.addInterceptor(userInterceptor).excludePathPatterns(EXCLUDE_PATH_PATTERNS).addPathPatterns("/**");
|
||||
// token拦截器
|
||||
registry.addInterceptor(tokenInterceptor).excludePathPatterns(EXCLUDE_PATH_PATTERNS).addPathPatterns("/**");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.sl.ms.web.manager.config;
|
||||
|
||||
import com.sl.transport.common.properties.AliOSSProperties;
|
||||
import com.sl.transport.common.service.AliOssService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 配置对象存储工具类
|
||||
* 主要用于上传图片和文件
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class OSSConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public AliOssService aliOSSUtil(AliOSSProperties aliOSSProperties) {
|
||||
log.info("创建阿里云OSS工具类...");
|
||||
|
||||
return new AliOssService(
|
||||
aliOSSProperties.getEndpoint(),
|
||||
aliOSSProperties.getAccessKeyId(),
|
||||
aliOSSProperties.getAccessKeySecret(),
|
||||
aliOSSProperties.getBucketName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.sl.ms.web.manager.config;
|
||||
|
||||
import com.sl.transport.common.config.FeignErrorDecoder;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* web调用feign失败解码器实现
|
||||
*
|
||||
* @author zzj
|
||||
* @version 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class WebFeignErrorDecoder extends FeignErrorDecoder {
|
||||
|
||||
@Override
|
||||
public Exception call(int status, int code, String msg) {
|
||||
return new SLWebException(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.sl.ms.web.manager.controller.agency;
|
||||
|
||||
import com.sl.ms.web.manager.service.AgencyService;
|
||||
import com.sl.ms.web.manager.service.AuthService;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyVO;
|
||||
import com.sl.ms.web.manager.vo.agency.ServiceScopeVO;
|
||||
import com.sl.ms.web.manager.vo.auth.CourierVO;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网点管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "网点管理")
|
||||
@RequestMapping("business-hall")
|
||||
@Slf4j
|
||||
public class AgencyController {
|
||||
@Resource
|
||||
private AgencyService agencyService;
|
||||
|
||||
@Resource
|
||||
private AuthService authService;
|
||||
|
||||
@ApiOperation(value = "获取树状机构信息")
|
||||
@GetMapping("/tree")
|
||||
public R<String> treeAgency() {
|
||||
return R.success(agencyService.treeAgency());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取机构详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "机构id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/{id}")
|
||||
public R<AgencyVO> findAgencyById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(agencyService.agencyDetail(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑机构")
|
||||
@PostMapping
|
||||
public R<AgencyVO> save(@RequestBody AgencyUpdateVO agencyVO) {
|
||||
agencyService.saveAgency(agencyVO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取员工详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "员工id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/user/{id}")
|
||||
public R<SysUserVO> findById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(authService.user(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取员工分页数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页尺寸", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "name", value = "司机名称"),
|
||||
@ApiImplicitParam(name = "account", value = "司机编号 账号"),
|
||||
@ApiImplicitParam(name = "agencyId", value = "机构ID"),
|
||||
@ApiImplicitParam(name = "phone", value = "电话")
|
||||
})
|
||||
@GetMapping("/user/page")
|
||||
public R<PageResponse<SysUserVO>> findUserByPage(@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "pageSize") Integer pageSize,
|
||||
@RequestParam(name = "name", required = false) String name,
|
||||
@RequestParam(name = "account", required = false) String account,
|
||||
@RequestParam(name = "agencyId", required = false) Long agencyId,
|
||||
@RequestParam(name = "phone", required = false) String phone) {
|
||||
return R.success(authService.findUserByPage(page, pageSize, agencyId, account, name, phone));
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取快递员分页数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页尺寸", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "name", value = "司机名称"),
|
||||
@ApiImplicitParam(name = "account", value = "司机编号 账号"),
|
||||
@ApiImplicitParam(name = "agentId", value = "机构ID"),
|
||||
@ApiImplicitParam(name = "phone", value = "电话")
|
||||
})
|
||||
@GetMapping("/courier/page")
|
||||
public R<PageResponse<SysUserVO>> findCourierByPage(@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "pageSize") Integer pageSize,
|
||||
@RequestParam(name = "name", required = false) String name,
|
||||
@RequestParam(name = "account", required = false) String account,
|
||||
@RequestParam(name = "agentId", required = false) Long agentId,
|
||||
@RequestParam(name = "phone", required = false) String phone) {
|
||||
return R.success(authService.findCourierByPage(page, pageSize, name, phone, account, agentId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取快递员详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "快递员id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/courier/{id}")
|
||||
public R<SysUserVO> findCourierById(@PathVariable(name = "id") String id) {
|
||||
return R.success(authService.user(Long.valueOf(id)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除作业范围")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "type", value = "type", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/scope/{id}/{type}")
|
||||
public R<Void> deleteScopeById(@PathVariable(name = "id") Long id, @PathVariable(name = "type") Integer type) {
|
||||
agencyService.deleteScopeById(id, type);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存业务范围")
|
||||
@PostMapping("/scope")
|
||||
public R<Void> saveScope(@RequestBody ServiceScopeVO vo) {
|
||||
agencyService.saveScope(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取业务范围")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "type", value = "type", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/scope/{id}/{type}")
|
||||
public R<ServiceScopeVO> findScope(@PathVariable(name = "id") Long id, @PathVariable(name = "type") Integer type) {
|
||||
return R.success(agencyService.findScope(id, type));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据机构查询快递员")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "agencyId", value = "机构ID")})
|
||||
@GetMapping("/courier/findByAgencyId/{agencyId}")
|
||||
public R<List<CourierVO>> findByAgencyId(@PathVariable(name = "agencyId") Long agencyId) {
|
||||
return R.success(authService.findByAgencyId(agencyId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.sl.ms.web.manager.controller.auth;
|
||||
|
||||
import com.itheima.auth.sdk.AuthTemplate;
|
||||
import com.itheima.auth.sdk.common.Result;
|
||||
import com.itheima.auth.sdk.dto.LoginDTO;
|
||||
import com.itheima.auth.sdk.dto.LoginParamDTO;
|
||||
import com.itheima.auth.sdk.dto.MenuDTO;
|
||||
import com.sl.ms.web.manager.service.AuthService;
|
||||
import com.sl.transport.common.exception.SLException;
|
||||
import com.sl.transport.common.util.AuthTemplateThreadLocal;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 鉴权服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "鉴权服务")
|
||||
@RestController
|
||||
public class AuthController {
|
||||
|
||||
@Autowired
|
||||
AuthService authService;
|
||||
|
||||
@Autowired
|
||||
AuthTemplate authTemplate;
|
||||
|
||||
/**
|
||||
* 查询用户可用的所有资源
|
||||
*
|
||||
* @return 菜单
|
||||
*/
|
||||
@ApiOperation(value = "查询用户可用的所有菜单", notes = "查询用户可用的所有菜单")
|
||||
@GetMapping(value = "/menus")
|
||||
public R<List<MenuDTO>> myMenus() {
|
||||
Result<List<MenuDTO>> menu = AuthTemplateThreadLocal.get().opsForPermission().getMenu();
|
||||
return R.success(menu.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户登录
|
||||
*
|
||||
* @param login 登录信息
|
||||
* @return 用户信息
|
||||
* @throws SLException 异常
|
||||
*/
|
||||
@ApiOperation(value = "登录", notes = "登录")
|
||||
@PostMapping(value = "/login")
|
||||
public R<LoginDTO> loginTx(@Validated @RequestBody LoginParamDTO login) throws SLException {
|
||||
log.info("account={}", login.getAccount());
|
||||
try {
|
||||
// TODO
|
||||
return authService.login(login);
|
||||
} catch (Exception e) {
|
||||
if (e.getClass().getName().equals(SLException.class.getName())) {
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "验证码", notes = "验证码")
|
||||
@GetMapping(value = "/captcha", produces = "image/png")
|
||||
public void captcha(@RequestParam(value = "key") String key, HttpServletResponse response) throws IOException {
|
||||
this.authService.create(key, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sl.ms.web.manager.controller.base.common;
|
||||
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.AreaSimpleVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 行政机构
|
||||
* 用于地址选择 省市县三级行政机构
|
||||
*/
|
||||
@Api(tags = "行政机构")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/areas")
|
||||
public class AreaController {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@ApiOperation("根据父id获取地址信息")
|
||||
@GetMapping("/children")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "行政区域父id", required = false, example = "0")
|
||||
})
|
||||
public R<List<AreaSimpleVO>> findChildrenAreaByParentId(@RequestParam(value = "parentId", required = false, defaultValue = "0") Long parentId) {
|
||||
return R.success(baseCommonService.findChildrenAreaByParentId(parentId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.sl.ms.web.manager.controller.base.common;
|
||||
|
||||
import com.sl.transport.common.service.AliOssService;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 文件上传服务
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/files")
|
||||
@Api(value = "File", tags = "文件上传相关接口")
|
||||
public class FileUploadController {
|
||||
|
||||
@Resource
|
||||
private AliOssService aliOssService;
|
||||
|
||||
@ApiOperation(value = "文件上传")
|
||||
@PostMapping("/upload")
|
||||
public R<String> upload(@RequestPart("file") MultipartFile file) {
|
||||
return R.success(aliOssService.upload(file));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "图片上传")
|
||||
@PostMapping("/imageUpload")
|
||||
public R<String> imageUpload(@RequestPart("file") MultipartFile file) {
|
||||
return R.success(aliOssService.uploadImage(file));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.sl.ms.web.manager.controller.base.common;
|
||||
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.GoodsTypeVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 货物类型管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "货物类型")
|
||||
@Slf4j
|
||||
public class GoodTypeController {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@ApiOperation(value = "添加货物类型")
|
||||
@PostMapping("/goodsType")
|
||||
public R<GoodsTypeVO> saveGoodsType(@RequestBody GoodsTypeVO vo) {
|
||||
baseCommonService.saveGoodsType(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新货物类型")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "货物类型id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/goodsType/{id}")
|
||||
public R<GoodsTypeVO> updateGoodsType(@PathVariable(name = "id") Long id, @RequestBody GoodsTypeVO vo) {
|
||||
baseCommonService.updateGoodsType(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取货物类型分页数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页尺寸", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "name", value = "货物类型名称"),
|
||||
@ApiImplicitParam(name = "truckTypeId", value = "车辆类型Id")
|
||||
})
|
||||
@GetMapping("/goodsType/page")
|
||||
public R<PageResponse<GoodsTypeVO>> findGoodsTypeByPage(@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "pageSize") Integer pageSize,
|
||||
@RequestParam(name = "name", required = false) String name,
|
||||
@RequestParam(name = "truckTypeId", required = false) Long truckTypeId) {
|
||||
return R.success(baseCommonService.findGoodsTypeByPage(page, pageSize, name, truckTypeId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取货物类型详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "货物类型id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/goodsType/{id}")
|
||||
public R<GoodsTypeVO> findGoodsTypeById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseCommonService.fineGoodsTypeById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除货物类型")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "货物类型id", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/goodsType/{id}")
|
||||
public R<GoodsTypeVO> deleteGoodsType(@PathVariable(name = "id") Long id) {
|
||||
baseCommonService.disableGoodsType(id);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取货物类型信息列表")
|
||||
@GetMapping(value = "goodsType/simple")
|
||||
public R<List<GoodsTypeVO>> goodsTypeSimple() {
|
||||
return R.success(baseCommonService.findGoodsTypeAll(null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.sl.ms.web.manager.controller.base.common;
|
||||
|
||||
import com.sl.ms.base.domain.base.WorkPatternAddDTO;
|
||||
import com.sl.ms.base.domain.base.WorkPatternDTO;
|
||||
import com.sl.ms.base.domain.base.WorkPatternQueryDTO;
|
||||
import com.sl.ms.base.domain.base.WorkPatternUpdateDTO;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作模式管理
|
||||
*/
|
||||
@RequestMapping("work-patterns")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "工作模式相关接口")
|
||||
public class WorkPatternController {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@GetMapping("all")
|
||||
@ApiOperation("工作模式列表查询")
|
||||
public R<Map<Byte, List<WorkPatternDTO>>> list() {
|
||||
return R.success(baseCommonService.listWorkPattern());
|
||||
}
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("工作模式分页查询")
|
||||
public R<PageResponse<WorkPatternDTO>> list(WorkPatternQueryDTO workPatternQueryDTO) {
|
||||
log.info("workPatternQueryDTO : {}", workPatternQueryDTO);
|
||||
return R.success(baseCommonService.listWorkPattern(workPatternQueryDTO));
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("根据工作模式id获取工作模式详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "工作模式id")
|
||||
})
|
||||
public R<WorkPatternDTO> getById(@PathVariable("id") Long id) {
|
||||
return R.success(baseCommonService.getWorkPatternById(id));
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
@ApiOperation("工作模式删除")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "工作模式id")
|
||||
})
|
||||
public R<Void> delete(@PathVariable("id") Long id) {
|
||||
baseCommonService.deleteWorkPattern(id);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增工作模式")
|
||||
public R<Void> add(@RequestBody WorkPatternAddDTO workPatternAddDTO) {
|
||||
baseCommonService.addWorkPattern(workPatternAddDTO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改工作模式")
|
||||
public R<Void> put(@RequestBody WorkPatternUpdateDTO workPatternUpdateDTO) {
|
||||
baseCommonService.putWorkPattern(workPatternUpdateDTO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.sl.ms.web.manager.controller.base.common;
|
||||
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.sl.ms.base.domain.base.WorkSchedulingDTO;
|
||||
import com.sl.ms.base.domain.base.WorkSchedulingQueryDTO;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.util.ExcelUtil;
|
||||
import com.sl.ms.web.manager.util.ImportVOListener;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.WorkSchedulingAddVO;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.WorkSchedulingExportVO;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.WorkSchedulingVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 排班管理
|
||||
*/
|
||||
@RequestMapping("work-schedulings")
|
||||
@Api(tags = "工作排班相关接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class WorkSchedulingController {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("分页查询排班")
|
||||
public R<PageResponse<WorkSchedulingDTO>> list(WorkSchedulingQueryDTO workSchedulingQueryDTO) {
|
||||
return R.success(baseCommonService.listWorkScheduling(workSchedulingQueryDTO));
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}/{operator}")
|
||||
@ApiOperation("删除")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "排班id"),
|
||||
@ApiImplicitParam(name = "operator", value = "操作人")
|
||||
})
|
||||
public R<Void> delete(@PathVariable("id") Long id, @PathVariable("operator") Long operator) {
|
||||
baseCommonService.deleteWorkScheduling(id, operator);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation("人工调整")
|
||||
@PutMapping
|
||||
public R<Void> update(@RequestBody WorkSchedulingVO workSchedulingVO) {
|
||||
baseCommonService.updateWorkScheduling(workSchedulingVO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation("批量关联排班")
|
||||
@PostMapping
|
||||
public R<Void> batchSaveWorkScheduling(@RequestBody WorkSchedulingAddVO workSchedulingAddVO) {
|
||||
baseCommonService.batchSaveWorkScheduling(workSchedulingAddVO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation("下载排班模板")
|
||||
@GetMapping("/downExcelTemplate")
|
||||
ResponseEntity downExcelTemplate() {
|
||||
return baseCommonService.downExcelTemplate();
|
||||
}
|
||||
|
||||
@ApiOperation("导入排班")
|
||||
@PostMapping("/uploadExcel")
|
||||
R uploadExcel(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
ImportVOListener ImportVOListener = new ImportVOListener();
|
||||
ExcelUtil.readExcel(file, WorkSchedulingExportVO.class, ImportVOListener);
|
||||
|
||||
List<ExcelDataConvertException> listException = ImportVOListener.getListException();
|
||||
Set<String> infoSet = listException.stream().map(e -> "第" + (e.getRowIndex() + 1) + "行 第" + (e.getColumnIndex() + 1) + "列,").collect(Collectors.toSet());
|
||||
List<WorkSchedulingExportVO> list = ImportVOListener.getList();
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return R.error(-1, "上传文件为空");
|
||||
}
|
||||
|
||||
if (list.size() > 2000) {
|
||||
return R.error(-1, "上传文件数不能超过2000");
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(infoSet)) {
|
||||
baseCommonService.batchSaveWorkScheduling(list);
|
||||
return R.success();
|
||||
}
|
||||
return R.error(-1, infoSet.toString() + "存在非法数据");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("上传Excel excelService-> uploadExcel 异常", e);
|
||||
return R.error(-1, "上传失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.sl.ms.web.manager.controller.base.common;
|
||||
|
||||
import com.sl.ms.web.manager.service.WorkspaceService;
|
||||
import com.sl.ms.web.manager.vo.workspace.MonthlyOrderAddVO;
|
||||
import com.sl.ms.web.manager.vo.workspace.WorkbenchAddVO;
|
||||
import com.sl.ms.web.manager.vo.workspace.WorkbenchVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作台相关
|
||||
*/
|
||||
@Api(tags = "工作台")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/workspace")
|
||||
public class WorkspaceController {
|
||||
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
@ApiOperation("新增数据")
|
||||
@PostMapping
|
||||
public R<Void> saveWorkbench(@RequestBody WorkbenchAddVO workbenchVO) {
|
||||
workspaceService.saveWorkbench(workbenchVO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation("新增订单总量数据")
|
||||
@PostMapping("saveOrderNumber")
|
||||
public R<Void> saveOrderNumber(@RequestBody List<MonthlyOrderAddVO> monthlyOrderList) {
|
||||
workspaceService.saveOrderNumber(monthlyOrderList);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查询一条数据")
|
||||
@GetMapping
|
||||
public R<WorkbenchVO> findOne() {
|
||||
return R.success(workspaceService.findOne());
|
||||
}
|
||||
|
||||
@ApiOperation("删除所有")
|
||||
@DeleteMapping("deleteAll")
|
||||
public R<Void> deleteAll() {
|
||||
workspaceService.deleteAll();
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.sl.ms.web.manager.controller.base.truck;
|
||||
|
||||
import com.sl.ms.web.manager.service.BaseTruckService;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.BindingDriversVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.DriverLicenseVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.DriverUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.DriverVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 司机管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "司机管理")
|
||||
@Slf4j
|
||||
public class DriverController {
|
||||
|
||||
|
||||
@Resource
|
||||
private BaseTruckService baseTruckService;
|
||||
|
||||
@ApiOperation(value = "获取司机分页数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页尺寸", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "name", value = "司机名称"),
|
||||
@ApiImplicitParam(name = "account", value = "司机编号 账号"),
|
||||
@ApiImplicitParam(name = "agentId", value = "机构ID"),
|
||||
@ApiImplicitParam(name = "phone", value = "电话"),
|
||||
@ApiImplicitParam(name = "workStatus", value = "工作状态")
|
||||
})
|
||||
@GetMapping("/driver/page")
|
||||
public R<PageResponse<DriverVO>> findDriverByPage(@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "pageSize") Integer pageSize,
|
||||
@RequestParam(name = "name", required = false) String name,
|
||||
@RequestParam(name = "account", required = false) String account,
|
||||
@RequestParam(name = "workStatus", required = false) String workStatus,
|
||||
@RequestParam(name = "agentId", required = false) Long agentId,
|
||||
@RequestParam(name = "phone", required = false) String phone) {
|
||||
return R.success(baseTruckService.findDriverByPage(page, pageSize, name, account, workStatus, agentId, phone));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取司机基本信息详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "司机id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/driver/{id}")
|
||||
public R<DriverVO> findDriverById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseTruckService.findDriverById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存司机信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "司机id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/driver/{id}")
|
||||
public R<DriverUpdateVO> saveDriver(@PathVariable(name = "id") Long id, @RequestBody DriverUpdateVO vo) {
|
||||
baseTruckService.saveDriver(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存司机驾驶证信息")
|
||||
@PostMapping("/driverLicense")
|
||||
public R<DriverLicenseVO> saveDriverLicense(@RequestBody DriverLicenseVO vo) {
|
||||
baseTruckService.saveDriverLicense(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取司机驾驶证信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "司机id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/driverLicense/{id}")
|
||||
public R<DriverLicenseVO> findDriverLicenseById(@PathVariable(name = "id") Long id) {
|
||||
DriverLicenseVO driverLicenseById = baseTruckService.findDriverLicenseById(id);
|
||||
return R.success(driverLicenseById);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "司机安排车辆 【司机:车辆 = n:1】")
|
||||
@PostMapping("/driver/truckDrivers")
|
||||
public R<Void> BindingDrivers(@RequestBody BindingDriversVO bindingDriversVO) {
|
||||
baseTruckService.bindingTrucks(bindingDriversVO);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.sl.ms.web.manager.controller.base.truck;
|
||||
|
||||
import com.sl.ms.web.manager.service.BaseTruckService;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.*;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 车辆管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "车辆管理")
|
||||
@Slf4j
|
||||
public class TruckController {
|
||||
@Resource
|
||||
private BaseTruckService baseTruckService;
|
||||
|
||||
@ApiOperation(value = "添加车辆")
|
||||
@PostMapping("/truck")
|
||||
public R<TruckVO> saveTruck(@RequestBody TruckVO vo) {
|
||||
baseTruckService.saveTruck(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新车辆信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/truck/{id}")
|
||||
public R<TruckVO> updateTruck(@PathVariable(name = "id") Long id, @RequestBody TruckVO vo) {
|
||||
baseTruckService.updateTruck(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车辆分页数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页尺寸", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "truckTypeId", value = "车辆类型id"),
|
||||
@ApiImplicitParam(name = "workStatus", value = "状态"),
|
||||
@ApiImplicitParam(name = "licensePlate", value = "车牌号码")
|
||||
})
|
||||
@GetMapping("/truck/page")
|
||||
public R<PageResponse<TruckVO>> findTruckByPage(@RequestParam(name = "page", required = false) Integer page,
|
||||
@RequestParam(name = "pageSize", required = false) Integer pageSize,
|
||||
@RequestParam(name = "truckTypeId", required = false) Long truckTypeId,
|
||||
@RequestParam(name = "workStatus", required = false) Integer workStatus,
|
||||
@RequestParam(name = "licensePlate", required = false) String licensePlate) {
|
||||
return R.success(baseTruckService.findTruckByPage(page, pageSize, truckTypeId, workStatus, licensePlate));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车辆详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/truck/{id}")
|
||||
public R<TruckVO> findTruckById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseTruckService.findTruckDetail(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "统计车辆")
|
||||
@GetMapping("/count")
|
||||
public R<Map<Integer, Long>> count() {
|
||||
return R.success(baseTruckService.countTruck());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "停用车辆")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/disable/{id}")
|
||||
public R<Void> disable(@PathVariable(name = "id") Long id) {
|
||||
baseTruckService.disableTruck(id);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "启用车辆")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/enable/{id}")
|
||||
public R<Void> enable(@PathVariable(name = "id") Long id) {
|
||||
baseTruckService.enableTruck(id);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除车辆")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/del/{id}")
|
||||
public R<Void> del(@PathVariable(name = "id") Long id) {
|
||||
baseTruckService.delTruck(id);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存车辆行驶证信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@PostMapping("/truck/{id}/license")
|
||||
public R<TruckLicenseVO> saveTruckLicense(@PathVariable(name = "id") Long id, @RequestBody TruckLicenseVO vo) {
|
||||
baseTruckService.saveTruckLicense(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车辆行驶证详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/truck/{id}/license")
|
||||
public R<TruckLicenseVO> findTruckLicenseById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseTruckService.findTruckLicenseById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车辆车次信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/truck/{id}/transportTrips")
|
||||
public R<List<TruckDriverTripsVO>> findTruckTransportTrips(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseTruckService.findTruckTrips(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定司机
|
||||
*
|
||||
* @param truckId 车辆ID
|
||||
* @return 司机数量
|
||||
*/
|
||||
@ApiOperation(value = "获取绑定司机")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "truckId", value = "车辆id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/bindingDrivers/{truckId}")
|
||||
R<List<DriverVO>> bindingDrivers(@PathVariable(name = "truckId") Long truckId) {
|
||||
return R.success(baseTruckService.bindingTrucks(truckId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未绑定车辆的司机
|
||||
*
|
||||
* @return 司机数量
|
||||
*/
|
||||
@ApiOperation(value = "获取未绑定车辆的司机")
|
||||
@GetMapping("/unBindingDrivers/")
|
||||
R<List<DriverVO>> unBindingDrivers() {
|
||||
return R.success(baseTruckService.unBindingDrivers());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经启用的车辆
|
||||
* 没有绑定其他车次的车辆
|
||||
* 包含反向线路下的车辆
|
||||
*
|
||||
* @return 车辆
|
||||
*/
|
||||
@ApiOperation(value = "获取已经启用的车辆")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "startAgentId", value = "开始机构id", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "endAgentId", value = "结束机构id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/workingTrucks")
|
||||
R<List<TruckVO>> workingTrucks(Long startAgentId, Long endAgentId) {
|
||||
return R.success(baseTruckService.workingTrucks(startAgentId, endAgentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经停用的车辆
|
||||
* 没有绑定2个司机的车辆
|
||||
*
|
||||
* @return 车辆
|
||||
*/
|
||||
@ApiOperation(value = "获取已经停用的车辆")
|
||||
@GetMapping("/unWorkingTrucks")
|
||||
R<List<TruckVO>> unWorkingTrucks() {
|
||||
return R.success(baseTruckService.unWorkingTrucks());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "车辆绑定司机 【司机:车辆 = n:1】")
|
||||
@PostMapping("/truck/truckDrivers")
|
||||
public R<Void> bindingDrivers(@RequestBody BindingDriversVO bindingDriversVO) {
|
||||
baseTruckService.bindingDrivers(bindingDriversVO);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.sl.ms.web.manager.controller.base.truck;
|
||||
|
||||
import com.sl.ms.web.manager.service.TruckReturnRegisterService;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterListVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterPageQueryVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 回车登记
|
||||
*/
|
||||
|
||||
@Api(tags = "回车登记")
|
||||
@RestController
|
||||
@RequestMapping("truck-return-register")
|
||||
@Slf4j
|
||||
public class TruckReturnRegisterController {
|
||||
@Resource
|
||||
private TruckReturnRegisterService truckReturnRegisterService;
|
||||
|
||||
@ApiOperation(value = "分页查询回车登记列表")
|
||||
@PostMapping("/pageQuery")
|
||||
public R<PageResponse<TruckReturnRegisterListVO>> pageQuery(@RequestBody TruckReturnRegisterPageQueryVO vo) {
|
||||
return R.success(truckReturnRegisterService.pageQuery(vo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "回车登记详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "回车登记id", required = true, dataTypeClass = Long.class)
|
||||
})
|
||||
@GetMapping("/detail/{id}")
|
||||
public R<TruckReturnRegisterVO> detail(@PathVariable("id") Long id) {
|
||||
return R.success(truckReturnRegisterService.detail(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.sl.ms.web.manager.controller.base.truck;
|
||||
|
||||
import com.sl.ms.web.manager.service.BaseTruckService;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.BindingTrucksVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TransportTripsUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TransportTripsVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 车次管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "车次管理")
|
||||
@Slf4j
|
||||
public class TruckTripsController {
|
||||
|
||||
@Resource
|
||||
private BaseTruckService baseTruckService;
|
||||
|
||||
@ApiOperation(value = "添加车次")
|
||||
@PostMapping("/transportLine/trips")
|
||||
public R<TransportTripsUpdateVO> saveTransportTrips(@RequestBody TransportTripsUpdateVO vo) {
|
||||
baseTruckService.saveTrips(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新车次")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车次id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/transportLine/trips/{id}")
|
||||
public R<TransportTripsUpdateVO> updateTransportTrips(@PathVariable(name = "id") Long id, @RequestBody TransportTripsUpdateVO vo) {
|
||||
baseTruckService.updateTrips(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车次列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "transportLineId", value = "线路id")
|
||||
})
|
||||
@GetMapping("/transportLine/trips")
|
||||
public R<List<TransportTripsVO>> findAllTransportLineTrips(@RequestParam(name = "transportLineId", required = false) Long transportLineId) {
|
||||
return R.success(baseTruckService.findAllTrips(transportLineId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车次详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车次id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/transportLine/trips/{id}")
|
||||
public R<TransportTripsVO> findTransportLineTripsById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseTruckService.findTripsDetail(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除车次")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车次id", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/transportLine/trips/{id}")
|
||||
public R<Void> deleteTransportLineTrips(@PathVariable(name = "id") Long id) {
|
||||
baseTruckService.deleteTransportLineTrips(id);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "车次-安排车辆 不涉及司机的安排 司机会根据【司机车辆绑定关系】和排班情况调度决定")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车次id", required = true, example = "1")
|
||||
})
|
||||
@PostMapping("/transportLine/trips/{id}/truckDrivers")
|
||||
public R<Void> saveTransportTripsTruck(@PathVariable(name = "id") Long id, @RequestBody BindingTrucksVO bindingTrucksVO) {
|
||||
//保存车辆安排信息
|
||||
baseTruckService.bindingTrucks(id, bindingTrucksVO);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车次-车辆绑定关系")
|
||||
@GetMapping("/transportLine/trips/truckDrivers")
|
||||
public R<List<TruckVO>> getTransportTripsTruck(Long transportTripsId) {
|
||||
return R.success(baseTruckService.getTransportTripsTruck(transportTripsId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.sl.ms.web.manager.controller.base.truck;
|
||||
|
||||
import com.sl.ms.web.manager.enums.TruckTypeAllowableLoadEnum;
|
||||
import com.sl.ms.web.manager.enums.TruckTypeAllowableVolumeEnum;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckTypeVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆类型管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "车型管理")
|
||||
@Slf4j
|
||||
public class TruckTypeController {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@ApiOperation(value = "获取车辆类型信息列表")
|
||||
@GetMapping(value = "truckType/simple")
|
||||
public R<List<TruckTypeVO>> truckTypeSimple() {
|
||||
return R.success(baseCommonService.truckTypeSimple());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加车辆类型")
|
||||
@PostMapping("/truckType")
|
||||
public R<TruckTypeVO> saveTruckType(@RequestBody TruckTypeVO vo) {
|
||||
baseCommonService.saveTruckType(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新车辆类型")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆类型id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/truckType/{id}")
|
||||
public R<TruckTypeVO> updateTruckType(@PathVariable(name = "id") Long id, @RequestBody TruckTypeVO vo) {
|
||||
baseCommonService.updateTruckType(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车辆类型分页数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "页码", required = true, example = "1", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页尺寸", required = true, example = "10", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "name", value = "车辆类型名称", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "allowableLoad", value = "车型载重,单位:吨;左闭右开区间", example = "[1.8,6)", dataTypeClass = TruckTypeAllowableLoadEnum.class),
|
||||
@ApiImplicitParam(name = "allowableVolume", value = "车型体积,单位:立方米;左闭右开区间", example = "[5,10)", dataTypeClass = TruckTypeAllowableVolumeEnum.class),
|
||||
@ApiImplicitParam(name = "id", value = "车型id", dataTypeClass = Long.class)
|
||||
})
|
||||
@GetMapping("/truckType/page")
|
||||
public R<PageResponse<TruckTypeVO>> findTruckTypeByPage(@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "pageSize") Integer pageSize,
|
||||
@RequestParam(name = "name", required = false) String name,
|
||||
@RequestParam(name = "allowableLoad", required = false) TruckTypeAllowableLoadEnum allowableLoad,
|
||||
@RequestParam(name = "allowableVolume", required = false) TruckTypeAllowableVolumeEnum allowableVolume,
|
||||
@RequestParam(name = "id", required = false) Long id) {
|
||||
return R.success(baseCommonService.findTruckTypeByPage(page, pageSize, name, allowableLoad, allowableVolume, id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取车辆类型详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆类型id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/truckType/{id}")
|
||||
public R<TruckTypeVO> findTruckTypeById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(baseCommonService.findTruckTypeById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除车辆类型")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "车辆类型id", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/truckType/{id}")
|
||||
public R<Void> deleteTruckType(@PathVariable(name = "id") Long id) {
|
||||
baseCommonService.deleteTruckType(id);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.sl.ms.web.manager.controller.carriage;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.sl.ms.carriage.domain.dto.CarriageDTO;
|
||||
import com.sl.ms.web.manager.service.CarriageService;
|
||||
import com.sl.ms.web.manager.vo.carriage.CarriageVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("carriages")
|
||||
@Api(tags = "运费管理")
|
||||
public class CarriageController {
|
||||
@Resource
|
||||
private CarriageService carriageService;
|
||||
|
||||
@ApiOperation(value = "运费模板列表")
|
||||
@GetMapping
|
||||
public R<List<CarriageVO>> findAll() {
|
||||
return R.success(carriageService.findAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增/修改运费模板")
|
||||
@PostMapping
|
||||
public R<CarriageVO> saveOrUpdate(@RequestBody CarriageDTO carriageDto) {
|
||||
CarriageVO vo = carriageService.saveOrUpdate(carriageDto);
|
||||
if (ObjectUtil.isEmpty(vo)) {
|
||||
R.error("运费模板存在重复");
|
||||
}
|
||||
return R.success(vo);
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
@ApiOperation(value = "删除运费模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "运费模板id", required = true, dataTypeClass = Long.class)})
|
||||
public R<CarriageVO> delete(@NotNull(message = "id不能为空") @PathVariable("id") Long id) {
|
||||
carriageService.delete(id);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sl.ms.web.manager.controller.oms;
|
||||
|
||||
import com.sl.ms.web.manager.service.OmsService;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderCargoUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderCargoVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 货品管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("order-manager/cargo")
|
||||
@Api(tags = "货品管理")
|
||||
@Slf4j
|
||||
public class CargoController {
|
||||
|
||||
@Resource
|
||||
private OmsService omsService;
|
||||
|
||||
@ApiOperation(value = "添加货物")
|
||||
@PostMapping
|
||||
public R<OrderCargoUpdateVO> saveOrderCargo(@RequestBody OrderCargoUpdateVO vo) {
|
||||
omsService.save(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取货物列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderId", value = "订单id", required = true, example = "0")
|
||||
})
|
||||
@GetMapping
|
||||
public R<List<OrderCargoVO>> findAll(@RequestParam("orderId") Long orderId) {
|
||||
return R.success(omsService.findAll(null, orderId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新货物信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "货物id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R<OrderCargoUpdateVO> updateOrderCargo(@PathVariable("id") Long id, @RequestBody OrderCargoUpdateVO vo) {
|
||||
omsService.update(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除货物")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "货物id", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/{id}")
|
||||
public R<OrderCargoVO> delete(@PathVariable("id") Long id) {
|
||||
omsService.del(id);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.sl.ms.web.manager.controller.oms;
|
||||
|
||||
import com.sl.ms.web.manager.service.OmsService;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderQueryVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 订单管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "订单管理")
|
||||
@RequestMapping("order-manager/order")
|
||||
@Slf4j
|
||||
public class OrderController {
|
||||
|
||||
@Resource
|
||||
private OmsService omsService;
|
||||
|
||||
@ApiOperation(value = "获取订单分页数据")
|
||||
@PostMapping("/page")
|
||||
public R<PageResponse<OrderVO>> findByPage(@RequestBody OrderQueryVO vo) {
|
||||
return R.success(omsService.findByPage(vo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取订单详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "订单id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/{id}")
|
||||
public R<OrderVO> findOrderById(@PathVariable("id") Long id) {
|
||||
return R.success(omsService.findOrderDetail(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新订单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "订单id", required = true, example = "1")
|
||||
})
|
||||
@PostMapping("/{id}")
|
||||
public R<OrderVO> updateOrder(@PathVariable("id") Long id, @RequestBody OrderVO vo) {
|
||||
omsService.updateOrder(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.sl.ms.web.manager.controller.transport;
|
||||
|
||||
import com.sl.ms.web.manager.service.TransportService;
|
||||
import com.sl.ms.web.manager.vo.work.CostConfigurationVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度配置管理
|
||||
*/
|
||||
@Api(tags = "成本配置")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("cost-configuration-manager")
|
||||
public class CostConfigurationController {
|
||||
@Resource
|
||||
private TransportService transportService;
|
||||
|
||||
@ApiOperation(value = "保存成本配置")
|
||||
@PostMapping
|
||||
public R<Void> saveConfiguration(@Valid @RequestBody List<CostConfigurationVO> vo) {
|
||||
transportService.saveCostConfiguration(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询成本配置")
|
||||
@GetMapping
|
||||
public R<List<CostConfigurationVO>> findConfiguration() {
|
||||
return R.success(transportService.findCostConfiguration());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.sl.ms.web.manager.controller.transport;
|
||||
|
||||
import com.sl.ms.web.manager.service.TransportService;
|
||||
import com.sl.ms.web.manager.vo.work.DispatchConfigurationVO;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 调度配置管理
|
||||
*/
|
||||
@Api(tags = "调度配置")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("dispatch-configuration-manager")
|
||||
public class DispatchConfigurationController {
|
||||
@Resource
|
||||
private TransportService transportService;
|
||||
|
||||
@ApiOperation(value = "保存调度配置")
|
||||
@PostMapping
|
||||
public R<Void> saveConfiguration(@Valid @RequestBody DispatchConfigurationVO vo) {
|
||||
transportService.saveConfiguration(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询调度配置")
|
||||
@GetMapping
|
||||
public R<DispatchConfigurationVO> findConfiguration() {
|
||||
return R.success(transportService.findConfiguration());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.sl.ms.web.manager.controller.transport;
|
||||
|
||||
import com.sl.ms.web.manager.service.TransportService;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineQueryVO;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 线路管理
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "线路管理")
|
||||
@Slf4j
|
||||
public class TransportLineController {
|
||||
|
||||
@Resource
|
||||
private TransportService transportService;
|
||||
|
||||
@ApiOperation(value = "添加线路")
|
||||
@PostMapping("/transportLine")
|
||||
public R<TransportLineVO> saveTransportLine(@RequestBody TransportLineVO vo) {
|
||||
transportService.saveTransportLine(vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新线路")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "线路id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/transportLine/{id}")
|
||||
public R<TransportLineVO> updateTransportLine(@PathVariable(name = "id") Long id, @RequestBody TransportLineVO vo) {
|
||||
transportService.updateTransportLine(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取线路分页数据")
|
||||
@PostMapping("/transportLine/page")
|
||||
public R<PageResponse<TransportLineVO>> findTransportLineByPage(@RequestBody TransportLineQueryVO transportLineQueryVO) {
|
||||
return R.success(transportService.findTransportLineByPage(transportLineQueryVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取线路详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "线路id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/transportLine/{id}")
|
||||
public R<TransportLineVO> findTransportLineById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(transportService.findTransportLineById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除线路")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "线路id", required = true, example = "1")
|
||||
})
|
||||
@DeleteMapping("/transportLine/{id}")
|
||||
public R<Void> deleteTransportLine(@PathVariable(name = "id") Long id) {
|
||||
transportService.deleteTransportLine(id);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.sl.ms.web.manager.controller.work;
|
||||
|
||||
import com.sl.ms.web.manager.service.WorkService;
|
||||
import com.sl.ms.web.manager.vo.work.PickupDispatchTaskListVO;
|
||||
import com.sl.ms.web.manager.vo.work.TaskPickupDispatchQueryVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 取件、派件任务管理
|
||||
*/
|
||||
@Api(tags = "派件、取件任务")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("pickup-dispatch-task-manager")
|
||||
public class PickupDispatchTaskController {
|
||||
@Resource
|
||||
private WorkService workService;
|
||||
|
||||
@ApiOperation(value = "获取取派件分页数据")
|
||||
@PostMapping("/page")
|
||||
public R<PageResponse<PickupDispatchTaskListVO>> findByPage(@RequestBody TaskPickupDispatchQueryVO vo) {
|
||||
return R.success(workService.findTaskPickupDispatchByPage(vo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分配快递员")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "courierId", value = "快递员id", required = true, dataTypeClass = Long.class)})
|
||||
@PutMapping("/{courierId}")
|
||||
public R<Void> update(@PathVariable(name = "courierId") Long courierId, @RequestBody List<String> ids) {
|
||||
workService.updateTaskPickupDispatchById(ids, courierId);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.sl.ms.web.manager.controller.work;
|
||||
|
||||
import com.sl.ms.web.manager.service.WorkService;
|
||||
import com.sl.ms.web.manager.vo.work.TrackVO;
|
||||
import com.sl.ms.web.manager.vo.work.TransportOrderQueryVO;
|
||||
import com.sl.ms.web.manager.vo.work.TransportOrderVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 运单管理
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "运单相关")
|
||||
@RestController
|
||||
@RequestMapping("transport-order-manager")
|
||||
public class TransportOrderController {
|
||||
|
||||
@Resource
|
||||
private WorkService workService;
|
||||
|
||||
@ApiOperation(value = "获取运单分页数据")
|
||||
@PostMapping("/page")
|
||||
public R<PageResponse<TransportOrderVO>> findByPage(@RequestBody TransportOrderQueryVO vo) {
|
||||
return R.success(workService.findTransportOrderByPage(vo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取运单详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "运单id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/{id}")
|
||||
public R<TransportOrderVO> findById(@PathVariable(name = "id") String id) {
|
||||
return R.success(workService.findTransportOrderDetail(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "统计运单")
|
||||
@GetMapping("/count")
|
||||
public R<Map<Integer, Long>> count() {
|
||||
return R.success(workService.countTransportOrder());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取运单轨迹详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "运单id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/track/{id}")
|
||||
public R<TrackVO> findTrackById(@PathVariable(name = "id") String id) {
|
||||
return R.success(workService.findTrackById(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.sl.ms.web.manager.controller.work;
|
||||
|
||||
import com.sl.ms.web.manager.service.WorkService;
|
||||
import com.sl.ms.web.manager.vo.work.PointVO;
|
||||
import com.sl.ms.web.manager.vo.work.TaskTransportQueryVO;
|
||||
import com.sl.ms.web.manager.vo.work.TaskTransportUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.work.TaskTransportVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 运输任务管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "运输任务")
|
||||
@RequestMapping("transport-task-manager")
|
||||
public class TransportTaskController {
|
||||
@Resource
|
||||
private WorkService workService;
|
||||
|
||||
@ApiOperation(value = "获取运输任务分页数据")
|
||||
@PostMapping("/page")
|
||||
public R<PageResponse<TaskTransportVO>> findByPage(@RequestBody TaskTransportQueryVO vo) {
|
||||
return R.success(workService.findTaskByPage(vo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取运输任务详情")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "运输任务id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("/{id}")
|
||||
public R<TaskTransportVO> findById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(workService.findTaskById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取运输任务坐标")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "运输任务id", required = true, example = "1")
|
||||
})
|
||||
@GetMapping("point/{id}")
|
||||
public R<LinkedHashSet<PointVO>> findPointById(@PathVariable(name = "id") Long id) {
|
||||
return R.success(workService.findTaskPointById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "手动调整 发车前调整车次 车辆 司机")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "运输任务id", required = true, example = "1")
|
||||
})
|
||||
@PutMapping("/adjust/{id}")
|
||||
public R<TaskTransportVO> adjust(@PathVariable(name = "id") Long id, @RequestBody TaskTransportUpdateVO vo) {
|
||||
workService.adjustTask(id, vo);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "统计运输任务")
|
||||
@GetMapping("/count")
|
||||
public R<Map<Integer, Long>> count() {
|
||||
return R.success(workService.countTask());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "空车取消运输任务")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "运输任务id", required = true, dataTypeClass = Long.class)})
|
||||
@PutMapping("/cancel/{id}")
|
||||
public R<Void> cancel(@PathVariable("id") Long id) {
|
||||
workService.cancel(id);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.sl.ms.web.manager.enums;
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.LoadRangeVO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 车型应载重量枚举类
|
||||
*/
|
||||
|
||||
public enum TruckTypeAllowableLoadEnum {
|
||||
/**
|
||||
* 应载重量:0<=weight<1.8
|
||||
*/
|
||||
RANGE_LEVEL_1(1, new LoadRangeVO(BigDecimal.valueOf(0.0), BigDecimal.valueOf(1.8))),
|
||||
/**
|
||||
* 应载重量:1.8<=weight<6
|
||||
*/
|
||||
RANGE_LEVEL_2(2, new LoadRangeVO(BigDecimal.valueOf(1.8), BigDecimal.valueOf(6.0))),
|
||||
/**
|
||||
* 应载重量:6<=weight<14
|
||||
*/
|
||||
RANGE_LEVEL_3(3, new LoadRangeVO(BigDecimal.valueOf(6.0), BigDecimal.valueOf(14.0))),
|
||||
/**
|
||||
* 应载重量:14<=weight<30
|
||||
*/
|
||||
RANGE_LEVEL_4(4, new LoadRangeVO(BigDecimal.valueOf(14.0), BigDecimal.valueOf(30.0))),
|
||||
/**
|
||||
* 应载重量:30<=weight<50
|
||||
*/
|
||||
RANGE_LEVEL_5(5, new LoadRangeVO(BigDecimal.valueOf(30.0), BigDecimal.valueOf(50.0))),
|
||||
/**
|
||||
* 应载重量:50<=weight<100
|
||||
*/
|
||||
RANGE_LEVEL_6(6, new LoadRangeVO(BigDecimal.valueOf(50.0), BigDecimal.valueOf(100.0))),
|
||||
/**
|
||||
* 应载重量:100<=weight
|
||||
*/
|
||||
RANGE_LEVEL_7(7, new LoadRangeVO(BigDecimal.valueOf(100.0), null));
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@EnumValue
|
||||
@JsonValue
|
||||
private final Integer code;
|
||||
/**
|
||||
* 类型值
|
||||
*/
|
||||
private final LoadRangeVO value;
|
||||
|
||||
TruckTypeAllowableLoadEnum(Integer code, LoadRangeVO value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static TruckTypeAllowableLoadEnum codeOf(Integer code) {
|
||||
return EnumUtil.getBy(TruckTypeAllowableLoadEnum::getCode, code);
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public LoadRangeVO getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.sl.ms.web.manager.enums;
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.LoadRangeVO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 车型应载体积枚举类
|
||||
*/
|
||||
|
||||
public enum TruckTypeAllowableVolumeEnum {
|
||||
/**
|
||||
* 应载体积:0<=体积<3
|
||||
*/
|
||||
RANGE_LEVEL_1(1, new LoadRangeVO(BigDecimal.valueOf(0), BigDecimal.valueOf(3))),
|
||||
/**
|
||||
* 应载体积:3<=体积<5
|
||||
*/
|
||||
RANGE_LEVEL_2(2, new LoadRangeVO(BigDecimal.valueOf(3), BigDecimal.valueOf(5))),
|
||||
/**
|
||||
* 应载体积:5<=体积<10
|
||||
*/
|
||||
RANGE_LEVEL_3(3, new LoadRangeVO(BigDecimal.valueOf(5), BigDecimal.valueOf(10))),
|
||||
/**
|
||||
* 应载体积:10<=体积<15
|
||||
*/
|
||||
RANGE_LEVEL_4(4, new LoadRangeVO(BigDecimal.valueOf(10), BigDecimal.valueOf(15))),
|
||||
/**
|
||||
* 应载体积:15<=体积<30
|
||||
*/
|
||||
RANGE_LEVEL_5(5, new LoadRangeVO(BigDecimal.valueOf(15), BigDecimal.valueOf(30))),
|
||||
/**
|
||||
* 应载体积:30<=体积<50
|
||||
*/
|
||||
RANGE_LEVEL_6(6, new LoadRangeVO(BigDecimal.valueOf(30), BigDecimal.valueOf(50))),
|
||||
/**
|
||||
* 应载体积:50<=体积<80
|
||||
*/
|
||||
RANGE_LEVEL_7(7, new LoadRangeVO(BigDecimal.valueOf(50), BigDecimal.valueOf(80))),
|
||||
/**
|
||||
* 应载体积:80<=体积<150
|
||||
*/
|
||||
RANGE_LEVEL_8(8, new LoadRangeVO(BigDecimal.valueOf(80), BigDecimal.valueOf(150))),
|
||||
/**
|
||||
* 应载体积:150<=体积
|
||||
*/
|
||||
RANGE_LEVEL_9(9, new LoadRangeVO(BigDecimal.valueOf(150), null));
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@EnumValue
|
||||
@JsonValue
|
||||
private final Integer code;
|
||||
/**
|
||||
* 类型值
|
||||
*/
|
||||
private final LoadRangeVO value;
|
||||
|
||||
TruckTypeAllowableVolumeEnum(Integer code, LoadRangeVO value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static TruckTypeAllowableVolumeEnum codeOf(Integer code) {
|
||||
return EnumUtil.getBy(TruckTypeAllowableVolumeEnum::getCode, code);
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public LoadRangeVO getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyVO;
|
||||
import com.sl.ms.web.manager.vo.agency.ServiceScopeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 营业部管理
|
||||
*/
|
||||
public interface AgencyService {
|
||||
/**
|
||||
* 获取机构树
|
||||
*
|
||||
* @return 机构树
|
||||
*/
|
||||
String treeAgency();
|
||||
|
||||
/**
|
||||
* 获取机构详情
|
||||
*
|
||||
* @param id 机构id
|
||||
* @return 执行结果
|
||||
*/
|
||||
AgencyVO agencyDetail(Long id);
|
||||
|
||||
/**
|
||||
* 获取简要机构
|
||||
*
|
||||
* @param id 机构id
|
||||
* @return 执行结果
|
||||
*/
|
||||
AgencySimpleVO agencySimple(Long id);
|
||||
|
||||
/**
|
||||
* 批量获取简要机构
|
||||
*
|
||||
* @param ids 机构ids
|
||||
* @return 执行结果
|
||||
*/
|
||||
List<AgencySimpleVO> batchAgencySimple(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 编辑机构
|
||||
*
|
||||
* @param agencyVO 机构信息
|
||||
*/
|
||||
void saveAgency(AgencyUpdateVO agencyVO);
|
||||
|
||||
|
||||
/**
|
||||
* 删除范围
|
||||
*
|
||||
* @param id 范围ID
|
||||
* @param type 范围类型
|
||||
*/
|
||||
void deleteScopeById(Long id, Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 保存范围
|
||||
*
|
||||
* @param vo 范围信息
|
||||
*/
|
||||
void saveScope(ServiceScopeVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 查询范围
|
||||
*
|
||||
* @param id 范围ID
|
||||
* @param type 范围类型
|
||||
* @return 范围信息
|
||||
*/
|
||||
ServiceScopeVO findScope(Long id, Integer type);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.itheima.auth.sdk.dto.LoginDTO;
|
||||
import com.itheima.auth.sdk.dto.LoginParamDTO;
|
||||
import com.itheima.auth.sdk.dto.UserDTO;
|
||||
import com.sl.ms.web.manager.vo.auth.CourierVO;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 鉴权服务
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
public interface AuthService {
|
||||
/**
|
||||
* 登录获取token
|
||||
*
|
||||
* @param account 账号
|
||||
* @param password 密码
|
||||
* @return 登录信息
|
||||
*/
|
||||
R<LoginDTO> login(String account, String password);
|
||||
|
||||
/**
|
||||
* 生成验证码
|
||||
*
|
||||
* @param key 验证码 uuid
|
||||
* @param response HttpServletResponse
|
||||
* @throws IOException
|
||||
*/
|
||||
void create(String key, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
* @param key 前端上送 key
|
||||
* @param value 前端上送待校验值
|
||||
* @return 通过
|
||||
*/
|
||||
boolean check(String key, String value);
|
||||
|
||||
/**
|
||||
* 转换用户
|
||||
*
|
||||
* @param userDTO 用户DTO
|
||||
* @return 用户VO
|
||||
*/
|
||||
SysUserVO parseUser2Vo(UserDTO userDTO);
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return 执行结果
|
||||
*/
|
||||
SysUserVO user(Long id);
|
||||
|
||||
/**
|
||||
* 批量获取用户信息
|
||||
*
|
||||
* @param ids 用户id
|
||||
* @return 执行结果
|
||||
*/
|
||||
List<SysUserVO> users(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 员工分页
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param agencyId 机构ID
|
||||
* @return 员工列表
|
||||
*/
|
||||
PageResponse<SysUserVO> findUserByPage(Integer page,
|
||||
Integer pageSize,
|
||||
Long agencyId,
|
||||
String account,
|
||||
String name,
|
||||
String mobile);
|
||||
|
||||
|
||||
/**
|
||||
* 快递员分页
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param name 名称
|
||||
* @param mobile 手机号
|
||||
* @return 快递员列表
|
||||
*/
|
||||
PageResponse<SysUserVO> findCourierByPage(Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
String mobile,
|
||||
String account,
|
||||
Long orgId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据机构查询快递员
|
||||
*
|
||||
* @param agencyId 机构id
|
||||
* @return 快递员列表
|
||||
*/
|
||||
List<CourierVO> findByAgencyId(Long agencyId);
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param login 用户登录信息
|
||||
* @return 登录结果
|
||||
*/
|
||||
R<LoginDTO> login(LoginParamDTO login);
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.base.domain.base.*;
|
||||
import com.sl.ms.web.manager.enums.TruckTypeAllowableLoadEnum;
|
||||
import com.sl.ms.web.manager.enums.TruckTypeAllowableVolumeEnum;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.*;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckTypeVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 基础服务
|
||||
* 文件上传 排班 工作模式 行政机构
|
||||
*/
|
||||
public interface BaseCommonService {
|
||||
/**
|
||||
* 行政机构
|
||||
* 用于地址选择 省市县三级行政机构
|
||||
* 根据父行政机构节点查询子行政机构节点
|
||||
*
|
||||
* @param parentId 父节点ID
|
||||
* @return 子节点
|
||||
*/
|
||||
List<AreaSimpleVO> findChildrenAreaByParentId(Long parentId);
|
||||
|
||||
|
||||
/**
|
||||
* 工作模式列表查询
|
||||
*
|
||||
* @return 工作模式列表
|
||||
*/
|
||||
Map<Byte, List<WorkPatternDTO>> listWorkPattern();
|
||||
|
||||
/**
|
||||
* 工作模式分页查询
|
||||
*
|
||||
* @param workPatternQueryDTO 查询条件
|
||||
* @return 工作模式列表
|
||||
*/
|
||||
PageResponse<WorkPatternDTO> listWorkPattern(WorkPatternQueryDTO workPatternQueryDTO);
|
||||
|
||||
/**
|
||||
* 获取工作模式详情
|
||||
*
|
||||
* @param id 工作模式ID
|
||||
* @return 工作模式
|
||||
*/
|
||||
WorkPatternDTO getWorkPatternById(Long id);
|
||||
|
||||
/**
|
||||
* 删除工作模式
|
||||
*
|
||||
* @param id 工作模式ID
|
||||
*/
|
||||
void deleteWorkPattern(Long id);
|
||||
|
||||
/**
|
||||
* 添加工作模式
|
||||
*
|
||||
* @param workPatternAddDTO 工作模式
|
||||
*/
|
||||
void addWorkPattern(WorkPatternAddDTO workPatternAddDTO);
|
||||
|
||||
/**
|
||||
* 修改工作模式
|
||||
*
|
||||
* @param workPatternUpdateDTO 工作模式
|
||||
*/
|
||||
void putWorkPattern(WorkPatternUpdateDTO workPatternUpdateDTO);
|
||||
|
||||
/**
|
||||
* 更新排班
|
||||
*
|
||||
* @param workSchedulingVO 排班
|
||||
*/
|
||||
void updateWorkScheduling(WorkSchedulingVO workSchedulingVO);
|
||||
|
||||
/**
|
||||
* 下载排班模板
|
||||
*
|
||||
* @return 排班模板Excel
|
||||
*/
|
||||
ResponseEntity downExcelTemplate();
|
||||
|
||||
/**
|
||||
* 导入排班
|
||||
*
|
||||
* @param list 排班列表
|
||||
*/
|
||||
void batchSaveWorkScheduling(List<WorkSchedulingExportVO> list);
|
||||
|
||||
/**
|
||||
* 删除排班
|
||||
*
|
||||
* @param id 排班ID
|
||||
* @param operator 操作人
|
||||
*/
|
||||
void deleteWorkScheduling(Long id, Long operator);
|
||||
|
||||
/**
|
||||
* 分页查询排班列表
|
||||
*
|
||||
* @param workSchedulingQueryDTO 查询条件
|
||||
* @return 排班列表
|
||||
*/
|
||||
PageResponse<WorkSchedulingDTO> listWorkScheduling(WorkSchedulingQueryDTO workSchedulingQueryDTO);
|
||||
|
||||
/**
|
||||
* 添加货物类型
|
||||
*
|
||||
* @param vo 货物类型信息
|
||||
*/
|
||||
void saveGoodsType(GoodsTypeVO vo);
|
||||
|
||||
/**
|
||||
* 根据id获取货物类型详情
|
||||
*
|
||||
* @param id 货物类型id
|
||||
* @return 货物类型信息
|
||||
*/
|
||||
GoodsTypeVO fineGoodsTypeById(Long id);
|
||||
|
||||
/**
|
||||
* 获取货物类型列表
|
||||
*
|
||||
* @param ids 货物类型ids
|
||||
* @return 货物类型列表
|
||||
*/
|
||||
List<GoodsTypeVO> findGoodsTypeAll(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取分页货物类型数据
|
||||
*
|
||||
* @param page 页码
|
||||
* @param pageSize 页尺寸
|
||||
* @param name 名称
|
||||
* @param truckTypeId 车型id
|
||||
* @return 分页货物类型数据
|
||||
*/
|
||||
PageResponse<GoodsTypeVO> findGoodsTypeByPage(
|
||||
Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
Long truckTypeId);
|
||||
|
||||
/**
|
||||
* 更新货物类型信息
|
||||
*
|
||||
* @param id 货物类型id
|
||||
* @param vo 货物类型信息
|
||||
*/
|
||||
void updateGoodsType(Long id, GoodsTypeVO vo);
|
||||
|
||||
/**
|
||||
* 删除货物类型
|
||||
*
|
||||
* @param id 货物类型id
|
||||
*/
|
||||
void disableGoodsType(Long id);
|
||||
|
||||
/**
|
||||
* 简要行政机构信息转换
|
||||
*
|
||||
* @param area 行政机构DTO
|
||||
* @return 简要行政机构VO
|
||||
*/
|
||||
AreaSimpleVO parseArea2Vo(AreaDto area);
|
||||
|
||||
/**
|
||||
* 车型列表
|
||||
*
|
||||
* @return 车型列表
|
||||
*/
|
||||
List<TruckTypeVO> truckTypeSimple();
|
||||
|
||||
|
||||
/**
|
||||
* 保存车型
|
||||
*
|
||||
* @param vo 车型信息
|
||||
*/
|
||||
void saveTruckType(TruckTypeVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 更新车型
|
||||
*
|
||||
* @param id 车型ID
|
||||
* @param vo 车型信息
|
||||
*/
|
||||
void updateTruckType(Long id, TruckTypeVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 车型分页
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param name 车辆类型名称
|
||||
* @param allowableLoad 车型载重,单位:吨;左闭右开区间
|
||||
* @param allowableVolume 车型体积,单位:立方米;左闭右开区间
|
||||
* @param id 车型ID
|
||||
* @return 车型列表
|
||||
*/
|
||||
PageResponse<TruckTypeVO> findTruckTypeByPage(Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
TruckTypeAllowableLoadEnum allowableLoad,
|
||||
TruckTypeAllowableVolumeEnum allowableVolume,
|
||||
Long id);
|
||||
|
||||
/**
|
||||
* 车型详情
|
||||
*
|
||||
* @param id 车型ID
|
||||
* @return 车型详情
|
||||
*/
|
||||
TruckTypeVO findTruckTypeById(Long id);
|
||||
|
||||
/**
|
||||
* 删除车型
|
||||
*
|
||||
* @param id 车型ID
|
||||
*/
|
||||
void deleteTruckType(Long id);
|
||||
|
||||
/**
|
||||
* 获取map类型车辆类型数据集合
|
||||
*
|
||||
* @param truckTypeSet 车辆类型id列表
|
||||
* @return 执行结果
|
||||
*/
|
||||
Map<Long, TruckTypeVO> truckTypeMap(Set<Long> truckTypeSet);
|
||||
|
||||
/**
|
||||
* 批量关联排班
|
||||
*
|
||||
* @param workSchedulingAddVO 排班
|
||||
*/
|
||||
void batchSaveWorkScheduling(WorkSchedulingAddVO workSchedulingAddVO);
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.web.manager.vo.baseTruck.*;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 基础运输模型管理
|
||||
* 车辆 车次 司机 管理
|
||||
*/
|
||||
public interface BaseTruckService {
|
||||
/**
|
||||
* 获取司机分页数据
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param name 名称
|
||||
* @param account 账号
|
||||
* @param workStatus 工作状态
|
||||
* @param agentId 机构ID
|
||||
* @param phone 手机号
|
||||
* @return 司机列表
|
||||
*/
|
||||
PageResponse<DriverVO> findDriverByPage(Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
String account,
|
||||
String workStatus, Long agentId, String phone);
|
||||
|
||||
/**
|
||||
* 司机详情
|
||||
*
|
||||
* @param id 司机ID
|
||||
* @return 司机
|
||||
*/
|
||||
DriverVO findDriverById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 保存司机
|
||||
*
|
||||
* @param id 司机ID
|
||||
* @param vo 司机信息
|
||||
*/
|
||||
void saveDriver(Long id, DriverUpdateVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 保存驾驶证
|
||||
*
|
||||
* @param vo 驾驶证信息
|
||||
*/
|
||||
void saveDriverLicense(DriverLicenseVO vo);
|
||||
|
||||
/**
|
||||
* 驾驶证详情
|
||||
*
|
||||
* @param id 司机id
|
||||
* @return 驾驶证信息
|
||||
*/
|
||||
DriverLicenseVO findDriverLicenseById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增司机安排车辆 【司机:车辆 = n:1】
|
||||
* 调整司机安排车辆
|
||||
* 删除司机安排车辆
|
||||
* base服务会统一判断原有绑定关系是否能够删除
|
||||
*
|
||||
* @param bindingDriversVO 绑定关系
|
||||
*/
|
||||
void bindingTrucks(BindingDriversVO bindingDriversVO);
|
||||
|
||||
/**
|
||||
* 保存车辆
|
||||
*
|
||||
* @param vo 车辆
|
||||
*/
|
||||
void saveTruck(TruckVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 更新车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @param vo 车辆
|
||||
*/
|
||||
void updateTruck(Long id, TruckVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 车辆列表
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param truckTypeId 车型ID
|
||||
* @param status 状态
|
||||
* @param licensePlate 车牌号
|
||||
* @return 车辆列表
|
||||
*/
|
||||
PageResponse<TruckVO> findTruckByPage(Integer page,
|
||||
Integer pageSize,
|
||||
Long truckTypeId,
|
||||
Integer status,
|
||||
String licensePlate);
|
||||
|
||||
|
||||
/**
|
||||
* 车辆简要信息
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 车辆简要信息
|
||||
*/
|
||||
TruckVO findTruckSimple(Long id);
|
||||
|
||||
/**
|
||||
* 车辆详情
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 车辆信息
|
||||
*/
|
||||
TruckVO findTruckDetail(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 统计车辆
|
||||
*
|
||||
* @return 各状态个数
|
||||
*/
|
||||
Map<Integer, Long> countTruck();
|
||||
|
||||
|
||||
/**
|
||||
* 禁用车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
*/
|
||||
void disableTruck(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 启用车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
*/
|
||||
void enableTruck(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 删除车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
*/
|
||||
void delTruck(Long id);
|
||||
|
||||
/**
|
||||
* 保存行驶证
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @param vo 行驶证信息
|
||||
*/
|
||||
void saveTruckLicense(Long id, TruckLicenseVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 获取行驶证
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 行驶证
|
||||
*/
|
||||
TruckLicenseVO findTruckLicenseById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 获取车辆车次信息
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 车次信息
|
||||
*/
|
||||
List<TruckDriverTripsVO> findTruckTrips(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 获取map类型车辆数据集合
|
||||
*
|
||||
* @param truckSet 车辆id列表
|
||||
* @return 执行结果
|
||||
*/
|
||||
Map<Long, TruckVO> truckMap(Set<Long> truckSet);
|
||||
|
||||
/**
|
||||
* 绑定司机列表
|
||||
*
|
||||
* @param truckId 车辆ID
|
||||
* @return 司机列表
|
||||
*/
|
||||
List<DriverVO> bindingTrucks(Long truckId);
|
||||
|
||||
/**
|
||||
* 未绑定车辆的司机列表
|
||||
*
|
||||
* @return 司机列表
|
||||
*/
|
||||
List<DriverVO> unBindingDrivers();
|
||||
|
||||
/**
|
||||
* 新增车次
|
||||
*
|
||||
* @param vo 车次信息
|
||||
*/
|
||||
void saveTrips(TransportTripsUpdateVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 更新车次
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @param vo 车次信息
|
||||
*/
|
||||
void updateTrips(Long id, TransportTripsUpdateVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 根据线路ID获取车次
|
||||
*
|
||||
* @param transportLineId 线路ID
|
||||
* @return 车次列表
|
||||
*/
|
||||
List<TransportTripsVO> findAllTrips(Long transportLineId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据车次ID获取车次简要信息
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @return 车次信息
|
||||
*/
|
||||
TransportTripsVO findTripsSimple(Long id);
|
||||
|
||||
/**
|
||||
* 根据车次ID获取车次
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @return 车次信息
|
||||
*/
|
||||
TransportTripsVO findTripsDetail(Long id);
|
||||
|
||||
/**
|
||||
* 删除车次
|
||||
*
|
||||
* @param id 车次ID
|
||||
*/
|
||||
void deleteTransportLineTrips(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增车次-安排车辆 不涉及司机的安排 司机会根据【司机车辆绑定关系】和排班情况调度决定
|
||||
* 修改车次-安排车辆
|
||||
* 解除车次安排 车辆ID列表为空 标识解除所有车次绑定关系
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @param bindingTrucksVO 车次车辆绑定关系
|
||||
*/
|
||||
void bindingTrucks(Long id, BindingTrucksVO bindingTrucksVO);
|
||||
|
||||
/**
|
||||
* 获取车次-车辆绑定关系
|
||||
*
|
||||
* @param transportTripsId 查询条件
|
||||
* @return 车次-车辆绑定关系
|
||||
*/
|
||||
List<TruckVO> getTransportTripsTruck(Long transportTripsId);
|
||||
|
||||
/**
|
||||
* 获取已经启用的车辆
|
||||
*
|
||||
* @return 车辆
|
||||
*/
|
||||
List<TruckVO> workingTrucks(Long startAgentId, Long endAgentId);
|
||||
|
||||
/**
|
||||
* 新增车辆绑定司机 【司机:车辆 = n:1】
|
||||
* 调整车辆绑定司机
|
||||
* 解除车辆绑定司机
|
||||
* 保证事务性
|
||||
* base服务会统一判断原有绑定关系是否能够删除
|
||||
*
|
||||
* @param bindingDriversVO 绑定关系
|
||||
*/
|
||||
void bindingDrivers(BindingDriversVO bindingDriversVO);
|
||||
|
||||
/**
|
||||
* 获取已经停用的车辆
|
||||
* 没有绑定2个司机的车辆
|
||||
*
|
||||
* @return 车辆
|
||||
*/
|
||||
List<TruckVO> unWorkingTrucks();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.carriage.domain.dto.CarriageDTO;
|
||||
import com.sl.ms.web.manager.vo.carriage.CarriageVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运费服务相关
|
||||
*/
|
||||
public interface CarriageService {
|
||||
/**
|
||||
* 查询所有运费模板
|
||||
*
|
||||
* @return 运费模板列表
|
||||
*/
|
||||
List<CarriageVO> findAll();
|
||||
|
||||
/**
|
||||
* 新增/修改运费模板
|
||||
*
|
||||
* @param carriageDto 源运费模板对象
|
||||
* @return 新增或修改后的运费模板对象
|
||||
*/
|
||||
CarriageVO saveOrUpdate(CarriageDTO carriageDto);
|
||||
|
||||
/**
|
||||
* 删除运费模板
|
||||
*
|
||||
* @param id 运费模板id
|
||||
*/
|
||||
void delete(Long id);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.oms.dto.OrderDTO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderCargoUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderCargoVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderQueryVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单服务
|
||||
*/
|
||||
public interface OmsService {
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @return 订单VO
|
||||
*/
|
||||
OrderVO findOrderSimple(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询详情
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @return 订单VO
|
||||
*/
|
||||
OrderVO findOrderDetail(Long id);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @param vo 订单VO
|
||||
*/
|
||||
void updateOrder(Long id, OrderVO vo);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param vo 订单查询VO
|
||||
* @return 订单VO
|
||||
*/
|
||||
PageResponse<OrderVO> findByPage(OrderQueryVO vo);
|
||||
|
||||
/**
|
||||
* 获取货物列表
|
||||
*
|
||||
* @param tranOrderId 运单id
|
||||
* @param orderId 订单id
|
||||
* @return 货物列表
|
||||
*/
|
||||
List<OrderCargoVO> findAll(Long tranOrderId,
|
||||
Long orderId);
|
||||
|
||||
/**
|
||||
* 添加货物
|
||||
*
|
||||
* @param vo 货物信息
|
||||
*/
|
||||
void save(OrderCargoUpdateVO vo);
|
||||
|
||||
/**
|
||||
* 更新货物信息
|
||||
*
|
||||
* @param id 货物id
|
||||
* @param vo 货物信息
|
||||
*/
|
||||
void update(Long id, OrderCargoUpdateVO vo);
|
||||
|
||||
/**
|
||||
* 删除货物信息
|
||||
*
|
||||
* @param id 货物id
|
||||
*/
|
||||
void del(Long id);
|
||||
|
||||
/**
|
||||
* 批量转换
|
||||
*
|
||||
* @param orderDTOList 订单列表
|
||||
* @return 订单列表
|
||||
*/
|
||||
List<OrderVO> batchParseOrderDTO2Vo(List<OrderDTO> orderDTOList);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineQueryVO;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import com.sl.ms.web.manager.vo.work.CostConfigurationVO;
|
||||
import com.sl.ms.web.manager.vo.work.DispatchConfigurationVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TransportService {
|
||||
/**
|
||||
* 新增线路
|
||||
*
|
||||
* @param vo 线路信息
|
||||
*/
|
||||
void saveTransportLine(TransportLineVO vo);
|
||||
|
||||
/**
|
||||
* 更新线路
|
||||
*
|
||||
* @param id 线路ID
|
||||
* @param vo 线路信息
|
||||
*/
|
||||
void updateTransportLine(Long id, TransportLineVO vo);
|
||||
|
||||
/**
|
||||
* 线路分页
|
||||
*
|
||||
* @param transportLineQueryVO 查询条件
|
||||
* @return 线路列表
|
||||
*/
|
||||
PageResponse<TransportLineVO> findTransportLineByPage(TransportLineQueryVO transportLineQueryVO);
|
||||
|
||||
/**
|
||||
* 线路详情
|
||||
*
|
||||
* @param id 线路ID
|
||||
* @return 线路信息
|
||||
*/
|
||||
TransportLineVO findTransportLineById(Long id);
|
||||
|
||||
/**
|
||||
* 线路详情
|
||||
*
|
||||
* @param ids 线路IDs
|
||||
* @return 线路信息列表
|
||||
*/
|
||||
List<TransportLineVO> findTransportLineByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 删除线路
|
||||
*
|
||||
* @param id 线路ID
|
||||
*/
|
||||
void deleteTransportLine(Long id);
|
||||
|
||||
/**
|
||||
* 保存调度配置
|
||||
*
|
||||
* @param vo 调度配置
|
||||
*/
|
||||
void saveConfiguration(DispatchConfigurationVO vo);
|
||||
|
||||
/**
|
||||
* 查询调度配置
|
||||
*
|
||||
* @return 调度配置
|
||||
*/
|
||||
DispatchConfigurationVO findConfiguration();
|
||||
|
||||
/**
|
||||
* 保存成本配置
|
||||
* @param vo 配置信息
|
||||
*/
|
||||
void saveCostConfiguration(List<CostConfigurationVO> vo);
|
||||
|
||||
/**
|
||||
* 查询成本配置
|
||||
* @return 配置信息
|
||||
*/
|
||||
List<CostConfigurationVO> findCostConfiguration();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterListVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterPageQueryVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterVO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
|
||||
public interface TruckReturnRegisterService {
|
||||
|
||||
/**
|
||||
* 分页查询回车登记列表
|
||||
*
|
||||
* @param vo 回车登记分页查询条件
|
||||
* @return 回车登记分页结果
|
||||
*/
|
||||
PageResponse<TruckReturnRegisterListVO> pageQuery(TruckReturnRegisterPageQueryVO vo);
|
||||
|
||||
/**
|
||||
* 回车登记详情
|
||||
*
|
||||
* @param id 回车登记id
|
||||
* @return 回车登记详情
|
||||
*/
|
||||
TruckReturnRegisterVO detail(Long id);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.web.manager.vo.work.*;
|
||||
import com.sl.ms.work.domain.dto.PickupDispatchTaskDTO;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 任务管理
|
||||
* 取派件任务、运输任务、运单
|
||||
*/
|
||||
public interface WorkService {
|
||||
|
||||
/**
|
||||
* 运单分页
|
||||
*
|
||||
* @param vo 运单查询条件
|
||||
* @return 运单分页
|
||||
*/
|
||||
PageResponse<TransportOrderVO> findTransportOrderByPage(TransportOrderQueryVO vo);
|
||||
|
||||
/**
|
||||
* 运单简要信息
|
||||
*
|
||||
* @param id 运单ID
|
||||
* @return 运单详情
|
||||
*/
|
||||
TransportOrderVO findTransportOrderSimple(String id);
|
||||
|
||||
/**
|
||||
* 运单详情页面
|
||||
*
|
||||
* @param id 运单ID
|
||||
* @return 运单详情
|
||||
*/
|
||||
TransportOrderVO findTransportOrderDetail(String id);
|
||||
|
||||
/**
|
||||
* 统计运单
|
||||
*
|
||||
* @return 按状态统计运单
|
||||
*/
|
||||
Map<Integer, Long> countTransportOrder();
|
||||
|
||||
/**
|
||||
* 运输任务分页
|
||||
*
|
||||
* @param vo 查询条件
|
||||
* @return 运输任务分页
|
||||
*/
|
||||
PageResponse<TaskTransportVO> findTaskByPage(TaskTransportQueryVO vo);
|
||||
|
||||
|
||||
/**
|
||||
* 运输任务详情
|
||||
*
|
||||
* @param id 运输任务ID
|
||||
* @return 运输任务详情
|
||||
*/
|
||||
TaskTransportVO findTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 手动调整运输任务
|
||||
*
|
||||
* @param id 运输任务ID
|
||||
* @param vo 司机 车辆 车次等信息
|
||||
*/
|
||||
void adjustTask(Long id, TaskTransportUpdateVO vo);
|
||||
|
||||
/**
|
||||
* 运输任务统计
|
||||
*
|
||||
* @return 按状态统计
|
||||
*/
|
||||
Map<Integer, Long> countTask();
|
||||
|
||||
/**
|
||||
* 获取运输任务坐标
|
||||
*
|
||||
* @param id 运输任务ID
|
||||
* @return 运输任务坐标
|
||||
*/
|
||||
LinkedHashSet<PointVO> findTaskPointById(Long id);
|
||||
|
||||
/**
|
||||
* 获取取派件任务分页数据
|
||||
*
|
||||
* @param vo 查询条件
|
||||
* @return 取派件分页数据
|
||||
*/
|
||||
PageResponse<PickupDispatchTaskListVO> findTaskPickupDispatchByPage(TaskPickupDispatchQueryVO vo);
|
||||
|
||||
/**
|
||||
* 转换取派件任务
|
||||
*
|
||||
* @param dto 任务DTO
|
||||
* @return 任务VO
|
||||
*/
|
||||
TaskPickupDispatchVO parsePickupDispatchTaskDTO2Vo(PickupDispatchTaskDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 分配快递员
|
||||
*
|
||||
* @param ids 取派件任务id
|
||||
* @param courierId 快递员ID
|
||||
*/
|
||||
void updateTaskPickupDispatchById(List<String> ids, Long courierId);
|
||||
|
||||
/**
|
||||
* 空车取消运输任务
|
||||
*
|
||||
* @param id 运输任务id
|
||||
*/
|
||||
void cancel(Long id);
|
||||
/**
|
||||
* 运单轨迹
|
||||
*
|
||||
* @param id 运单ID
|
||||
* @return 轨迹
|
||||
*/
|
||||
TrackVO findTrackById(String id);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.sl.ms.web.manager.service;
|
||||
|
||||
import com.sl.ms.web.manager.vo.workspace.MonthlyOrderAddVO;
|
||||
import com.sl.ms.web.manager.vo.workspace.WorkbenchAddVO;
|
||||
import com.sl.ms.web.manager.vo.workspace.WorkbenchVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作台服务
|
||||
*/
|
||||
public interface WorkspaceService {
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param workbenchVO 工作台
|
||||
*/
|
||||
void saveWorkbench(WorkbenchAddVO workbenchVO);
|
||||
|
||||
/**
|
||||
* 新增订单总量数据
|
||||
*
|
||||
* @param monthlyOrderList 月度订单数据
|
||||
*/
|
||||
void saveOrderNumber(List<MonthlyOrderAddVO> monthlyOrderList);
|
||||
|
||||
/**
|
||||
* 查询一条数据
|
||||
*
|
||||
* @return 工作台数据
|
||||
*/
|
||||
WorkbenchVO findOne();
|
||||
|
||||
/**
|
||||
* 删除所有
|
||||
*/
|
||||
void deleteAll();
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.itheima.auth.sdk.common.Result;
|
||||
import com.itheima.auth.sdk.dto.OrgDTO;
|
||||
import com.itheima.auth.sdk.dto.UserDTO;
|
||||
import com.itheima.em.sdk.EagleMapTemplate;
|
||||
import com.itheima.em.sdk.enums.ProviderEnum;
|
||||
import com.itheima.em.sdk.vo.Coordinate;
|
||||
import com.itheima.em.sdk.vo.GeoResult;
|
||||
import com.sl.ms.base.api.common.AreaFeign;
|
||||
import com.sl.ms.base.domain.base.AreaDto;
|
||||
import com.sl.ms.scope.api.ServiceScopeFeign;
|
||||
import com.sl.ms.scope.dto.ServiceScopeDTO;
|
||||
import com.sl.ms.transport.api.OrganFeign;
|
||||
import com.sl.ms.web.manager.service.AgencyService;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyVO;
|
||||
import com.sl.ms.web.manager.vo.agency.ServiceScopeVO;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.AreaVO;
|
||||
import com.sl.transport.common.exception.SLException;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import com.sl.transport.common.util.AuthTemplateThreadLocal;
|
||||
import com.sl.transport.domain.OrganDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 营业部管理
|
||||
* 机构管理 服务范围 快递员任务管理
|
||||
*
|
||||
* @author itcast
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AgencyServiceImpl implements AgencyService {
|
||||
|
||||
@Resource
|
||||
ServiceScopeFeign serviceScopeFeign;
|
||||
|
||||
@Resource
|
||||
AreaFeign areaFeign;
|
||||
|
||||
@Resource
|
||||
private OrganFeign organFeign;
|
||||
|
||||
@Resource
|
||||
private EagleMapTemplate eagleMapTemplate;
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
/**
|
||||
* 机构编辑VO转换DTO
|
||||
*
|
||||
* @param agencyVO 机构VO
|
||||
* @return 机构DTO
|
||||
*/
|
||||
public OrganDTO parseAgencyVOToDTO(AgencyUpdateVO agencyVO) {
|
||||
OrganDTO organDTO = BeanUtil.toBean(agencyVO, OrganDTO.class);
|
||||
// 设置详细地址 json
|
||||
AreaVO areaVO = new AreaVO();
|
||||
Set<Long> areaIds = new HashSet<>();
|
||||
boolean provinceOk = ObjectUtil.isNotEmpty(agencyVO.getProvinceId()) && agencyVO.getProvinceId() != 0;
|
||||
boolean cityOk = ObjectUtil.isNotEmpty(agencyVO.getCityId()) && agencyVO.getCityId() != 0;
|
||||
boolean countyOk = ObjectUtil.isNotEmpty(agencyVO.getCountyId()) && agencyVO.getCountyId() != 0;
|
||||
if (provinceOk) {
|
||||
areaIds.add(agencyVO.getProvinceId());
|
||||
}
|
||||
if (cityOk) {
|
||||
areaIds.add(agencyVO.getCityId());
|
||||
}
|
||||
if (countyOk) {
|
||||
areaIds.add(agencyVO.getCountyId());
|
||||
}
|
||||
if (!areaIds.isEmpty()) {
|
||||
List<AreaDto> result = areaFeign.findBatch(new ArrayList<>(areaIds));
|
||||
Map<Long, AreaDto> areaMap = result.stream().collect(Collectors.toMap(AreaDto::getId, area -> area));
|
||||
if (provinceOk) {
|
||||
areaVO.setProvince(baseCommonService.parseArea2Vo(areaMap.get(agencyVO.getProvinceId())));
|
||||
}
|
||||
if (cityOk) {
|
||||
areaVO.setCity(baseCommonService.parseArea2Vo(areaMap.get(agencyVO.getCityId())));
|
||||
}
|
||||
if (countyOk) {
|
||||
areaVO.setCounty(baseCommonService.parseArea2Vo(areaMap.get(agencyVO.getCountyId())));
|
||||
}
|
||||
areaVO.setAddress(agencyVO.getAddress());
|
||||
organDTO.setAddress(JSONUtil.toJsonStr(areaVO));
|
||||
|
||||
if (ObjectUtil.isEmpty(agencyVO.getLatitude()) && ObjectUtil.isEmpty(agencyVO.getLongitude())) {
|
||||
// 补充经纬度
|
||||
StringBuilder address = new StringBuilder();
|
||||
address.append(areaMap.get(agencyVO.getProvinceId()).getName());
|
||||
address.append(areaMap.get(agencyVO.getProvinceId()).getName());
|
||||
address.append(areaMap.get(agencyVO.getCountyId()).getName());
|
||||
address.append(agencyVO.getAddress());
|
||||
GeoResult geoResult = eagleMapTemplate.opsForBase().geoCode(ProviderEnum.AMAP, address.toString(), null);
|
||||
Coordinate coordinate = geoResult.getLocation();
|
||||
|
||||
log.info("地址和坐标-->" + address + "--" + coordinate);
|
||||
if (ObjectUtil.isEmpty(coordinate)) {
|
||||
log.error("地址无法定位");
|
||||
throw new SLException("地址无法定位");
|
||||
}
|
||||
// 经度
|
||||
double lng = coordinate.getLongitude();
|
||||
// 纬度
|
||||
double lat = coordinate.getLatitude();
|
||||
organDTO.setLatitude(lat);
|
||||
organDTO.setLongitude(lng);
|
||||
}
|
||||
}
|
||||
return organDTO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 机构数据模型转换
|
||||
*
|
||||
* @param organDTO 机构DTO
|
||||
* @return 机构VO
|
||||
*/
|
||||
public AgencyVO parseOrg2Vo(OrganDTO organDTO) {
|
||||
AgencyVO agencyVO = BeanUtil.toBean(organDTO, AgencyVO.class);
|
||||
//处理父级信息
|
||||
if (ObjectUtil.isNotEmpty(organDTO.getParentId()) && organDTO.getParentId() != 0) {
|
||||
OrganDTO result = organFeign.queryById(organDTO.getParentId());
|
||||
AgencySimpleVO simpleVo = BeanUtil.toBean(result, AgencySimpleVO.class);
|
||||
simpleVo.setId(result.getId());
|
||||
agencyVO.setParent(simpleVo);
|
||||
}
|
||||
//处理省市区信息
|
||||
if (ObjectUtil.isNotEmpty(organDTO.getAddress())) {
|
||||
AreaVO areaVO = JSONUtil.toBean(organDTO.getAddress(), AreaVO.class);
|
||||
BeanUtil.copyProperties(areaVO, agencyVO);
|
||||
}
|
||||
return agencyVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构树
|
||||
*
|
||||
* @return 机构树
|
||||
*/
|
||||
@Override
|
||||
public String treeAgency() {
|
||||
return organFeign.findAllTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构详情
|
||||
*
|
||||
* @param id 机构id
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public AgencyVO agencyDetail(Long id) {
|
||||
OrganDTO organDTO = organFeign.queryById(id);
|
||||
if (ObjectUtil.isNotEmpty(organDTO)) {
|
||||
return parseOrg2Vo(organDTO);
|
||||
}
|
||||
return new AgencyVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取简要机构
|
||||
*
|
||||
* @param id 机构id
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public AgencySimpleVO agencySimple(Long id) {
|
||||
OrgDTO organDTO = AuthTemplateThreadLocal.get().opsForOrg().getOrgById(id).getData();
|
||||
if (ObjectUtil.isNotEmpty(organDTO)) {
|
||||
return parseOrg2SimpleVo(organDTO);
|
||||
}
|
||||
return new AgencySimpleVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取简要机构
|
||||
*
|
||||
* @param ids 机构ids
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public List<AgencySimpleVO> batchAgencySimple(List<Long> ids) {
|
||||
List<OrgDTO> data = AuthTemplateThreadLocal.get().opsForOrg().getOrgByIds(ids).getData();
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
return data.parallelStream().map(this::parseOrg2SimpleVo).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 简要机构信息转换
|
||||
*
|
||||
* @param organDTO 机构DTO
|
||||
* @return 简要机构VO
|
||||
*/
|
||||
public AgencySimpleVO parseOrg2SimpleVo(OrgDTO organDTO) {
|
||||
return BeanUtil.toBean(organDTO, AgencySimpleVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑机构
|
||||
*
|
||||
* @param agencyVO 机构信息
|
||||
*/
|
||||
@Override
|
||||
public void saveAgency(AgencyUpdateVO agencyVO) {
|
||||
OrganDTO organDTO = parseAgencyVOToDTO(agencyVO);
|
||||
organFeign.update(organDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除范围
|
||||
*
|
||||
* @param id 范围ID
|
||||
* @param type 范围类型
|
||||
*/
|
||||
@Override
|
||||
public void deleteScopeById(Long id, Integer type) {
|
||||
try {
|
||||
serviceScopeFeign.delete(id, type);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("删除失败,不存在的围栏");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存范围
|
||||
*
|
||||
* @param vo 范围信息
|
||||
*/
|
||||
@Override
|
||||
public void saveScope(ServiceScopeVO vo) {
|
||||
log.info("保存快递员业务范围:{}", vo);
|
||||
ServiceScopeDTO serviceScopeDTO = BeanUtil.toBean(vo, ServiceScopeDTO.class);
|
||||
try {
|
||||
serviceScopeFeign.saveScope(serviceScopeDTO);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("保存失败, 请正确绘制没有交叉点的规则多边形");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询范围
|
||||
*
|
||||
* @param id 范围ID
|
||||
* @param type 范围类型
|
||||
* @return 范围VO
|
||||
*/
|
||||
@Override
|
||||
public ServiceScopeVO findScope(Long id, Integer type) {
|
||||
//查询服务范围信息
|
||||
ServiceScopeDTO serviceScopeDTO = serviceScopeFeign.queryServiceScope(id, type);
|
||||
ServiceScopeVO serviceScopeVO = new ServiceScopeVO();
|
||||
if (ObjectUtil.isNotEmpty(serviceScopeDTO)) {
|
||||
BeanUtil.copyProperties(serviceScopeDTO, serviceScopeVO);
|
||||
}
|
||||
|
||||
//获取机构id
|
||||
Long organId = id;
|
||||
if (type == 2) {
|
||||
//type为2是快递员,查询快递员所在机构的id
|
||||
Result<UserDTO> result = AuthTemplateThreadLocal.get().opsForUser().getUserById(id);
|
||||
if (ObjectUtil.isEmpty(result.getData())) {
|
||||
throw new SLWebException("id为" + id + "的快递员不存在!");
|
||||
}
|
||||
organId = result.getData().getOrgId();
|
||||
}
|
||||
|
||||
//查询机构的经纬度坐标
|
||||
OrganDTO organDTO = organFeign.queryById(organId);
|
||||
serviceScopeVO.setLatitude(organDTO.getLatitude());
|
||||
serviceScopeVO.setLongitude(organDTO.getLongitude());
|
||||
return serviceScopeVO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.itheima.auth.sdk.AuthTemplate;
|
||||
import com.itheima.auth.sdk.common.Result;
|
||||
import com.itheima.auth.sdk.dto.*;
|
||||
import com.sl.ms.base.api.common.WorkSchedulingFeign;
|
||||
import com.sl.ms.base.domain.base.WorkSchedulingDTO;
|
||||
import com.sl.ms.base.domain.enums.StatusEnum;
|
||||
import com.sl.ms.base.domain.enums.WorkUserTypeEnum;
|
||||
import com.sl.ms.web.manager.service.AuthService;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import com.sl.ms.web.manager.vo.auth.CourierVO;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.transport.common.exception.SLException;
|
||||
import com.sl.transport.common.util.AuthTemplateThreadLocal;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.vo.R;
|
||||
import com.wf.captcha.ArithmeticCaptcha;
|
||||
import com.wf.captcha.ChineseCaptcha;
|
||||
import com.wf.captcha.GifCaptcha;
|
||||
import com.wf.captcha.SpecCaptcha;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 鉴权服务
|
||||
* 登录 验证码 员工列表 快递员列表 角色
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AuthServiceImpl implements AuthService {
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Resource
|
||||
private AuthTemplate authTemplate;
|
||||
|
||||
@Value("${role.courier}")
|
||||
private String roleId;
|
||||
|
||||
@Resource
|
||||
private WorkSchedulingFeign workSchedulingFeign;
|
||||
|
||||
/**
|
||||
* 登录获取token
|
||||
*
|
||||
* @param account 账号
|
||||
* @param password 密码
|
||||
* @return 登录信息
|
||||
*/
|
||||
@Override
|
||||
public R<LoginDTO> login(String account, String password) {
|
||||
//账号密码登录
|
||||
Result<LoginDTO> loginResult = authTemplate.opsForLogin().token(account, password);
|
||||
|
||||
//校验登录是否成功
|
||||
if (loginResult.getCode() != Result.success().getCode()) {
|
||||
return R.error(loginResult.getMsg());
|
||||
}
|
||||
return R.success(loginResult.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(String key, HttpServletResponse response) throws IOException {
|
||||
if (StringUtils.isBlank(key)) {
|
||||
throw new SLException("验证码key不能为空");
|
||||
}
|
||||
setHeader(response, "arithmetic");
|
||||
|
||||
Captcha captcha = createCaptcha("arithmetic");
|
||||
redisTemplate.opsForValue().set(key, StringUtils.lowerCase(captcha.text()), 1, TimeUnit.MINUTES);
|
||||
captcha.out(response.getOutputStream());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check(String key, String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
throw new SLException("请输入验证码");
|
||||
}
|
||||
String code = redisTemplate.opsForValue().get(key);
|
||||
if (code == null) {
|
||||
throw new SLException("验证码已过期");
|
||||
}
|
||||
if (!StringUtils.equalsIgnoreCase(value, code)) {
|
||||
throw new SLException("验证码不正确");
|
||||
}
|
||||
redisTemplate.expire(key, 1, TimeUnit.SECONDS);
|
||||
return true;
|
||||
}
|
||||
|
||||
private Captcha createCaptcha(String type) {
|
||||
Captcha captcha = null;
|
||||
if (StringUtils.equalsIgnoreCase(type, "gif")) {
|
||||
captcha = new GifCaptcha(115, 42, 4);
|
||||
} else if (StringUtils.equalsIgnoreCase(type, "png")) {
|
||||
captcha = new SpecCaptcha(115, 42, 4);
|
||||
} else if (StringUtils.equalsIgnoreCase(type, "arithmetic")) {
|
||||
captcha = new ArithmeticCaptcha(115, 42);
|
||||
} else if (StringUtils.equalsIgnoreCase(type, "chinese")) {
|
||||
captcha = new ChineseCaptcha(115, 42);
|
||||
}
|
||||
captcha.setCharType(2);
|
||||
return captcha;
|
||||
}
|
||||
|
||||
private void setHeader(HttpServletResponse response, String type) {
|
||||
if (StringUtils.equalsIgnoreCase(type, "gif")) {
|
||||
response.setContentType(MediaType.IMAGE_GIF_VALUE);
|
||||
} else {
|
||||
response.setContentType(MediaType.IMAGE_PNG_VALUE);
|
||||
}
|
||||
response.setHeader(HttpHeaders.PRAGMA, "No-cache");
|
||||
response.setHeader(HttpHeaders.CACHE_CONTROL, "No-cache");
|
||||
response.setDateHeader(HttpHeaders.EXPIRES, 0L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换用户
|
||||
*
|
||||
* @param userDTO 用户DTO
|
||||
* @return 用户VO
|
||||
*/
|
||||
@Override
|
||||
public SysUserVO parseUser2Vo(UserDTO userDTO) {
|
||||
SysUserVO vo = new SysUserVO();
|
||||
//填充基本信息
|
||||
vo.setUserId(userDTO.getId());
|
||||
vo.setAvatar(userDTO.getAvatar());
|
||||
vo.setEmail(userDTO.getEmail());
|
||||
vo.setMobile(userDTO.getMobile());
|
||||
vo.setAccount(userDTO.getAccount());
|
||||
vo.setName(userDTO.getName());
|
||||
vo.setStatus(userDTO.isStatus() ? StatusEnum.NORMAL.getCode() : StatusEnum.DISABLED.getCode());
|
||||
|
||||
//处理所属机构信息
|
||||
AgencySimpleVO agency = new AgencySimpleVO();
|
||||
agency.setName(userDTO.getOrgName());
|
||||
vo.setAgency(agency);
|
||||
|
||||
//处理岗位信息
|
||||
vo.setStationName(userDTO.getStationName());
|
||||
// 角色
|
||||
vo.setRoleNames(userDTO.getRoleNames());
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public SysUserVO user(Long id) {
|
||||
Result<UserDTO> result = AuthTemplateThreadLocal.get().opsForUser().getUserById(id);
|
||||
if (result.getCode() != 0) {
|
||||
return new SysUserVO();
|
||||
}
|
||||
return parseUser2Vo(result.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取用户信息
|
||||
*
|
||||
* @param ids 用户id
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserVO> users(List<Long> ids) {
|
||||
List<Long> longList = ids.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
Result<List<UserDTO>> result = AuthTemplateThreadLocal.get().opsForUser().list(longList);
|
||||
if (result.getCode() != 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return result.getData().parallelStream().map(this::parseUser2Vo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工分页
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param agencyId 机构ID
|
||||
* @return 员工列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<SysUserVO> findUserByPage(Integer page,
|
||||
Integer pageSize,
|
||||
Long agencyId,
|
||||
String account,
|
||||
String name,
|
||||
String mobile) {
|
||||
Result<PageDTO<UserDTO>> result = AuthTemplateThreadLocal.get().opsForUser()
|
||||
.getUserByPage(new UserPageDTO(page, pageSize, account, name, ObjectUtil.isNotEmpty(agencyId) ? agencyId : null, mobile));
|
||||
return getPageResponseR(page, pageSize, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递员分页
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param name 名称
|
||||
* @param mobile 手机号
|
||||
* @return 快递员列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<SysUserVO> findCourierByPage(Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
String mobile,
|
||||
String account,
|
||||
Long orgId) {
|
||||
UserPageDTO userPageDTO = new UserPageDTO(page, pageSize, account, name, orgId, mobile);
|
||||
userPageDTO.setRoleId(roleId);
|
||||
Result<PageDTO<UserDTO>> result = AuthTemplateThreadLocal.get().opsForUser().getUserByPage(userPageDTO);
|
||||
|
||||
// 转换vo
|
||||
PageResponse<SysUserVO> pageResponseR = getPageResponseR(page, pageSize, result);
|
||||
if (CollUtil.isEmpty(pageResponseR.getItems())) {
|
||||
return pageResponseR;
|
||||
}
|
||||
|
||||
List<Long> userIds = pageResponseR.getItems().parallelStream().map(SysUserVO::getUserId).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return pageResponseR;
|
||||
}
|
||||
|
||||
// 补充数据
|
||||
String bidStr = CollUtil.isEmpty(userIds) ? "" : CharSequenceUtil.join(",", userIds);
|
||||
List<WorkSchedulingDTO> workSchedulingDTOS = workSchedulingFeign.monthSchedule(bidStr, null, WorkUserTypeEnum.COURIER.getCode(), LocalDateTimeUtil.toEpochMilli(LocalDateTimeUtil.now()));
|
||||
if (CollUtil.isEmpty(workSchedulingDTOS)) {
|
||||
return pageResponseR;
|
||||
}
|
||||
Map<Long, Boolean> workMap = workSchedulingDTOS.parallelStream()
|
||||
.filter(workSchedulingDTO -> ObjectUtil.isNotEmpty(workSchedulingDTO.getWorkSchedules()))
|
||||
.collect(Collectors.toMap(WorkSchedulingDTO::getUserId, workSchedulingDTO -> workSchedulingDTO.getWorkSchedules().get(0)));
|
||||
|
||||
pageResponseR.getItems().parallelStream().forEach(userDTO -> {
|
||||
// 上班状态
|
||||
try {
|
||||
Boolean aBoolean = workMap.get(userDTO.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(aBoolean)) {
|
||||
userDTO.setWorkStatus(aBoolean ? 1 : 0);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.info("Exception:{}", ignored.getMessage());
|
||||
}
|
||||
});
|
||||
return pageResponseR;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换用户返回结果
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param result 用户信息
|
||||
* @return 用户信息
|
||||
*/
|
||||
private PageResponse<SysUserVO> getPageResponseR(@RequestParam(name = "page") Integer page, @RequestParam(name = "pageSize") Integer pageSize, Result<PageDTO<UserDTO>> result) {
|
||||
if (result.getCode() == 0 && ObjectUtil.isNotEmpty(result.getData())) {
|
||||
PageDTO<UserDTO> userPage = result.getData();
|
||||
//处理对象转换
|
||||
List<SysUserVO> voList = userPage.getRecords().parallelStream().map(this::parseUser2Vo).collect(Collectors.toList());
|
||||
return PageResponse.of(voList, page, pageSize, userPage.getTotal() % userPage.getSize(), userPage.getTotal());
|
||||
}
|
||||
return PageResponse.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构查询快递员
|
||||
*
|
||||
* @param agencyId 机构id
|
||||
* @return 快递员列表
|
||||
*/
|
||||
@Override
|
||||
public List<CourierVO> findByAgencyId(Long agencyId) {
|
||||
//构件查询条件
|
||||
UserPageDTO userPageDTO = new UserPageDTO(1, 999, null, null, agencyId, null);
|
||||
userPageDTO.setRoleId(roleId);
|
||||
|
||||
//分页查询
|
||||
Result<PageDTO<UserDTO>> result = AuthTemplateThreadLocal.get().opsForUser().getUserByPage(userPageDTO);
|
||||
if (ObjectUtil.isEmpty(result.getData().getRecords())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
//组装响应结果
|
||||
return result.getData().getRecords().stream().map(userDTO -> BeanUtil.toBean(userDTO, CourierVO.class)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param login 用户登录信息
|
||||
* @return 登录结果
|
||||
*/
|
||||
@Override
|
||||
public R<LoginDTO> login(LoginParamDTO login) {
|
||||
if (this.check(login.getKey(), login.getCode())) {
|
||||
return this.login(login.getAccount(), login.getPassword());
|
||||
}
|
||||
return R.error("验证码错误");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,561 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sl.ms.base.api.common.AreaFeign;
|
||||
import com.sl.ms.base.api.common.GoodsTypeFeign;
|
||||
import com.sl.ms.base.api.common.WorkPatternFeign;
|
||||
import com.sl.ms.base.api.common.WorkSchedulingFeign;
|
||||
import com.sl.ms.base.api.truck.TruckTypeFeign;
|
||||
import com.sl.ms.base.domain.base.*;
|
||||
import com.sl.ms.base.domain.truck.TruckTypeDto;
|
||||
import com.sl.ms.web.manager.enums.TruckTypeAllowableLoadEnum;
|
||||
import com.sl.ms.web.manager.enums.TruckTypeAllowableVolumeEnum;
|
||||
import com.sl.ms.web.manager.service.AuthService;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.util.ExcelUtil;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.*;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckTypeVO;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.common.util.UserThreadLocal;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 基础服务
|
||||
* 文件上传 排班 工作模式 行政机构 车型 货物类型
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BaseCommonServiceImpl implements BaseCommonService {
|
||||
|
||||
@Resource
|
||||
private AreaFeign areaFeign;
|
||||
|
||||
@Resource
|
||||
private WorkPatternFeign workPatternFeign;
|
||||
|
||||
@Resource
|
||||
private WorkSchedulingFeign workSchedulingFeign;
|
||||
|
||||
@Resource
|
||||
private GoodsTypeFeign goodsTypeFeign;
|
||||
|
||||
@Resource
|
||||
private TruckTypeFeign truckTypeFeign;
|
||||
|
||||
@Resource
|
||||
private AuthService authService;
|
||||
|
||||
/**
|
||||
* 批量关联排班
|
||||
*
|
||||
* @param workSchedulingAddVO 排班
|
||||
*/
|
||||
@Override
|
||||
public void batchSaveWorkScheduling(WorkSchedulingAddVO workSchedulingAddVO) {
|
||||
Map<Long, SysUserVO> sysUserVOMap = authService.users(workSchedulingAddVO.getUserIdList()).parallelStream().collect(Collectors.toMap(SysUserVO::getUserId, v -> v));
|
||||
List<WorkSchedulingExportVO> workSchedulingExportVOS = workSchedulingAddVO.getUserIdList().stream().map(v -> {
|
||||
WorkSchedulingExportVO workSchedulingExportVO = new WorkSchedulingExportVO();
|
||||
workSchedulingExportVO.setEmployeeNumber(v.toString());
|
||||
SysUserVO user = sysUserVOMap.get(v);
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
return null;
|
||||
}
|
||||
workSchedulingExportVO.setName(user.getName());
|
||||
workSchedulingExportVO.setPhone(user.getMobile());
|
||||
workSchedulingExportVO.setAgencyId(user.getAgency().getId());
|
||||
BeanUtil.copyProperties(workSchedulingAddVO, workSchedulingExportVO);
|
||||
return workSchedulingExportVO;
|
||||
}).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
||||
batchSaveWorkScheduling(workSchedulingExportVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取map类型车辆类型数据集合
|
||||
*
|
||||
* @param truckTypeSet 车辆类型id列表
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, TruckTypeVO> truckTypeMap(Set<Long> truckTypeSet) {
|
||||
|
||||
List<TruckTypeDto> truckTypeDtoList = truckTypeFeign.findAll(new ArrayList<>(truckTypeSet));
|
||||
return truckTypeDtoList.stream()
|
||||
.map(truckTypeDto -> BeanUtil.toBean(truckTypeDto, TruckTypeVO.class))
|
||||
.collect(Collectors.toMap(TruckTypeVO::getId, vo -> vo));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 行政机构
|
||||
* 用于地址选择 省市县三级行政机构
|
||||
* 根据父行政机构节点查询子行政机构节点
|
||||
*
|
||||
* @param parentId 父节点ID
|
||||
* @return 子节点
|
||||
*/
|
||||
@Override
|
||||
public List<AreaSimpleVO> findChildrenAreaByParentId(Long parentId) {
|
||||
|
||||
List<AreaDto> areas = areaFeign.findChildren(parentId);
|
||||
if (CollUtil.isEmpty(areas)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<AreaSimpleVO> areaSimpleVOS = new ArrayList<>();
|
||||
areas.forEach(area -> {
|
||||
AreaSimpleVO areaSimpleVO = BeanUtil.toBean(area, AreaSimpleVO.class);
|
||||
areaSimpleVOS.add(areaSimpleVO);
|
||||
});
|
||||
return areaSimpleVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作模式列表查询
|
||||
*
|
||||
* @return 工作模式列表
|
||||
*/
|
||||
@Override
|
||||
public Map<Byte, List<WorkPatternDTO>> listWorkPattern() {
|
||||
return workPatternFeign.findAll().stream().collect(Collectors.groupingBy(WorkPatternDTO::getWorkPatternType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作模式分页查询
|
||||
*
|
||||
* @param workPatternQueryDTO 查询条件
|
||||
* @return 工作模式列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<WorkPatternDTO> listWorkPattern(WorkPatternQueryDTO workPatternQueryDTO) {
|
||||
log.info("workPatternQueryDTO : {}", workPatternQueryDTO);
|
||||
return workPatternFeign.list(workPatternQueryDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工作模式详情
|
||||
*
|
||||
* @param id 工作模式ID
|
||||
* @return 工作模式
|
||||
*/
|
||||
@Override
|
||||
public WorkPatternDTO getWorkPatternById(@PathVariable("id") Long id) {
|
||||
return workPatternFeign.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工作模式
|
||||
*
|
||||
* @param id 工作模式ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteWorkPattern(@PathVariable("id") Long id) {
|
||||
workPatternFeign.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加工作模式
|
||||
*
|
||||
* @param workPatternAddDTO 工作模式
|
||||
*/
|
||||
@Override
|
||||
public void addWorkPattern(WorkPatternAddDTO workPatternAddDTO) {
|
||||
//管理员
|
||||
Long managerId = UserThreadLocal.getUserId();
|
||||
workPatternAddDTO.setOperator(managerId);
|
||||
try {
|
||||
workPatternFeign.add(workPatternAddDTO);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("新增失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工作模式
|
||||
*
|
||||
* @param workPatternUpdateDTO 工作模式
|
||||
*/
|
||||
@Override
|
||||
public void putWorkPattern(WorkPatternUpdateDTO workPatternUpdateDTO) {
|
||||
//管理员
|
||||
Long managerId = UserThreadLocal.getUserId();
|
||||
workPatternUpdateDTO.setOperator(managerId);
|
||||
try {
|
||||
workPatternFeign.put(workPatternUpdateDTO);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询排班列表
|
||||
*
|
||||
* @param workSchedulingQueryDTO 查询条件
|
||||
* @return 排班列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<WorkSchedulingDTO> listWorkScheduling(WorkSchedulingQueryDTO workSchedulingQueryDTO) {
|
||||
PageResponse<WorkSchedulingDTO> pageResponse = workSchedulingFeign.list(workSchedulingQueryDTO);
|
||||
if (ObjectUtil.isEmpty(pageResponse) || ObjectUtil.isEmpty(pageResponse.getItems())) {
|
||||
return new PageResponse<>();
|
||||
}
|
||||
// 以权限系统为主
|
||||
List<Long> userIds = pageResponse.getItems().parallelStream().map(WorkSchedulingDTO::getUserId).collect(Collectors.toList());
|
||||
Map<Long, SysUserVO> sysUserVOMap = authService.users(userIds).parallelStream().collect(Collectors.toMap(SysUserVO::getUserId, v -> v));
|
||||
List<WorkSchedulingDTO> dtoList = pageResponse.getItems().stream().map(workSchedulingDTO -> {
|
||||
SysUserVO user = sysUserVOMap.get(workSchedulingDTO.getUserId());
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
return null;
|
||||
}
|
||||
workSchedulingDTO.setName(user.getName());
|
||||
workSchedulingDTO.setEmployeeNumber(user.getAccount());
|
||||
workSchedulingDTO.setPhone(user.getMobile());
|
||||
workSchedulingDTO.setAgencyName(user.getAgency().getName());
|
||||
return workSchedulingDTO;
|
||||
}).collect(Collectors.toList());
|
||||
pageResponse.setItems(dtoList);
|
||||
return pageResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除排班
|
||||
*
|
||||
* @param id 排班ID
|
||||
* @param operator 操作人
|
||||
*/
|
||||
@Override
|
||||
public void deleteWorkScheduling(Long id, Long operator) {
|
||||
workSchedulingFeign.delete(id, operator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新排班
|
||||
*
|
||||
* @param workSchedulingVO 排班
|
||||
*/
|
||||
@Override
|
||||
public void updateWorkScheduling(WorkSchedulingVO workSchedulingVO) {
|
||||
//管理员
|
||||
Long manage = UserThreadLocal.getUserId();
|
||||
workSchedulingVO.getUserIdList().forEach(id -> {
|
||||
WorkSchedulingUpdateDTO workSchedulingUpdateDTO = new WorkSchedulingUpdateDTO();
|
||||
workSchedulingUpdateDTO.setId(id);
|
||||
workSchedulingUpdateDTO.setOperator(manage);
|
||||
workSchedulingUpdateDTO.setWorkPatternId(workSchedulingVO.getWorkPatternId());
|
||||
workSchedulingUpdateDTO.setWorkPatternType(workSchedulingVO.getWorkPatternType());
|
||||
workSchedulingFeign.update(workSchedulingUpdateDTO);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载排班模板
|
||||
*
|
||||
* @return 排班模板Excel
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity downExcelTemplate() {
|
||||
List<WorkSchedulingExportVO> list = new ArrayList<>();
|
||||
return ExcelUtil.export(list, WorkSchedulingExportVO.class, "排班模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入排班
|
||||
*
|
||||
* @param list 排班列表
|
||||
*/
|
||||
@Override
|
||||
public void batchSaveWorkScheduling(List<WorkSchedulingExportVO> list) {
|
||||
List<WorkSchedulingAddDTO> collect = list.stream().map(v -> BeanUtil.toBean(v, WorkSchedulingAddDTO.class)).collect(Collectors.toList());
|
||||
workSchedulingFeign.batch(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加货物类型
|
||||
*
|
||||
* @param vo 货物类型信息
|
||||
*/
|
||||
@Override
|
||||
public void saveGoodsType(GoodsTypeVO vo) {
|
||||
GoodsTypeDto dto = BeanUtil.toBean(vo, GoodsTypeDto.class);
|
||||
//处理车辆类型关联数据
|
||||
if (ObjectUtil.isNotEmpty(vo.getTruckTypes())) {
|
||||
dto.setTruckTypeIds(vo.getTruckTypes().stream().map(TruckTypeVO::getId).collect(Collectors.toList()));
|
||||
}
|
||||
dto.setId(null);
|
||||
try {
|
||||
goodsTypeFeign.saveGoodsType(dto);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取货物类型详情
|
||||
*
|
||||
* @param id 货物类型id
|
||||
* @return 货物类型信息
|
||||
*/
|
||||
@Override
|
||||
public GoodsTypeVO fineGoodsTypeById(Long id) {
|
||||
GoodsTypeDto dto = goodsTypeFeign.fineById(id);
|
||||
return parseGoodsTypeDto2Vo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取货物类型列表
|
||||
*
|
||||
* @param ids 货物类型ids
|
||||
* @return 货物类型列表
|
||||
*/
|
||||
@Override
|
||||
public List<GoodsTypeVO> findGoodsTypeAll(List<Long> ids) {
|
||||
List<GoodsTypeDto> goodsTypeDtoList = goodsTypeFeign.findAll(ids);
|
||||
return goodsTypeDtoList.stream()
|
||||
.map(goodsTypeDto -> BeanUtil.toBean(goodsTypeDto, GoodsTypeVO.class))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页货物类型数据
|
||||
*
|
||||
* @param page 页码
|
||||
* @param pageSize 页尺寸
|
||||
* @param name 名称
|
||||
* @param truckTypeId 车型id
|
||||
* @return 分页货物类型数据
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<GoodsTypeVO> findGoodsTypeByPage(Integer page, Integer pageSize, String name, Long truckTypeId) {
|
||||
PageResponse<GoodsTypeDto> goodsTypePage = goodsTypeFeign.findByPage(page, pageSize, name, truckTypeId);
|
||||
//加工数据
|
||||
return PageResponse.of(goodsTypePage, this::parseGoodsTypeDto2Vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新货物类型信息
|
||||
*
|
||||
* @param id 货物类型id
|
||||
* @param vo 货物类型信息
|
||||
*/
|
||||
@Override
|
||||
public void updateGoodsType(Long id, GoodsTypeVO vo) {
|
||||
GoodsTypeDto dto = BeanUtil.toBean(vo, GoodsTypeDto.class);
|
||||
//处理车辆类型关联数据
|
||||
if (ObjectUtil.isNotEmpty(vo.getTruckTypes())) {
|
||||
dto.setTruckTypeIds(vo.getTruckTypes().stream().map(TruckTypeVO::getId).collect(Collectors.toList()));
|
||||
}
|
||||
dto.setId(id);
|
||||
try {
|
||||
goodsTypeFeign.update(id, dto);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("更新失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除货物类型
|
||||
*
|
||||
* @param id 货物类型id
|
||||
*/
|
||||
@Override
|
||||
public void disableGoodsType(Long id) {
|
||||
goodsTypeFeign.disable(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 简要行政机构信息转换
|
||||
*
|
||||
* @param area 行政机构DTO
|
||||
* @return 简要行政机构VO
|
||||
*/
|
||||
@Override
|
||||
public AreaSimpleVO parseArea2Vo(AreaDto area) {
|
||||
return BeanUtil.toBean(area, AreaSimpleVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 货物类型转换
|
||||
*
|
||||
* @param goodsTypeDtoList 货物类型DTO
|
||||
* @return 货物类型VO
|
||||
*/
|
||||
public List<GoodsTypeVO> parseGoodsTypeDto2Vo(List<GoodsTypeDto> goodsTypeDtoList) {
|
||||
Set<Long> truckTypeSet = new HashSet<>();
|
||||
goodsTypeDtoList.forEach(goodsTypeDto -> {
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeDto.getTruckTypeIds())) {
|
||||
truckTypeSet.addAll(goodsTypeDto.getTruckTypeIds());
|
||||
}
|
||||
});
|
||||
Map<Long, TruckTypeVO> longTruckTypeVoMap = truckTypeMap(truckTypeSet);
|
||||
return goodsTypeDtoList.stream().map(goodsTypeDto -> {
|
||||
GoodsTypeVO vo = BeanUtil.toBean(goodsTypeDto, GoodsTypeVO.class);
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeDto.getTruckTypeIds())) {
|
||||
List<TruckTypeVO> truckTypeVOList = new ArrayList<>();
|
||||
for (Long typeId : goodsTypeDto.getTruckTypeIds()) {
|
||||
truckTypeVOList.add(longTruckTypeVoMap.get(typeId));
|
||||
}
|
||||
vo.setTruckTypes(truckTypeVOList);
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 货物类型转换
|
||||
*
|
||||
* @param dto 货物类型DTO
|
||||
* @return 货物类型VO
|
||||
*/
|
||||
public GoodsTypeVO parseGoodsTypeDto2Vo(GoodsTypeDto dto) {
|
||||
GoodsTypeVO vo = BeanUtil.toBean(dto, GoodsTypeVO.class);
|
||||
if (ObjectUtil.isNotEmpty(dto) && ObjectUtil.isNotEmpty(dto.getTruckTypeIds())) {
|
||||
List<TruckTypeDto> truckTypeDtoList = truckTypeFeign.findAll(dto.getTruckTypeIds());
|
||||
if (ObjectUtil.isNotEmpty(truckTypeDtoList)) {
|
||||
vo.setTruckTypes(truckTypeDtoList.stream().map(truckTypeDto -> BeanUtil.toBean(truckTypeDto, TruckTypeVO.class)).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量车辆类型转换
|
||||
*
|
||||
* @param truckTypeDtoList 车辆类型DTO
|
||||
* @return 车辆类型VO
|
||||
*/
|
||||
public List<TruckTypeVO> parseTruckTypeDto2Vo(List<TruckTypeDto> truckTypeDtoList) {
|
||||
return truckTypeDtoList.stream().map(dto -> BeanUtil.toBean(dto, TruckTypeVO.class)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆类型转换
|
||||
*
|
||||
* @param dto 车辆类型DTO
|
||||
* @return 车辆类型VO
|
||||
*/
|
||||
public TruckTypeVO parseTruckTypeDto2Vo(TruckTypeDto dto) {
|
||||
TruckTypeVO vo = BeanUtil.toBean(dto, TruckTypeVO.class);
|
||||
//处理关联数据
|
||||
if (ObjectUtil.isNotEmpty(dto.getGoodsTypeIds())) {
|
||||
List<GoodsTypeDto> goodsTypeDtoList = goodsTypeFeign.findAll(dto.getGoodsTypeIds());
|
||||
vo.setGoodsTypes(goodsTypeDtoList.stream()
|
||||
.map(goodsTypeDto -> BeanUtil.toBean(goodsTypeDto, GoodsTypeVO.class))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车型列表
|
||||
*
|
||||
* @return 车型列表
|
||||
*/
|
||||
@Override
|
||||
public List<TruckTypeVO> truckTypeSimple() {
|
||||
List<TruckTypeDto> truckTypeDtoList = truckTypeFeign.findAll(null);
|
||||
return truckTypeDtoList.stream().map(truckTypeDto -> BeanUtil.toBean(truckTypeDto, TruckTypeVO.class)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存车型
|
||||
*
|
||||
* @param vo 车型信息
|
||||
*/
|
||||
@Override
|
||||
public void saveTruckType(TruckTypeVO vo) {
|
||||
TruckTypeDto dto = BeanUtil.toBean(vo, TruckTypeDto.class);
|
||||
if (ObjectUtil.isNotEmpty(vo.getGoodsTypes())) {
|
||||
dto.setGoodsTypeIds(vo.getGoodsTypes().stream().map(GoodsTypeVO::getId).collect(Collectors.toList()));
|
||||
}
|
||||
dto.setId(null);
|
||||
try {
|
||||
truckTypeFeign.saveTruckType(dto);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车型
|
||||
*
|
||||
* @param id 车型ID
|
||||
* @param vo 车型信息
|
||||
*/
|
||||
@Override
|
||||
public void updateTruckType(Long id, TruckTypeVO vo) {
|
||||
vo.setId(id);
|
||||
TruckTypeDto dto = BeanUtil.toBean(vo, TruckTypeDto.class);
|
||||
if (ObjectUtil.isNotEmpty(vo.getGoodsTypes())) {
|
||||
dto.setGoodsTypeIds(vo.getGoodsTypes().stream().map(GoodsTypeVO::getId).collect(Collectors.toList()));
|
||||
}
|
||||
try {
|
||||
truckTypeFeign.update(id, dto);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车型分页
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param name 车辆类型名称
|
||||
* @param allowableLoad 车型载重,单位:吨;左闭右开区间
|
||||
* @param allowableVolume 车型体积,单位:立方米;左闭右开区间
|
||||
* @param id 车型ID
|
||||
* @return 车型列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<TruckTypeVO> findTruckTypeByPage(Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
TruckTypeAllowableLoadEnum allowableLoad,
|
||||
TruckTypeAllowableVolumeEnum allowableVolume,
|
||||
Long id) {
|
||||
//构造查询条件
|
||||
BigDecimal minAllowableLoad = ObjectUtil.isNotEmpty(allowableLoad) ? allowableLoad.getValue().getMinLoad() : null;
|
||||
BigDecimal maxAllowableLoad = ObjectUtil.isNotEmpty(allowableLoad) ? allowableLoad.getValue().getMaxLoad() : null;
|
||||
BigDecimal minAllowableVolume = ObjectUtil.isNotEmpty(allowableVolume) ? allowableVolume.getValue().getMinLoad() : null;
|
||||
BigDecimal maxAllowableVolume = ObjectUtil.isNotEmpty(allowableVolume) ? allowableVolume.getValue().getMaxLoad() : null;
|
||||
|
||||
//分页查询
|
||||
PageResponse<TruckTypeDto> truckTypeDtoPage = truckTypeFeign.findByPage(page, pageSize, name, minAllowableLoad, maxAllowableLoad, minAllowableVolume, maxAllowableVolume, id);
|
||||
return PageResponse.of(truckTypeDtoPage, this::parseTruckTypeDto2Vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车型详情
|
||||
*
|
||||
* @param id 车型ID
|
||||
* @return 车型详情
|
||||
*/
|
||||
@Override
|
||||
public TruckTypeVO findTruckTypeById(Long id) {
|
||||
TruckTypeDto dto = truckTypeFeign.fineById(id);
|
||||
return parseTruckTypeDto2Vo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车型
|
||||
*
|
||||
* @param id 车型ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteTruckType(Long id) {
|
||||
truckTypeFeign.disable(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,987 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.itheima.auth.sdk.common.Result;
|
||||
import com.itheima.auth.sdk.dto.PageDTO;
|
||||
import com.itheima.auth.sdk.dto.UserDTO;
|
||||
import com.itheima.auth.sdk.dto.UserPageDTO;
|
||||
import com.sl.ms.base.api.common.WorkSchedulingFeign;
|
||||
import com.sl.ms.base.api.trips.TripsFeign;
|
||||
import com.sl.ms.base.api.truck.TruckFeign;
|
||||
import com.sl.ms.base.api.truck.TruckLicenseFeign;
|
||||
import com.sl.ms.base.api.user.DriverFeign;
|
||||
import com.sl.ms.base.domain.base.WorkSchedulingDTO;
|
||||
import com.sl.ms.base.domain.constants.TruckConstant;
|
||||
import com.sl.ms.base.domain.enums.TruckWorkStatusEnum;
|
||||
import com.sl.ms.base.domain.enums.WorkUserTypeEnum;
|
||||
import com.sl.ms.base.domain.truck.TransportTripsTruckDriverDto;
|
||||
import com.sl.ms.base.domain.truck.TruckDto;
|
||||
import com.sl.ms.base.domain.truck.TruckLicenseDto;
|
||||
import com.sl.ms.base.domain.truck.TruckTripsDto;
|
||||
import com.sl.ms.base.domain.user.TruckDriverDto;
|
||||
import com.sl.ms.base.domain.user.TruckDriverLicenseDto;
|
||||
import com.sl.ms.transport.api.TransportLineFeign;
|
||||
import com.sl.ms.web.manager.service.AuthService;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.service.BaseTruckService;
|
||||
import com.sl.ms.web.manager.service.TransportService;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.*;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import com.sl.ms.work.api.TransportTaskFeign;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import com.sl.transport.common.util.AuthTemplateThreadLocal;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.domain.TransportLineDTO;
|
||||
import com.sl.transport.domain.TransportLineSearchDTO;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 基础运输模型管理
|
||||
* 车辆 车次 司机 行驶证管理
|
||||
* 对应 base微服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BaseTruckServiceImpl implements BaseTruckService {
|
||||
|
||||
@Resource
|
||||
WorkSchedulingFeign workSchedulingFeign;
|
||||
|
||||
@Resource
|
||||
private TripsFeign tripsFeign;
|
||||
|
||||
@Resource
|
||||
private DriverFeign driverFeign;
|
||||
|
||||
@Resource
|
||||
private TruckFeign truckFeign;
|
||||
|
||||
@Resource
|
||||
private TruckLicenseFeign truckLicenseFeign;
|
||||
|
||||
@Value("${role.driver}")
|
||||
private String roleId;
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@Resource
|
||||
private AuthService authService;
|
||||
|
||||
@Resource
|
||||
private TransportService transportService;
|
||||
|
||||
@Resource
|
||||
private TransportTaskFeign transportTaskFeign;
|
||||
|
||||
@Resource
|
||||
private TransportLineFeign transportLineFeign;
|
||||
|
||||
/**
|
||||
* 司机vo map
|
||||
*
|
||||
* @return 司机VO MAP
|
||||
*/
|
||||
private Map<Long, DriverVO> driverMap(Set<Long> userSet) {
|
||||
List<Long> driverIds = userSet.stream().mapToLong(Long::valueOf).boxed().collect(Collectors.toList());
|
||||
List<TruckDriverDto> truckDriverDtos = driverFeign.findAllDriver(driverIds);
|
||||
|
||||
Map<Long, SysUserVO> sysUserVOMap = authService.users(driverIds).parallelStream().collect(Collectors.toMap(SysUserVO::getUserId, v -> v));
|
||||
List<DriverVO> driverVOS = batchParseTruckDriverDto2Vo(truckDriverDtos, sysUserVOMap);
|
||||
return driverVOS.parallelStream().collect(Collectors.toMap(DriverVO::getUserId, vo -> vo));
|
||||
}
|
||||
|
||||
private List<DriverVO> batchParseTruckDriverDto2Vo(List<TruckDriverDto> truckDriverDtos, Map<Long, SysUserVO> sysUserVOMap) {
|
||||
return truckDriverDtos.parallelStream().map(dto -> {
|
||||
DriverVO vo = BeanUtil.toBean(dto, DriverVO.class);
|
||||
if (ObjectUtil.isEmpty(dto.getUserId())) {
|
||||
return vo;
|
||||
}
|
||||
try {
|
||||
SysUserVO user = sysUserVOMap.get(dto.getUserId());
|
||||
BeanUtil.copyProperties(user, vo);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机DTO map
|
||||
*
|
||||
* @param userSet 用户ID列表
|
||||
* @return 司机DTO MAP
|
||||
*/
|
||||
private Map<Long, TruckDriverDto> driverDtoMap(Set<Long> userSet) {
|
||||
List<Long> driverIds = userSet.stream().mapToLong(Long::valueOf).boxed().collect(Collectors.toList());
|
||||
List<TruckDriverDto> truckDriverDtos = driverFeign.findAllDriver(driverIds);
|
||||
return truckDriverDtos.stream().collect(Collectors.toMap(TruckDriverDto::getUserId, vo -> vo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取司机分页数据
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param name 名称
|
||||
* @param account 账号
|
||||
* @param workStatus 工作状态
|
||||
* @param agentId 机构ID
|
||||
* @param phone 手机号
|
||||
* @return 司机列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<DriverVO> findDriverByPage(Integer page,
|
||||
Integer pageSize,
|
||||
String name,
|
||||
String account,
|
||||
String workStatus, Long agentId, String phone) {
|
||||
List<DriverVO> driverVOList = new ArrayList<>();
|
||||
// 查询用户表
|
||||
UserPageDTO userPageDTO = new UserPageDTO(page, pageSize, account, name, agentId, phone);
|
||||
userPageDTO.setRoleId(roleId);
|
||||
Result<PageDTO<UserDTO>> result = AuthTemplateThreadLocal.get().opsForUser().getUserByPage(userPageDTO);
|
||||
|
||||
if (result.getCode() != 0) {
|
||||
return null;
|
||||
}
|
||||
PageDTO<UserDTO> data = result.getData();
|
||||
long total = data.getTotal();
|
||||
long pages = data.getTotal() % data.getSize();
|
||||
List<UserDTO> userDTOS = data.getRecords();
|
||||
// 根据userID查询司机表
|
||||
Set<Long> driverIds = userDTOS.stream().map(UserDTO::getId).collect(Collectors.toSet());
|
||||
if (CollUtil.isEmpty(driverIds)) {
|
||||
return PageResponse.of(driverVOList, page, pageSize, pages, total);
|
||||
}
|
||||
|
||||
Map<Long, TruckDriverDto> driverVOMap = driverDtoMap(driverIds);
|
||||
Set<Long> truckIds = driverVOMap.entrySet().parallelStream().map(userDTO -> userDTO.getValue().getTruckId()).collect(Collectors.toSet());
|
||||
Map<Long, TruckVO> truckVOMap = truckMap(truckIds);
|
||||
|
||||
// 批量查询排班
|
||||
String bidStr = CollUtil.isEmpty(driverIds) ? "" : CharSequenceUtil.join(",", driverIds);
|
||||
List<WorkSchedulingDTO> workSchedulingDTOS = workSchedulingFeign.monthSchedule(bidStr, null, WorkUserTypeEnum.DRIVER.getCode(), LocalDateTimeUtil.toEpochMilli(LocalDateTimeUtil.now()));
|
||||
Map<Long, Boolean> workMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(workSchedulingDTOS)) {
|
||||
workMap = workSchedulingDTOS.parallelStream().filter(workSchedulingDTO -> CollUtil.isNotEmpty(workSchedulingDTO.getWorkSchedules())).collect(Collectors.toMap(WorkSchedulingDTO::getUserId, workSchedulingDTO -> workSchedulingDTO.getWorkSchedules().get(0)));
|
||||
}
|
||||
// 补充数据
|
||||
Map<Long, Boolean> finalWorkMap = workMap;
|
||||
userDTOS.forEach(userDTO -> {
|
||||
DriverVO driverVO = appendDriverInfo(userDTO, driverVOMap, truckVOMap, finalWorkMap);
|
||||
driverVOList.add(driverVO);
|
||||
});
|
||||
return PageResponse.of(driverVOList, page, pageSize, pages, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户转换司机
|
||||
*
|
||||
* @param user 用户VO
|
||||
* @return 司机VO
|
||||
*/
|
||||
private DriverVO parseUser2DriverVO(SysUserVO user) {
|
||||
DriverVO vo = BeanUtil.toBean(user, DriverVO.class);
|
||||
TruckDriverDto driverDto = driverFeign.findOneDriver(user.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(driverDto)) {
|
||||
BeanUtil.copyProperties(driverDto, vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 补充司机其他信息
|
||||
*
|
||||
* @param userDTO 用户信息
|
||||
* @param driverVOMap 司机数据
|
||||
* @param truckVOMap 车辆信息
|
||||
* @param workMap 排班信息
|
||||
* @return 组合数据
|
||||
*/
|
||||
private DriverVO appendDriverInfo(UserDTO userDTO, Map<Long, TruckDriverDto> driverVOMap, Map<Long, TruckVO> truckVOMap, Map<Long, Boolean> workMap) {
|
||||
// 用户信息
|
||||
DriverVO driverVO = BeanUtil.toBean(authService.parseUser2Vo(userDTO), DriverVO.class);
|
||||
|
||||
TruckDriverDto driverDto = driverVOMap.get(userDTO.getId());
|
||||
if (ObjectUtil.isNotEmpty(driverDto)) {
|
||||
try {
|
||||
// 司机信息
|
||||
BeanUtil.copyProperties(driverDto, driverVO);
|
||||
|
||||
// 车辆信息
|
||||
if (!ObjectUtil.isEmpty(driverDto.getTruckId())) {
|
||||
TruckVO truckById = truckVOMap.get(driverDto.getTruckId());
|
||||
driverVO.setTruck(truckById);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.info(ignored + "");
|
||||
}
|
||||
}
|
||||
|
||||
// 上班状态
|
||||
Boolean aBoolean = workMap.get(userDTO.getId());
|
||||
if (ObjectUtil.isNotEmpty(aBoolean)) {
|
||||
driverVO.setWorkStatus(aBoolean ? 1 : 0);
|
||||
}
|
||||
return driverVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机详情
|
||||
*
|
||||
* @param id 司机ID
|
||||
* @return 司机
|
||||
*/
|
||||
@Override
|
||||
public DriverVO findDriverById(Long id) {
|
||||
SysUserVO user = authService.user(id);
|
||||
return parseUser2DriverVO(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存司机
|
||||
*
|
||||
* @param id 司机ID
|
||||
* @param vo 司机信息
|
||||
*/
|
||||
@Override
|
||||
public void saveDriver(Long id, DriverUpdateVO vo) {
|
||||
TruckDriverDto driverDto = driverFeign.findOneDriver(id);
|
||||
if (driverDto == null) {
|
||||
driverDto = new TruckDriverDto();
|
||||
}
|
||||
driverDto.setUserId(id);
|
||||
driverDto.setAge(vo.getAge());
|
||||
driverFeign.saveDriver(driverDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量转换车辆DTO
|
||||
*
|
||||
* @return 车辆VO集合
|
||||
*/
|
||||
private List<TruckVO> batchParseTruckDto2Vo(List<TruckDto> truckDtoList) {
|
||||
if (CollUtil.isEmpty(truckDtoList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return truckDtoList.stream().map(dto -> BeanUtil.toBean(dto, TruckVO.class)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存驾驶证
|
||||
*
|
||||
* @param vo 驾驶证信息
|
||||
*/
|
||||
@Override
|
||||
public void saveDriverLicense(DriverLicenseVO vo) {
|
||||
TruckDriverLicenseDto dto = BeanUtil.toBean(vo, TruckDriverLicenseDto.class);
|
||||
if (StringUtils.isNotEmpty(vo.getInitialCertificateDate())) {
|
||||
dto.setInitialCertificateDate(LocalDate.parse(vo.getInitialCertificateDate(), DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
driverFeign.saveDriverLicense(dto);
|
||||
BeanUtil.copyProperties(dto, vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驾驶证详情
|
||||
*
|
||||
* @param id 司机id
|
||||
* @return 驾驶证信息
|
||||
*/
|
||||
@Override
|
||||
public DriverLicenseVO findDriverLicenseById(Long id) {
|
||||
TruckDriverLicenseDto dto = driverFeign.findOneDriverLicense(id);
|
||||
DriverLicenseVO vo = new DriverLicenseVO();
|
||||
if (ObjectUtil.isNotEmpty(dto)) {
|
||||
BeanUtil.copyProperties(dto, vo);
|
||||
if (ObjectUtil.isNotEmpty(dto.getInitialCertificateDate())) {
|
||||
vo.setInitialCertificateDate(dto.getInitialCertificateDate().format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(vo.getUserId())) {
|
||||
vo.setUserId(id);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增司机安排车辆 【司机:车辆 = n:1】
|
||||
* 调整司机安排车辆
|
||||
* 删除司机安排车辆
|
||||
* base服务会统一判断原有绑定关系是否能够删除
|
||||
*
|
||||
* @param bindingDriversVO 绑定关系
|
||||
*/
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
public void bindingTrucks(BindingDriversVO bindingDriversVO) {
|
||||
|
||||
if (CollUtil.isEmpty(bindingDriversVO.getDriverIds())) {
|
||||
throw new SLWebException("配置失败,司机列表为空");
|
||||
}
|
||||
|
||||
// 车辆为空则解除这个司机的车辆
|
||||
if (ObjectUtil.isEmpty(bindingDriversVO.getTruckId())) {
|
||||
bindingDriversVO.setTruckId(0L);
|
||||
}
|
||||
|
||||
// 前置校验
|
||||
checkBingDriverVO(bindingDriversVO);
|
||||
|
||||
// 循环绑定
|
||||
bindingDriversVO.getDriverIds().forEach(driverId -> {
|
||||
TruckDriverDto driverDto = driverFeign.findOneDriver(driverId);
|
||||
if (driverDto == null) {
|
||||
driverDto = new TruckDriverDto();
|
||||
}
|
||||
driverDto.setUserId(driverId);
|
||||
|
||||
driverDto.setTruckId(bindingDriversVO.getTruckId());
|
||||
driverFeign.saveDriver(driverDto);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定前置校验
|
||||
*
|
||||
* @param bindingDriversVO 绑定的司机信息
|
||||
*/
|
||||
private void checkBingDriverVO(BindingDriversVO bindingDriversVO) {
|
||||
// 绑定前置校验
|
||||
TruckVO truckSimple = findTruckSimple(bindingDriversVO.getTruckId());
|
||||
if (ObjectUtil.isEmpty(truckSimple) || ObjectUtil.isEmpty(truckSimple.getTruckLicenseId())) {
|
||||
throw new SLWebException("配置失败,请先完善车辆信息");
|
||||
}
|
||||
TruckLicenseDto truckLicenseDto = truckLicenseFeign.fineById(truckSimple.getTruckLicenseId());
|
||||
if (ObjectUtil.isEmpty(truckLicenseDto) || ObjectUtil.isEmpty(truckLicenseDto.getPicture())) {
|
||||
throw new SLWebException("配置失败,请上传行驶证照片");
|
||||
}
|
||||
|
||||
// 司机
|
||||
if (CollUtil.isNotEmpty(bindingDriversVO.getDriverIds())) {
|
||||
// 最多2个
|
||||
if (bindingDriversVO.getDriverIds().size() > 2) {
|
||||
throw new SLWebException("配置失败,最多绑定俩个司机");
|
||||
}
|
||||
bindingDriversVO.getDriverIds().forEach(driverId -> {
|
||||
// 司机信息完善
|
||||
TruckDriverDto oneDriver = driverFeign.findOneDriver(driverId);
|
||||
if (ObjectUtil.isEmpty(oneDriver)) {
|
||||
throw new SLWebException("配置失败,请先完善司机信息");
|
||||
}
|
||||
TruckDriverLicenseDto oneDriverLicense = driverFeign.findOneDriverLicense(driverId);
|
||||
if (ObjectUtil.isEmpty(oneDriverLicense) || ObjectUtil.isEmpty(oneDriverLicense.getPicture())) {
|
||||
throw new SLWebException("配置失败,请上传驾驶证照片");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存车辆
|
||||
*
|
||||
* @param vo 车辆
|
||||
*/
|
||||
@Override
|
||||
public void saveTruck(TruckVO vo) {
|
||||
TruckDto dto = BeanUtil.toBean(vo, TruckDto.class);
|
||||
dto.setId(null);
|
||||
try {
|
||||
truckFeign.saveTruck(dto);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @param vo 车辆
|
||||
*/
|
||||
@Override
|
||||
public void updateTruck(Long id, TruckVO vo) {
|
||||
vo.setId(id);
|
||||
TruckDto truckDto = BeanUtil.toBean(vo, TruckDto.class);
|
||||
try {
|
||||
truckFeign.update(id, truckDto);
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("更新失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆列表
|
||||
*
|
||||
* @param page 页数
|
||||
* @param pageSize 页大小
|
||||
* @param truckTypeId 车型ID
|
||||
* @param status 状态
|
||||
* @param licensePlate 车牌号
|
||||
* @return 车辆列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<TruckVO> findTruckByPage(Integer page,
|
||||
Integer pageSize,
|
||||
Long truckTypeId,
|
||||
Integer status,
|
||||
String licensePlate) {
|
||||
PageResponse<TruckDto> truckDtoPage = truckFeign.findByPage(page, pageSize, truckTypeId, status, licensePlate);
|
||||
log.info("truckDtoPage:{}", truckDtoPage);
|
||||
//加工数据
|
||||
return PageResponse.of(truckDtoPage, TruckVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆简要信息
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 车辆简要信息
|
||||
*/
|
||||
@Override
|
||||
public TruckVO findTruckSimple(Long id) {
|
||||
TruckDto dto = truckFeign.fineById(id);
|
||||
return BeanUtil.toBean(dto, TruckVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆详情
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 车辆详情
|
||||
*/
|
||||
@Override
|
||||
public TruckVO findTruckDetail(Long id) {
|
||||
TruckDto dto = truckFeign.fineById(id);
|
||||
return parseTruckDto2Vo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换车辆
|
||||
*
|
||||
* @param dto 车辆DTO
|
||||
* @return 车辆VO
|
||||
*/
|
||||
private TruckVO parseTruckDto2Vo(TruckDto dto) {
|
||||
TruckVO truckVo = BeanUtil.toBean(dto, TruckVO.class);
|
||||
if (ObjectUtil.isNotEmpty(dto.getTruckTypeId())) {
|
||||
TruckTypeVO truckTypeVo = baseCommonService.findTruckTypeById(dto.getTruckTypeId());
|
||||
truckVo.setTruckTypeName(truckTypeVo.getName());
|
||||
}
|
||||
List<DriverVO> driverVOS = bindingTrucks(dto.getId());
|
||||
truckVo.setDriverNum(driverVOS.size());
|
||||
String names = driverVOS.stream().map(DriverVO::getName).collect(Collectors.joining(","));
|
||||
truckVo.setDriverName(names);
|
||||
|
||||
List<TransportTripsTruckDriverDto> allTruckDriverTransportTrips = tripsFeign.findAllTruckDriverTransportTrips(null, dto.getId(), null);
|
||||
if (CollUtil.isEmpty(allTruckDriverTransportTrips)) {
|
||||
return truckVo;
|
||||
}
|
||||
List<Long> tripsIds = allTruckDriverTransportTrips.stream().map(TransportTripsTruckDriverDto::getTransportTripsId).distinct().collect(Collectors.toList());
|
||||
List<TruckTripsDto> truckTripsDtos = tripsFeign.findAll(null, tripsIds);
|
||||
if (CollUtil.isEmpty(truckTripsDtos)) {
|
||||
return truckVo;
|
||||
}
|
||||
List<TransportLineVO> transportLineByIds = transportService.findTransportLineByIds(truckTripsDtos.stream().map(TruckTripsDto::getTransportLineId).distinct().collect(Collectors.toList()));
|
||||
if (CollUtil.isEmpty(transportLineByIds)) {
|
||||
return truckVo;
|
||||
}
|
||||
String lineNames = transportLineByIds.stream().map(TransportLineVO::getName).collect(Collectors.joining(","));
|
||||
truckVo.setTransportLineName(lineNames);
|
||||
return truckVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计车辆
|
||||
*
|
||||
* @return 各状态个数
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, Long> countTruck() {
|
||||
return truckFeign.count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
*/
|
||||
@Override
|
||||
public void disableTruck(Long id) {
|
||||
// 未完成运输任务存在 不能解除
|
||||
Long count = transportTaskFeign.countByTruckId(id);
|
||||
if (count > 0) {
|
||||
throw new SLWebException("存在未完成运输任务 不能解除");
|
||||
}
|
||||
truckFeign.disable(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
*/
|
||||
@Override
|
||||
public void enableTruck(Long id) {
|
||||
truckFeign.enable(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆
|
||||
*
|
||||
* @param id 车辆ID
|
||||
*/
|
||||
@Override
|
||||
public void delTruck(Long id) {
|
||||
List<DriverVO> driverVOS = bindingTrucks(id);
|
||||
if (CollUtil.isNotEmpty(driverVOS)) {
|
||||
throw new SLWebException("请先解除车辆下的司机");
|
||||
}
|
||||
truckFeign.del(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存行驶证
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @param vo 行驶证信息
|
||||
*/
|
||||
@Override
|
||||
public void saveTruckLicense(Long id, TruckLicenseVO vo) {
|
||||
TruckLicenseDto dto = BeanUtil.toBean(vo, TruckLicenseDto.class);
|
||||
dto.setTruckId(id);
|
||||
TruckVO truckById = findTruckSimple(id);
|
||||
dto.setId(truckById.getTruckLicenseId());
|
||||
//加工数据
|
||||
if (StringUtils.isNotEmpty(vo.getExpirationDate())) {
|
||||
dto.setExpirationDate(LocalDate.parse(vo.getExpirationDate(), DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(vo.getMandatoryScrap())) {
|
||||
dto.setMandatoryScrap(LocalDate.parse(vo.getMandatoryScrap(), DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(vo.getRegistrationDate())) {
|
||||
dto.setRegistrationDate(LocalDate.parse(vo.getRegistrationDate(), DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(vo.getValidityPeriod())) {
|
||||
dto.setValidityPeriod(LocalDate.parse(vo.getValidityPeriod(), DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
TruckLicenseDto resultDto = truckLicenseFeign.saveTruckLicense(dto);
|
||||
BeanUtil.copyProperties(resultDto, vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行驶证
|
||||
*
|
||||
* @param id 车辆ID
|
||||
* @return 行驶证
|
||||
*/
|
||||
@Override
|
||||
public TruckLicenseVO findTruckLicenseById(Long id) {
|
||||
TruckVO truckById = findTruckSimple(id);
|
||||
TruckLicenseDto truckLicenseDto = null;
|
||||
if (ObjectUtil.isNotEmpty(truckById.getTruckLicenseId())) {
|
||||
truckLicenseDto = truckLicenseFeign.fineById(truckById.getTruckLicenseId());
|
||||
}
|
||||
TruckLicenseVO vo = new TruckLicenseVO();
|
||||
if (ObjectUtil.isNotEmpty(truckLicenseDto)) {
|
||||
BeanUtil.copyProperties(truckLicenseDto, vo);
|
||||
if (ObjectUtil.isNotEmpty(truckLicenseDto.getRegistrationDate())) {
|
||||
vo.setRegistrationDate(truckLicenseDto.getRegistrationDate().format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(truckLicenseDto.getExpirationDate())) {
|
||||
vo.setExpirationDate(truckLicenseDto.getExpirationDate().format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(truckLicenseDto.getMandatoryScrap())) {
|
||||
vo.setMandatoryScrap(truckLicenseDto.getMandatoryScrap().format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(truckLicenseDto.getValidityPeriod())) {
|
||||
vo.setValidityPeriod(truckLicenseDto.getValidityPeriod().format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆车次信息
|
||||
*
|
||||
* @param truckId 车辆ID
|
||||
* @return 车次信息
|
||||
*/
|
||||
@Override
|
||||
public List<TruckDriverTripsVO> findTruckTrips(Long truckId) {
|
||||
List<TruckDriverTripsVO> voList = new ArrayList<>();
|
||||
// 车次列表
|
||||
tripsFeign.findAllTruckDriverTransportTrips(null, truckId, null).forEach(transportTripsTruckDriverDto -> {
|
||||
TruckDriverTripsVO vo = new TruckDriverTripsVO();
|
||||
TransportTripsVO transportLineTripsById = findTripsSimple(transportTripsTruckDriverDto.getTransportTripsId());
|
||||
if (ObjectUtil.isNotEmpty(transportLineTripsById)) {
|
||||
vo.setTransportTrips(transportLineTripsById);
|
||||
TransportLineVO lineById = transportService.findTransportLineById(transportLineTripsById.getTransportLine().getId());
|
||||
vo.setTransportLine(lineById);
|
||||
}
|
||||
voList.add(vo);
|
||||
});
|
||||
return voList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取map类型车辆数据集合
|
||||
*
|
||||
* @param truckSet 车辆id列表
|
||||
* @return 执行结果
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, TruckVO> truckMap(Set<Long> truckSet) {
|
||||
|
||||
List<TruckDto> truckDtoList = truckFeign.findAll(new ArrayList<>(truckSet));
|
||||
return truckDtoList.stream()
|
||||
.map(dto -> BeanUtil.toBean(dto, TruckVO.class))
|
||||
.collect(Collectors.toMap(TruckVO::getId, vo -> vo));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车次模型转换
|
||||
*
|
||||
* @param dto 车次DTO
|
||||
* @return 车次VO
|
||||
*/
|
||||
private TransportTripsVO parseTransportTripsDto2Vo(TruckTripsDto dto) {
|
||||
TransportTripsVO vo = BeanUtil.toBean(dto, TransportTripsVO.class);
|
||||
// 增加到达时间
|
||||
vo.setArriveTime((vo.getDepartureTime() + vo.getEstimatedTime()) % 1440);
|
||||
vo.setPeriodName(TruckConstant.TransportTripsPeriod.getEnumByPeriod(dto.getPeriod()) == null ? null : TruckConstant.TransportTripsPeriod.getEnumByPeriod(dto.getPeriod()).getName());
|
||||
//加工数据
|
||||
if (ObjectUtil.isNotEmpty(dto.getTransportLineId())) {
|
||||
TransportLineVO lineById = transportService.findTransportLineById(dto.getTransportLineId());
|
||||
vo.setTransportLine(lineById);
|
||||
|
||||
}
|
||||
Set<Long> userSet = new HashSet<>();
|
||||
Set<Long> truckSet = new HashSet<>();
|
||||
List<TransportTripsTruckDriverDto> transportTripsTruckDriverDtoList = tripsFeign.findAllTruckDriverTransportTrips(dto.getId(), null, null);
|
||||
if (CollUtil.isEmpty(transportTripsTruckDriverDtoList)) {
|
||||
return vo;
|
||||
}
|
||||
|
||||
transportTripsTruckDriverDtoList.forEach(transportTripsTruckDriverDto -> {
|
||||
if (ObjectUtil.isNotEmpty(transportTripsTruckDriverDto.getTruckId())) {
|
||||
truckSet.add(transportTripsTruckDriverDto.getTruckId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(transportTripsTruckDriverDto.getDriverId())) {
|
||||
userSet.add(transportTripsTruckDriverDto.getDriverId());
|
||||
}
|
||||
});
|
||||
Map<Long, TruckVO> truckDtoMap = truckMap(truckSet);
|
||||
Map<Long, DriverVO> driverVOMap = driverMap(userSet);
|
||||
|
||||
List<TruckDriverVO> truckDriverVOList = new ArrayList<>();
|
||||
|
||||
for (TransportTripsTruckDriverDto transportTripsTruckDriverDto : transportTripsTruckDriverDtoList) {
|
||||
TruckDriverVO truckDriverVo = new TruckDriverVO();
|
||||
truckDriverVo.setTruck(truckDtoMap.get(transportTripsTruckDriverDto.getTruckId()));
|
||||
if (ObjectUtil.isNotEmpty(transportTripsTruckDriverDto.getDriverId())) {
|
||||
truckDriverVo.setDriver(driverVOMap.get(transportTripsTruckDriverDto.getDriverId()));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(truckDriverVo.getTruck()) || ObjectUtil.isNotEmpty(truckDriverVo.getDriver())) {
|
||||
truckDriverVOList.add(truckDriverVo);
|
||||
}
|
||||
}
|
||||
|
||||
vo.setTruckDrivers(truckDriverVOList);
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车次模型转换
|
||||
*
|
||||
* @param truckTripsDtoList 车次DTO
|
||||
* @return 车次VO
|
||||
*/
|
||||
private List<TransportTripsVO> parseTransportTripsDto2Vo(List<TruckTripsDto> truckTripsDtoList) {
|
||||
return truckTripsDtoList.stream().map(this::parseTransportTripsDto2Vo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定司机列表
|
||||
*
|
||||
* @param truckId 车辆ID
|
||||
* @return 司机列表
|
||||
*/
|
||||
@Override
|
||||
public List<DriverVO> bindingTrucks(Long truckId) {
|
||||
List<TruckDriverDto> byTruckId = driverFeign.findByTruckId(truckId);
|
||||
List<Long> driverIds = byTruckId.parallelStream().map(TruckDriverDto::getUserId).collect(Collectors.toList());
|
||||
Map<Long, SysUserVO> sysUserVOMap = authService.users(driverIds).parallelStream().collect(Collectors.toMap(SysUserVO::getUserId, v -> v));
|
||||
return batchParseTruckDriverDto2Vo(byTruckId, sysUserVOMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未绑定车辆的司机列表
|
||||
*
|
||||
* @return 司机列表
|
||||
*/
|
||||
@Override
|
||||
public List<DriverVO> unBindingDrivers() {
|
||||
List<TruckDriverDto> truckDriverDtos = driverFeign.findAll(null).stream().filter(v -> ObjectUtil.isEmpty(v.getTruckId()) || ObjectUtil.equal(v.getTruckId(), 0L)).collect(Collectors.toList());
|
||||
List<Long> driverIds = truckDriverDtos.parallelStream().map(TruckDriverDto::getUserId).collect(Collectors.toList());
|
||||
Map<Long, SysUserVO> sysUserVOMap = authService.users(driverIds).parallelStream().collect(Collectors.toMap(SysUserVO::getUserId, v -> v));
|
||||
|
||||
return batchParseTruckDriverDto2Vo(truckDriverDtos, sysUserVOMap).parallelStream()
|
||||
.filter(driverVO -> ObjectUtil.isNotEmpty(driverVO) && ObjectUtil.isNotEmpty(driverVO.getName())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车次
|
||||
*
|
||||
* @param vo 车次信息
|
||||
*/
|
||||
@Override
|
||||
public void saveTrips(TransportTripsUpdateVO vo) {
|
||||
TruckTripsDto dto = BeanUtil.toBean(vo, TruckTripsDto.class);
|
||||
//加工数据
|
||||
dto.setId(null);
|
||||
TruckTripsDto resultDto = tripsFeign.save(dto);
|
||||
BeanUtil.copyProperties(resultDto, vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车次
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @param vo 车次信息
|
||||
*/
|
||||
@Override
|
||||
public void updateTrips(Long id, TransportTripsUpdateVO vo) {
|
||||
vo.setId(id);
|
||||
TruckTripsDto dto = BeanUtil.toBean(vo, TruckTripsDto.class);
|
||||
TruckTripsDto resultDto = tripsFeign.update(id, dto);
|
||||
BeanUtil.copyProperties(resultDto, vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据线路ID获取车次
|
||||
*
|
||||
* @param transportLineId 线路ID
|
||||
* @return 车次列表
|
||||
*/
|
||||
@Override
|
||||
public List<TransportTripsVO> findAllTrips(Long transportLineId) {
|
||||
List<TruckTripsDto> truckTripsDtoList = tripsFeign.findAll(transportLineId, null);
|
||||
if (CollUtil.isEmpty(truckTripsDtoList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return parseTransportTripsDto2Vo(truckTripsDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车次ID获取车次简要信息
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @return 车次信息
|
||||
*/
|
||||
@Override
|
||||
public TransportTripsVO findTripsSimple(Long id) {
|
||||
TruckTripsDto dto = tripsFeign.fineById(id);
|
||||
TransportTripsVO vo = BeanUtil.toBean(dto, TransportTripsVO.class);
|
||||
if (ObjectUtil.isNotEmpty(dto.getTransportLineId())) {
|
||||
TransportLineVO lineById = transportService.findTransportLineById(dto.getTransportLineId());
|
||||
vo.setTransportLine(lineById);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车次ID获取车次
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @return 车次信息
|
||||
*/
|
||||
@Override
|
||||
public TransportTripsVO findTripsDetail(Long id) {
|
||||
TruckTripsDto dto = tripsFeign.fineById(id);
|
||||
return parseTransportTripsDto2Vo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车次
|
||||
* base服务会统一判断原有绑定关系是否能够删除
|
||||
*
|
||||
* @param id 车次ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteTransportLineTrips(Long id) {
|
||||
tripsFeign.disable(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车次-安排车辆 不涉及司机的安排 司机会根据【司机车辆绑定关系】和排班情况调度决定
|
||||
* 修改车次-安排车辆
|
||||
* 解除车次安排 车辆ID列表为空 标识解除所有车次绑定关系
|
||||
*
|
||||
* @param id 车次ID
|
||||
* @param bindingTrucksVO 车次车辆绑定关系
|
||||
*/
|
||||
@Override
|
||||
public void bindingTrucks(Long id, BindingTrucksVO bindingTrucksVO) {
|
||||
List<TransportTripsTruckDriverDto> transportTripsTruckDriverDtos = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(bindingTrucksVO.getTruckIds())) {
|
||||
//保存车辆安排信息
|
||||
transportTripsTruckDriverDtos = bindingTrucksVO.getTruckIds().stream().map(truckId -> {
|
||||
TransportTripsTruckDriverDto dto = new TransportTripsTruckDriverDto();
|
||||
dto.setTruckId(truckId);
|
||||
dto.setTransportTripsId(id);
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
tripsFeign.batchSaveTruckDriver(id, transportTripsTruckDriverDtos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车次-车辆绑定关系
|
||||
*
|
||||
* @param transportTripsId 车次ID
|
||||
* @return 车次-车辆绑定关系
|
||||
*/
|
||||
@Override
|
||||
public List<TruckVO> getTransportTripsTruck(Long transportTripsId) {
|
||||
List<TransportTripsTruckDriverDto> allTruckDriverTransportTrips = tripsFeign.findAllTruckDriverTransportTrips(transportTripsId, null, null);
|
||||
if (CollUtil.isEmpty(allTruckDriverTransportTrips)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<Long> set = allTruckDriverTransportTrips.stream().map(TransportTripsTruckDriverDto::getTruckId).collect(Collectors.toSet());
|
||||
if (CollUtil.isEmpty(set)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return batchParseTruckDto2Vo(truckFeign.findAll(new ArrayList<>(set)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经启用的车辆
|
||||
* 包含反向线路下的车辆和未分配的车辆
|
||||
*
|
||||
* @return 车辆
|
||||
*/
|
||||
@Override
|
||||
public List<TruckVO> workingTrucks(Long startAgentId, Long endAgentId) {
|
||||
List<TransportTripsTruckDriverDto> allTruckDriverTransportTrips = tripsFeign.findAllTruckDriverTransportTrips(null, null, null);
|
||||
Set<Long> truckSet = allTruckDriverTransportTrips.parallelStream().map(TransportTripsTruckDriverDto::getTruckId).collect(Collectors.toSet());
|
||||
|
||||
// 增加反向车辆id
|
||||
Set<Long> backLineTruckSet = new HashSet<>();
|
||||
// 根据开始结束机构id查询反向线路id
|
||||
TransportLineSearchDTO transportLineSearchDTO = new TransportLineSearchDTO();
|
||||
transportLineSearchDTO.setStartOrganId(endAgentId);
|
||||
transportLineSearchDTO.setEndOrganId(startAgentId);
|
||||
PageResponse<TransportLineDTO> transportLineDTOPageResponse = transportLineFeign.queryPageList(transportLineSearchDTO);
|
||||
List<Long> lineIds = transportLineDTOPageResponse.getItems().stream().map(TransportLineDTO::getId).collect(Collectors.toList());
|
||||
|
||||
// 应该只能查询到1条线路 多了 少了 都不是正常情况
|
||||
if (lineIds.size() == 1) {
|
||||
|
||||
// 根据反向线路id查询车次id
|
||||
List<TruckTripsDto> all = tripsFeign.findAll(lineIds.get(0), null);
|
||||
Set<Long> backLineTripIds = all.parallelStream().map(TruckTripsDto::getId).collect(Collectors.toSet());
|
||||
|
||||
// 从所有已经绑定车次中过滤出反向的车次下的线路id
|
||||
backLineTruckSet = allTruckDriverTransportTrips.parallelStream()
|
||||
.filter(v -> backLineTripIds.contains(v.getTransportTripsId()))
|
||||
.map(TransportTripsTruckDriverDto::getTruckId).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
// 从已经绑定的车辆中移除反向线路下的车辆v
|
||||
truckSet.removeAll(backLineTruckSet);
|
||||
|
||||
// 过滤掉除反向线路下车辆id以外的已经绑定的车辆id
|
||||
List<TruckDto> truckDtos = truckFeign.findAll(null).stream().filter(
|
||||
v -> ObjectUtil.isNotEmpty(v.getWorkStatus())
|
||||
&& ObjectUtil.equal(v.getWorkStatus(), TruckWorkStatusEnum.WORKING.getCode())
|
||||
&& !truckSet.contains(v.getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return batchParseTruckDto2Vo(truckDtos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车辆绑定司机 【司机:车辆 = n:1】
|
||||
* 调整车辆绑定司机
|
||||
* 解除车辆绑定司机
|
||||
* 保证事务性
|
||||
* base服务会统一判断原有绑定关系是否能够删除
|
||||
*
|
||||
* @param bindingDriversVO 绑定关系
|
||||
*/
|
||||
@GlobalTransactional
|
||||
@Override
|
||||
public void bindingDrivers(BindingDriversVO bindingDriversVO) {
|
||||
|
||||
// 车辆为空
|
||||
if (ObjectUtil.isEmpty(bindingDriversVO.getTruckId())) {
|
||||
throw new SLWebException("配置失败,车辆为空");
|
||||
}
|
||||
|
||||
// 前置校验
|
||||
checkBingDriverVO(bindingDriversVO);
|
||||
|
||||
// 解除原有绑定关系
|
||||
List<DriverVO> driverVOS = bindingTrucks(bindingDriversVO.getTruckId());
|
||||
driverVOS.forEach(driverVO -> {
|
||||
TruckDriverDto truckDriverDto = BeanUtil.toBean(driverVO, TruckDriverDto.class);
|
||||
truckDriverDto.setTruckId(0L);
|
||||
driverFeign.saveDriver(truckDriverDto);
|
||||
});
|
||||
|
||||
// 循环绑定
|
||||
bindingDriversVO.getDriverIds().forEach(driverId -> {
|
||||
TruckDriverDto driverDto = driverFeign.findOneDriver(driverId);
|
||||
if (driverDto == null) {
|
||||
driverDto = new TruckDriverDto();
|
||||
}
|
||||
driverDto.setUserId(driverId);
|
||||
|
||||
driverDto.setTruckId(bindingDriversVO.getTruckId());
|
||||
driverFeign.saveDriver(driverDto);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经停用的车辆
|
||||
* 没有绑定2个司机的车辆
|
||||
*
|
||||
* @return 车辆
|
||||
*/
|
||||
@Override
|
||||
public List<TruckVO> unWorkingTrucks() {
|
||||
List<TruckDto> truckDtos = truckFeign.findAll(null).stream().filter(
|
||||
v -> ObjectUtil.isNotEmpty(v.getWorkStatus())
|
||||
&& ObjectUtil.equal(v.getWorkStatus(), TruckWorkStatusEnum.STOP.getCode())
|
||||
&& v.getDriverNum() < 2
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
return batchParseTruckDto2Vo(truckDtos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.sl.ms.carriage.appi.CarriageFeign;
|
||||
import com.sl.ms.carriage.domain.dto.CarriageDTO;
|
||||
import com.sl.ms.web.manager.service.CarriageService;
|
||||
import com.sl.ms.web.manager.vo.carriage.CarriageVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运费服务相关实现类
|
||||
*/
|
||||
@Service
|
||||
public class CarriageServiceImpl implements CarriageService {
|
||||
@Resource
|
||||
private CarriageFeign carriageFeign;
|
||||
|
||||
/**
|
||||
* 查询所有运费模板
|
||||
*
|
||||
* @return 运费模板列表
|
||||
*/
|
||||
@Override
|
||||
public List<CarriageVO> findAll() {
|
||||
List<CarriageDTO> dtos = carriageFeign.findAll();
|
||||
return BeanUtil.copyToList(dtos, CarriageVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarriageVO saveOrUpdate(CarriageDTO carriageDto) {
|
||||
CarriageDTO dto = carriageFeign.saveOrUpdate(carriageDto);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
return null;
|
||||
}
|
||||
return BeanUtil.toBean(dto, CarriageVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运费模板
|
||||
*
|
||||
* @param id 运费模板id
|
||||
*/
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
carriageFeign.delete(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,419 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.sl.ms.base.api.common.AreaFeign;
|
||||
import com.sl.ms.base.api.common.GoodsTypeFeign;
|
||||
import com.sl.ms.base.domain.base.AreaDto;
|
||||
import com.sl.ms.base.domain.base.GoodsTypeDto;
|
||||
import com.sl.ms.oms.api.CargoFeign;
|
||||
import com.sl.ms.oms.api.OrderFeign;
|
||||
import com.sl.ms.oms.dto.OrderCargoDTO;
|
||||
import com.sl.ms.oms.dto.OrderDTO;
|
||||
import com.sl.ms.web.manager.service.BaseCommonService;
|
||||
import com.sl.ms.web.manager.service.OmsService;
|
||||
import com.sl.ms.web.manager.service.WorkService;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.GoodsTypeVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderCargoUpdateVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderCargoVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderQueryVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderVO;
|
||||
import com.sl.ms.web.manager.vo.work.TransportOrderPointVO;
|
||||
import com.sl.ms.web.manager.vo.work.TransportOrderVO;
|
||||
import com.sl.ms.work.api.PickupDispatchTaskFeign;
|
||||
import com.sl.ms.work.api.TransportOrderFeign;
|
||||
import com.sl.ms.work.domain.dto.PickupDispatchTaskDTO;
|
||||
import com.sl.ms.work.domain.dto.TransportOrderDTO;
|
||||
import com.sl.ms.work.domain.enums.pickupDispatchtask.PickupDispatchTaskType;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.info.api.TransportInfoFeign;
|
||||
import com.sl.transport.info.domain.TransportInfoDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 订单服务
|
||||
* 对应 订单微服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OmsServiceImpl implements OmsService {
|
||||
|
||||
@Resource
|
||||
private OrderFeign orderFeign;
|
||||
|
||||
@Resource
|
||||
private PickupDispatchTaskFeign pickupDispatchTaskFeign;
|
||||
|
||||
@Resource
|
||||
private AreaFeign areaFeign;
|
||||
|
||||
@Resource
|
||||
private TransportOrderFeign transportOrderFeign;
|
||||
|
||||
@Resource
|
||||
private CargoFeign cargoFeign;
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@Resource
|
||||
private WorkService workService;
|
||||
|
||||
@Resource
|
||||
private GoodsTypeFeign goodsTypeFeign;
|
||||
|
||||
@Resource
|
||||
private TransportInfoFeign transportInfoFeign;
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* 简要订单信息
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @return 订单VO
|
||||
*/
|
||||
@Override
|
||||
public OrderVO findOrderSimple(Long id) {
|
||||
OrderDTO orderDTO = orderFeign.findById(id);
|
||||
if (ObjectUtil.isEmpty(orderDTO)) {
|
||||
return new OrderVO();
|
||||
}
|
||||
return parseOrderDTO2Vo(orderDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询详情
|
||||
* 后台详情页面
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @return 订单VO
|
||||
*/
|
||||
@Override
|
||||
public OrderVO findOrderDetail(Long id) {
|
||||
OrderVO vo = findOrderSimple(id);
|
||||
|
||||
//查询取派件任务信息
|
||||
List<PickupDispatchTaskDTO> pickupTaskDTOS = pickupDispatchTaskFeign.findByOrderId(vo.getId(), PickupDispatchTaskType.PICKUP);
|
||||
//取件信息
|
||||
vo.setTaskPickup(CollUtil.isNotEmpty(pickupTaskDTOS) ? workService.parsePickupDispatchTaskDTO2Vo(pickupTaskDTOS.get(0)) : null);
|
||||
|
||||
List<PickupDispatchTaskDTO> dispatchTaskDTOS = pickupDispatchTaskFeign.findByOrderId(vo.getId(), PickupDispatchTaskType.DISPATCH);
|
||||
//派件信息
|
||||
vo.setTaskDispatch(CollUtil.isNotEmpty(dispatchTaskDTOS) ? workService.parsePickupDispatchTaskDTO2Vo(dispatchTaskDTOS.get(0)) : null);
|
||||
//拒收派件信息
|
||||
vo.setTaskRejectionDispatch(dispatchTaskDTOS.size() > 1 ? workService.parsePickupDispatchTaskDTO2Vo(dispatchTaskDTOS.get(1)) : null);
|
||||
|
||||
if (ObjectUtil.isEmpty(vo.getTransportOrder())) {
|
||||
return vo;
|
||||
}
|
||||
// 运单信息流
|
||||
List<TransportOrderPointVO> tracks = tracks(vo.getTransportOrder().getId());
|
||||
vo.setTransportOrderPointVOS(tracks);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 运单跟踪
|
||||
*
|
||||
* @param id 运单id
|
||||
* @return 运单跟踪信息
|
||||
*/
|
||||
public List<TransportOrderPointVO> tracks(String id) {
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
try {
|
||||
//1.调用transport-info接口,获取相关运单的追踪信息
|
||||
TransportInfoDTO transportInfoDTO = transportInfoFeign.queryByTransportOrderId(id);
|
||||
|
||||
if (ObjectUtil.hasEmpty(transportInfoDTO, transportInfoDTO.getInfoList())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
//2.解析运单追踪信息,封装到vo
|
||||
return transportInfoDTO.getInfoList().stream().map(x -> {
|
||||
TransportOrderPointVO vo = BeanUtil.toBean(x, TransportOrderPointVO.class);
|
||||
vo.setCreated(LocalDateTimeUtil.of(x.getCreated()));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
log.info("没有运单信息 vo {}", id);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 补充运单信息
|
||||
*
|
||||
* @param vo 订单
|
||||
*/
|
||||
private void appendTransportOrder(OrderVO vo) {
|
||||
try {
|
||||
// 补充运单信息
|
||||
TransportOrderDTO transportOrderDTO = transportOrderFeign.findByOrderId(vo.getId());
|
||||
if (ObjectUtil.isNotEmpty(transportOrderDTO)) {
|
||||
TransportOrderVO transportOrderVo = BeanUtil.toBean(transportOrderDTO, TransportOrderVO.class);
|
||||
vo.setTransportOrder(transportOrderVo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("没有运单信息 vo {}", vo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param vo 订单查询VO
|
||||
* @return 订单VO
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<OrderVO> findByPage(OrderQueryVO vo) {
|
||||
log.info("获取订单分页数据:{}", vo);
|
||||
OrderDTO dto = BeanUtil.toBean(vo, OrderDTO.class);
|
||||
PageResponse<OrderDTO> orderPage = orderFeign.findByPage(dto);
|
||||
//加工数据
|
||||
return PageResponse.of(orderPage, this::batchParseOrderDTO2Vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @param vo 订单VO
|
||||
*/
|
||||
@Override
|
||||
public void updateOrder(Long id, OrderVO vo) {
|
||||
orderFeign.updateById(id, parseOrderVo2DTO(vo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取货物列表
|
||||
*
|
||||
* @param tranOrderId 运单id
|
||||
* @param orderId 订单id
|
||||
* @return 货物列表
|
||||
*/
|
||||
@Override
|
||||
public List<OrderCargoVO> findAll(Long tranOrderId, Long orderId) {
|
||||
log.info("Manager --- 获取货物列表");
|
||||
List<OrderCargoDTO> cargoDtoList = cargoFeign.findAll(null, orderId);
|
||||
log.info("Manager --- cargoFeign.findAll result:{}", cargoDtoList);
|
||||
return parseCarGoDTO2VO(cargoDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加货物
|
||||
*
|
||||
* @param vo 货物信息
|
||||
*/
|
||||
@Override
|
||||
public void save(OrderCargoUpdateVO vo) {
|
||||
OrderCargoDTO orderCargoDto = BeanUtil.toBean(vo, OrderCargoDTO.class);
|
||||
orderCargoDto.setId(null);
|
||||
cargoFeign.save(orderCargoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新货物信息
|
||||
*
|
||||
* @param id 货物id
|
||||
* @param vo 货物信息
|
||||
*/
|
||||
@Override
|
||||
public void update(Long id, OrderCargoUpdateVO vo) {
|
||||
vo.setId(id);
|
||||
cargoFeign.update(id, BeanUtil.toBean(vo, OrderCargoDTO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除货物信息
|
||||
*
|
||||
* @param id 货物id
|
||||
*/
|
||||
@Override
|
||||
public void del(Long id) {
|
||||
cargoFeign.del(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 货品转换
|
||||
*
|
||||
* @param cargoDtoList 货品DTO
|
||||
* @return 货品VO
|
||||
*/
|
||||
private List<OrderCargoVO> parseCarGoDTO2VO(List<OrderCargoDTO> cargoDtoList) {
|
||||
return cargoDtoList.stream().map(orderCargoDto -> {
|
||||
OrderCargoVO vo = BeanUtil.toBean(orderCargoDto, OrderCargoVO.class);
|
||||
if (ObjectUtil.isNotEmpty(orderCargoDto.getGoodsTypeId())) {
|
||||
GoodsTypeVO goodsTypeVO = baseCommonService.fineGoodsTypeById(orderCargoDto.getGoodsTypeId());
|
||||
log.info("Manager --- goodsTypeFeign.fineById result:{}", goodsTypeVO);
|
||||
vo.setGoodsType(goodsTypeVO);
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单转换
|
||||
*
|
||||
* @param vo 订单VO
|
||||
* @return 订单DTO
|
||||
*/
|
||||
private OrderDTO parseOrderVo2DTO(OrderVO vo) {
|
||||
OrderDTO dto = BeanUtil.toBean(vo, OrderDTO.class);
|
||||
if (ObjectUtil.isNotEmpty(vo.getSenderProvince())) {
|
||||
dto.setSenderProvinceId(vo.getSenderProvince().getId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(vo.getSenderCity())) {
|
||||
dto.setSenderCityId(vo.getSenderCity().getId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(vo.getSenderCounty())) {
|
||||
dto.setSenderCountyId(vo.getSenderCounty().getId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(vo.getReceiverProvince())) {
|
||||
dto.setReceiverProvinceId(vo.getReceiverProvince().getId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(vo.getReceiverCity())) {
|
||||
dto.setReceiverCityId(vo.getReceiverCity().getId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(vo.getReceiverCounty())) {
|
||||
dto.setReceiverCountyId(vo.getReceiverCounty().getId());
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换订单
|
||||
* 包含订单信息和运单信息
|
||||
*
|
||||
* @param dto 订单DTO
|
||||
* @return 订单VO
|
||||
*/
|
||||
private OrderVO parseOrderDTO2Vo(OrderDTO dto) {
|
||||
OrderVO vo = BeanUtil.toBean(dto, OrderVO.class);
|
||||
if (ObjectUtil.isNotEmpty(vo.getDistance())) {
|
||||
vo.setDistance(vo.getDistance() / 1000);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
List<OrderCargoDTO> cargos = cargoFeign.findAll(null, dto.getId());
|
||||
log.info("货品信息:{}", cargos);
|
||||
List<OrderCargoVO> cargoVOS = cargos.stream()
|
||||
.map(v -> {
|
||||
//组装订单货品信息
|
||||
OrderCargoVO orderCargoVO = BeanUtil.toBean(v, OrderCargoVO.class);
|
||||
|
||||
//查询订单货物相关的物品类型
|
||||
if (ObjectUtil.isNotEmpty(v.getGoodsTypeId())) {
|
||||
GoodsTypeDto goodsTypeDto = goodsTypeFeign.fineById(v.getGoodsTypeId());
|
||||
GoodsTypeVO goodsTypeVO = BeanUtil.toBean(goodsTypeDto, GoodsTypeVO.class);
|
||||
orderCargoVO.setGoodsType(goodsTypeVO);
|
||||
}
|
||||
return orderCargoVO;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
vo.setOrderCargoDTOS(cargoVOS);
|
||||
}
|
||||
|
||||
Set<Long> areaIdSet = new HashSet<>();
|
||||
areaIdSet.add(dto.getReceiverProvinceId());
|
||||
areaIdSet.add(dto.getReceiverCityId());
|
||||
areaIdSet.add(dto.getReceiverCountyId());
|
||||
areaIdSet.add(dto.getSenderProvinceId());
|
||||
areaIdSet.add(dto.getSenderCityId());
|
||||
areaIdSet.add(dto.getSenderCountyId());
|
||||
|
||||
List<AreaDto> areaDtoList = areaFeign.findBatch(new ArrayList<>(areaIdSet));
|
||||
Map<Long, AreaDto> areaMap = areaDtoList.stream().collect(Collectors.toMap(AreaDto::getId, v -> v));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(dto.getSenderProvinceId())) {
|
||||
AreaDto result = areaMap.get(dto.getSenderProvinceId());
|
||||
|
||||
vo.setSenderProvince(baseCommonService.parseArea2Vo(result));
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getSenderCityId())) {
|
||||
AreaDto result = areaMap.get(dto.getSenderCityId());
|
||||
vo.setSenderCity(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getSenderCountyId())) {
|
||||
AreaDto result = areaMap.get(dto.getSenderCountyId());
|
||||
vo.setSenderCounty(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getReceiverProvinceId())) {
|
||||
AreaDto result = areaMap.get(dto.getReceiverProvinceId());
|
||||
vo.setReceiverProvince(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getReceiverCityId())) {
|
||||
AreaDto result = areaMap.get(dto.getReceiverCityId());
|
||||
vo.setReceiverCity(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getReceiverCountyId())) {
|
||||
AreaDto result = areaMap.get(dto.getReceiverCountyId());
|
||||
vo.setReceiverCounty(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
// 运单ID
|
||||
appendTransportOrder(vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderVO> batchParseOrderDTO2Vo(List<OrderDTO> orderDTOList) {
|
||||
if (CollUtil.isEmpty(orderDTOList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<Long> areaIdSet = new HashSet<>();
|
||||
orderDTOList.parallelStream().forEach(v -> {
|
||||
areaIdSet.add(v.getReceiverProvinceId());
|
||||
areaIdSet.add(v.getReceiverCityId());
|
||||
areaIdSet.add(v.getReceiverCountyId());
|
||||
areaIdSet.add(v.getSenderProvinceId());
|
||||
areaIdSet.add(v.getSenderCityId());
|
||||
areaIdSet.add(v.getSenderCountyId());
|
||||
});
|
||||
List<AreaDto> areaDtoList = areaFeign.findBatch(new ArrayList<>(areaIdSet));
|
||||
Map<Long, AreaDto> areaMap = areaDtoList.stream().collect(Collectors.toMap(AreaDto::getId, vo -> vo));
|
||||
|
||||
Map<Long, String> transportOrderIdMap = transportOrderFeign.findByOrderIds(orderDTOList.parallelStream().map(OrderDTO::getId).collect(Collectors.toList()).toArray(Long[]::new)).parallelStream().collect(Collectors.toMap(TransportOrderDTO::getOrderId, TransportOrderDTO::getId));
|
||||
return orderDTOList.parallelStream().map(dto -> {
|
||||
OrderVO vo = BeanUtil.toBean(dto, OrderVO.class);
|
||||
if (ObjectUtil.isNotEmpty(dto.getSenderProvinceId())) {
|
||||
AreaDto result = areaMap.get(dto.getSenderProvinceId());
|
||||
|
||||
vo.setSenderProvince(baseCommonService.parseArea2Vo(result));
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getSenderCityId())) {
|
||||
AreaDto result = areaMap.get(dto.getSenderCityId());
|
||||
vo.setSenderCity(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getSenderCountyId())) {
|
||||
AreaDto result = areaMap.get(dto.getSenderCountyId());
|
||||
vo.setSenderCounty(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getReceiverProvinceId())) {
|
||||
AreaDto result = areaMap.get(dto.getReceiverProvinceId());
|
||||
vo.setReceiverProvince(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getReceiverCityId())) {
|
||||
AreaDto result = areaMap.get(dto.getReceiverCityId());
|
||||
vo.setReceiverCity(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getReceiverCountyId())) {
|
||||
AreaDto result = areaMap.get(dto.getReceiverCountyId());
|
||||
vo.setReceiverCounty(baseCommonService.parseArea2Vo(result));
|
||||
}
|
||||
// 运单ID
|
||||
TransportOrderVO transportOrderVO = new TransportOrderVO();
|
||||
transportOrderVO.setId(transportOrderIdMap.get(vo.getId()));
|
||||
vo.setTransportOrder(transportOrderVO);
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.sl.ms.base.api.trips.TripsFeign;
|
||||
import com.sl.ms.base.domain.truck.TruckTripsDto;
|
||||
import com.sl.ms.transport.api.CostConfigurationFeign;
|
||||
import com.sl.ms.transport.api.DispatchConfigurationFeign;
|
||||
import com.sl.ms.transport.api.TransportLineFeign;
|
||||
import com.sl.ms.web.manager.service.TransportService;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineQueryVO;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import com.sl.ms.web.manager.vo.work.CostConfigurationVO;
|
||||
import com.sl.ms.web.manager.vo.work.DispatchConfigurationVO;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.domain.CostConfigurationDTO;
|
||||
import com.sl.transport.domain.DispatchConfigurationDTO;
|
||||
import com.sl.transport.domain.TransportLineDTO;
|
||||
import com.sl.transport.domain.TransportLineSearchDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 线路服务
|
||||
* 对应线路微服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TransportServiceImpl implements TransportService {
|
||||
|
||||
@Resource
|
||||
TransportLineFeign transportLineFeign;
|
||||
|
||||
@Resource
|
||||
private TripsFeign tripsFeign;
|
||||
|
||||
@Resource
|
||||
private DispatchConfigurationFeign dispatchConfigurationFeign;
|
||||
|
||||
@Resource
|
||||
private CostConfigurationFeign costConfigurationFeign;
|
||||
|
||||
/**
|
||||
* 新增线路
|
||||
*
|
||||
* @param vo 线路信息
|
||||
*/
|
||||
@Override
|
||||
public void saveTransportLine(TransportLineVO vo) {
|
||||
TransportLineDTO dto = BeanUtil.toBean(vo, TransportLineDTO.class);
|
||||
transportLineFeign.createLine(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新线路
|
||||
*
|
||||
* @param id 线路ID
|
||||
* @param vo 线路信息
|
||||
*/
|
||||
@Override
|
||||
public void updateTransportLine(Long id, TransportLineVO vo) {
|
||||
TransportLineDTO dto = BeanUtil.toBean(vo, TransportLineDTO.class);
|
||||
dto.setId(id);
|
||||
dto.setDistance(ObjectUtil.isNotEmpty(dto.getDistance()) ? dto.getDistance() * 1000 : 0L);
|
||||
transportLineFeign.updateLine(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线路分页
|
||||
*
|
||||
* @param transportLineQueryVO 查询条件
|
||||
* @return 线路列表
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<TransportLineVO> findTransportLineByPage(TransportLineQueryVO transportLineQueryVO) {
|
||||
PageResponse<TransportLineDTO> transportLineDtoPage = transportLineFeign.queryPageList(BeanUtil.toBean(transportLineQueryVO, TransportLineSearchDTO.class));
|
||||
//加工数据
|
||||
return PageResponse.of(transportLineDtoPage, this::parseTransportLineDto2VO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线路详情
|
||||
*
|
||||
* @param id 线路ID
|
||||
* @return 线路信息
|
||||
*/
|
||||
@Override
|
||||
public TransportLineVO findTransportLineById(Long id) {
|
||||
TransportLineDTO dto = transportLineFeign.queryById(id);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
return new TransportLineVO();
|
||||
}
|
||||
return parseTransportLineDto2VO(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线路详情
|
||||
*
|
||||
* @param ids 线路IDs
|
||||
* @return 线路信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<TransportLineVO> findTransportLineByIds(List<Long> ids) {
|
||||
List<TransportLineDTO> transportLineDTOS = transportLineFeign.queryByIds(ids.toArray(Long[]::new));
|
||||
return parseTransportLineDto2VO(transportLineDTOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除线路
|
||||
* 检查是否有车次
|
||||
*
|
||||
* @param id 线路ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteTransportLine(Long id) {
|
||||
// 判断线路
|
||||
List<TruckTripsDto> tripsDTOS = tripsFeign.findAll(id, null);
|
||||
if (ObjectUtil.isNotEmpty(tripsDTOS)) {
|
||||
throw new SLWebException("请先删除线路下车次");
|
||||
}
|
||||
transportLineFeign.deleteLine(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线路转换
|
||||
*
|
||||
* @param transportLineDtoList 线路DTO
|
||||
* @return 线路VO
|
||||
*/
|
||||
private List<TransportLineVO> parseTransportLineDto2VO(List<TransportLineDTO> transportLineDtoList) {
|
||||
return transportLineDtoList.stream().map(dto -> {
|
||||
dto.setDistance(ObjectUtil.isNotEmpty(dto.getDistance()) ? dto.getDistance() / 1000 : 0L);
|
||||
dto.setTime(ObjectUtil.isNotEmpty(dto.getTime()) ? dto.getTime() / 60 : 0L);
|
||||
return BeanUtil.toBean(dto, TransportLineVO.class);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 线路转换
|
||||
*
|
||||
* @param dto 线路DTO
|
||||
* @return 线路VO
|
||||
*/
|
||||
private TransportLineVO parseTransportLineDto2VO(TransportLineDTO dto) {
|
||||
dto.setDistance(ObjectUtil.isNotEmpty(dto.getDistance()) ? dto.getDistance() / 1000 : 0L);
|
||||
dto.setTime(ObjectUtil.isNotEmpty(dto.getTime()) ? dto.getTime() / 60 : 0L);
|
||||
return BeanUtil.toBean(dto, TransportLineVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存调度配置
|
||||
* @param vo 调度配置
|
||||
*/
|
||||
@Override
|
||||
public void saveConfiguration(DispatchConfigurationVO vo) {
|
||||
DispatchConfigurationDTO dispatchConfigurationDTO = BeanUtil.toBean(vo, DispatchConfigurationDTO.class);
|
||||
dispatchConfigurationFeign.saveConfiguration(dispatchConfigurationDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询调度配置
|
||||
* @return 调度配置
|
||||
*/
|
||||
@Override
|
||||
public DispatchConfigurationVO findConfiguration() {
|
||||
DispatchConfigurationDTO configuration = dispatchConfigurationFeign.findConfiguration();
|
||||
return BeanUtil.toBean(configuration, DispatchConfigurationVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存成本配置
|
||||
* @param vo 配置信息
|
||||
*/
|
||||
@Override
|
||||
public void saveCostConfiguration(List<CostConfigurationVO> vo) {
|
||||
List<CostConfigurationDTO> costConfigurationDTO = BeanUtil.copyToList(vo, CostConfigurationDTO.class);
|
||||
costConfigurationFeign.saveConfiguration(costConfigurationDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询成本配置
|
||||
* @return 配置信息
|
||||
*/
|
||||
@Override
|
||||
public List<CostConfigurationVO> findCostConfiguration() {
|
||||
List<CostConfigurationDTO> configuration = costConfigurationFeign.findConfiguration();
|
||||
return BeanUtil.copyToList(configuration, CostConfigurationVO.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.itheima.auth.sdk.common.Result;
|
||||
import com.itheima.auth.sdk.dto.UserDTO;
|
||||
import com.sl.ms.base.api.truck.TruckFeign;
|
||||
import com.sl.ms.base.api.truck.TruckReturnRegisterFeign;
|
||||
import com.sl.ms.base.domain.truck.TruckDto;
|
||||
import com.sl.ms.base.domain.truck.TruckReturnRegisterDTO;
|
||||
import com.sl.ms.base.domain.truck.TruckReturnRegisterListDTO;
|
||||
import com.sl.ms.base.domain.truck.TruckReturnRegisterPageQueryDTO;
|
||||
import com.sl.ms.driver.api.DriverJobFeign;
|
||||
import com.sl.ms.driver.domain.dto.request.DriverJobPageQueryDTO;
|
||||
import com.sl.ms.driver.domain.dto.response.DriverJobDTO;
|
||||
import com.sl.ms.transport.api.OrganFeign;
|
||||
import com.sl.ms.web.manager.service.TruckReturnRegisterService;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterListVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterPageQueryVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckReturnRegisterVO;
|
||||
import com.sl.ms.work.api.TransportTaskFeign;
|
||||
import com.sl.ms.work.domain.dto.TransportTaskDTO;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import com.sl.transport.common.util.AuthTemplateThreadLocal;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.domain.OrganDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TruckReturnRegisterServiceImpl implements TruckReturnRegisterService {
|
||||
@Resource
|
||||
private TransportTaskFeign transportTaskFeign;
|
||||
@Resource
|
||||
private TruckReturnRegisterFeign truckReturnRegisterFeign;
|
||||
@Resource
|
||||
private OrganFeign organFeign;
|
||||
@Resource
|
||||
private TruckFeign truckFeign;
|
||||
@Resource
|
||||
private DriverJobFeign driverJobFeign;
|
||||
|
||||
/**
|
||||
* 分页查询回车登记列表
|
||||
*
|
||||
* @param vo 回车登记分页查询条件
|
||||
* @return 回车登记分页结果
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<TruckReturnRegisterListVO> pageQuery(TruckReturnRegisterPageQueryVO vo) {
|
||||
// 1.根据起止机构id查询运输任务
|
||||
List<Long> transportTaskIds = null;
|
||||
if (!ObjectUtil.isAllEmpty(vo.getStartAgencyId(), vo.getEndAgencyId())) {
|
||||
transportTaskIds = transportTaskFeign.findByAgencyId(vo.getStartAgencyId(), vo.getEndAgencyId());
|
||||
|
||||
//进入到根据机构查询,并且查询结果为空,最终结果即为空
|
||||
if (CollUtil.isEmpty(transportTaskIds)) {
|
||||
return new PageResponse<>();
|
||||
}
|
||||
}
|
||||
|
||||
// 2.构造查询条件
|
||||
TruckReturnRegisterPageQueryDTO truckReturnRegisterPageQueryDTO = BeanUtil.toBean(vo, TruckReturnRegisterPageQueryDTO.class);
|
||||
truckReturnRegisterPageQueryDTO.setTransportTaskIds(transportTaskIds);
|
||||
|
||||
// 3.分页查询
|
||||
PageResponse<TruckReturnRegisterListDTO> pageResponse = truckReturnRegisterFeign.pageQuery(truckReturnRegisterPageQueryDTO);
|
||||
if (ObjectUtil.isEmpty(pageResponse.getItems())) {
|
||||
return new PageResponse<>();
|
||||
}
|
||||
|
||||
// 4.封装结果(补充起止机构信息)
|
||||
List<TruckReturnRegisterListVO> list = convertListDto2ListVo(pageResponse.getItems());
|
||||
|
||||
// 5.返回分页结果
|
||||
return PageResponse.<TruckReturnRegisterListVO>builder()
|
||||
.page(pageResponse.getPage())
|
||||
.pageSize(pageResponse.getPageSize())
|
||||
.pages(pageResponse.getPages())
|
||||
.counts(pageResponse.getCounts())
|
||||
.items(list)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表dto转为vo(补充起止机构信息)
|
||||
*
|
||||
* @param dtoList 分页列表dto
|
||||
* @return 分页列表vo
|
||||
*/
|
||||
private List<TruckReturnRegisterListVO> convertListDto2ListVo(List<TruckReturnRegisterListDTO> dtoList) {
|
||||
return dtoList.stream().map(dto -> {
|
||||
TruckReturnRegisterListVO truckReturnRegisterListVO = BeanUtil.toBean(dto, TruckReturnRegisterListVO.class);
|
||||
|
||||
//根据id查询运输任务
|
||||
TransportTaskDTO transportTaskDTO;
|
||||
try {
|
||||
transportTaskDTO = transportTaskFeign.findById(truckReturnRegisterListVO.getTransportTaskId());
|
||||
} catch (Exception e) {
|
||||
throw new SLWebException("id为" + truckReturnRegisterListVO.getTransportTaskId() + "的运输任务查询失败!");
|
||||
}
|
||||
|
||||
//根据id查询机构
|
||||
OrganDTO startAgency = organFeign.queryById(transportTaskDTO.getStartAgencyId());
|
||||
OrganDTO endAgency = organFeign.queryById(transportTaskDTO.getEndAgencyId());
|
||||
|
||||
// 封装机构和运单数量数据
|
||||
truckReturnRegisterListVO.setStartAgencyId(transportTaskDTO.getStartAgencyId());
|
||||
truckReturnRegisterListVO.setStartAgencyName(startAgency.getName());
|
||||
truckReturnRegisterListVO.setEndAgencyId(transportTaskDTO.getEndAgencyId());
|
||||
truckReturnRegisterListVO.setEndAgencyName(endAgency.getName());
|
||||
truckReturnRegisterListVO.setTransportOrderNumber(transportTaskDTO.getTransportOrderCount());
|
||||
return truckReturnRegisterListVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 回车登记详情
|
||||
*
|
||||
* @param id 回车登记id
|
||||
* @return 回车登记详情
|
||||
*/
|
||||
@Override
|
||||
public TruckReturnRegisterVO detail(Long id) {
|
||||
//回车登记信息
|
||||
TruckReturnRegisterDTO truckReturnRegisterDTO = truckReturnRegisterFeign.findById(id);
|
||||
//车辆信息
|
||||
TruckDto truckDto = truckFeign.fineById(truckReturnRegisterDTO.getTruckId());
|
||||
//运输任务信息
|
||||
TransportTaskDTO transportTaskDTO = transportTaskFeign.findById(truckReturnRegisterDTO.getTransportTaskId());
|
||||
//起止机构信息
|
||||
OrganDTO startAgency = organFeign.queryById(transportTaskDTO.getStartAgencyId());
|
||||
OrganDTO endAgency = organFeign.queryById(transportTaskDTO.getEndAgencyId());
|
||||
|
||||
//根据运输任务id查询关联的司机作业单
|
||||
DriverJobPageQueryDTO driverJobPageQueryDTO = DriverJobPageQueryDTO.builder().page(1).pageSize(10).transportTaskId(transportTaskDTO.getId()).build();
|
||||
PageResponse<DriverJobDTO> driverJobPage = driverJobFeign.pageQuery(driverJobPageQueryDTO);
|
||||
List<Long> driverIds = CollUtil.getFieldValues(driverJobPage.getItems(), "driverId", Long.class);
|
||||
|
||||
//根据司机id获取司机姓名
|
||||
List<String> driverNameList = driverIds.stream().map(driverId -> {
|
||||
Result<UserDTO> result = AuthTemplateThreadLocal.get().opsForUser().getUserById(driverId);
|
||||
return result.getData().getName();
|
||||
}).collect(Collectors.toList());
|
||||
String driverNameStr = CharSequenceUtil.join("、", driverNameList);
|
||||
|
||||
//组装回车登记详情
|
||||
TruckReturnRegisterVO truckReturnRegisterVO = BeanUtil.toBean(truckReturnRegisterDTO, TruckReturnRegisterVO.class);
|
||||
truckReturnRegisterVO.setId(id);
|
||||
truckReturnRegisterVO.setLicensePlate(truckDto.getLicensePlate());
|
||||
truckReturnRegisterVO.setStartAgencyId(transportTaskDTO.getStartAgencyId());
|
||||
truckReturnRegisterVO.setStartAgencyName(startAgency.getName());
|
||||
truckReturnRegisterVO.setEndAgencyId(transportTaskDTO.getEndAgencyId());
|
||||
truckReturnRegisterVO.setEndAgencyName(endAgency.getName());
|
||||
truckReturnRegisterVO.setDriverIds(driverIds);
|
||||
truckReturnRegisterVO.setDriverName(driverNameStr);
|
||||
return truckReturnRegisterVO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,621 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.itheima.auth.sdk.common.Result;
|
||||
import com.itheima.auth.sdk.dto.UserDTO;
|
||||
import com.sl.ms.base.api.trips.TripsFeign;
|
||||
import com.sl.ms.base.api.truck.TruckFeign;
|
||||
import com.sl.ms.base.api.truck.TruckPlanFeign;
|
||||
import com.sl.ms.base.api.user.DriverFeign;
|
||||
import com.sl.ms.base.domain.enums.StatusEnum;
|
||||
import com.sl.ms.base.domain.truck.TruckDto;
|
||||
import com.sl.ms.base.domain.truck.TruckTripsDto;
|
||||
import com.sl.ms.base.domain.user.TruckDriverDto;
|
||||
import com.sl.ms.driver.api.DriverJobFeign;
|
||||
import com.sl.ms.driver.domain.dto.request.DriverJobPageQueryDTO;
|
||||
import com.sl.ms.driver.domain.dto.response.DriverJobDTO;
|
||||
import com.sl.ms.driver.domain.enums.DriverJobStatus;
|
||||
import com.sl.ms.oms.api.OrderFeign;
|
||||
import com.sl.ms.oms.dto.OrderDTO;
|
||||
import com.sl.ms.track.api.TrackFeign;
|
||||
import com.sl.ms.track.domain.dto.TrackDTO;
|
||||
import com.sl.ms.track.domain.enums.TrackStatusEnum;
|
||||
import com.sl.ms.transport.api.OrganFeign;
|
||||
import com.sl.ms.web.manager.service.*;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencyVO;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TransportTripsVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderVO;
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import com.sl.ms.web.manager.vo.work.*;
|
||||
import com.sl.ms.work.api.PickupDispatchTaskFeign;
|
||||
import com.sl.ms.work.api.TransportOrderFeign;
|
||||
import com.sl.ms.work.api.TransportTaskFeign;
|
||||
import com.sl.ms.work.domain.dto.PickupDispatchTaskDTO;
|
||||
import com.sl.ms.work.domain.dto.TaskTransportUpdateDTO;
|
||||
import com.sl.ms.work.domain.dto.TransportOrderDTO;
|
||||
import com.sl.ms.work.domain.dto.TransportTaskDTO;
|
||||
import com.sl.ms.work.domain.dto.request.PickupDispatchTaskPageQueryDTO;
|
||||
import com.sl.ms.work.domain.dto.request.TransportOrderQueryDTO;
|
||||
import com.sl.ms.work.domain.dto.request.TransportTaskPageQueryDTO;
|
||||
import com.sl.ms.work.domain.dto.response.TransportOrderStatusCountDTO;
|
||||
import com.sl.ms.work.domain.dto.response.TransportTaskStatusCountDTO;
|
||||
import com.sl.ms.work.domain.enums.transporttask.TransportTaskLoadingStatus;
|
||||
import com.sl.ms.work.domain.enums.transporttask.TransportTaskStatus;
|
||||
import com.sl.transport.common.exception.SLWebException;
|
||||
import com.sl.transport.common.util.AuthTemplateThreadLocal;
|
||||
import com.sl.transport.common.util.PageResponse;
|
||||
import com.sl.transport.domain.OrganDTO;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 调度管理
|
||||
* 运单,运输任务管理
|
||||
* 对应 work微服务
|
||||
*
|
||||
* @author itcast
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WorkServiceImpl implements WorkService {
|
||||
|
||||
@Resource
|
||||
private PickupDispatchTaskFeign pickupDispatchTaskFeign;
|
||||
|
||||
@Resource
|
||||
private TransportOrderFeign transportOrderFeign;
|
||||
|
||||
@Resource
|
||||
private TransportTaskFeign transportTaskFeign;
|
||||
|
||||
@Resource
|
||||
private OmsService omsService;
|
||||
|
||||
@Resource
|
||||
private AgencyService agencyService;
|
||||
|
||||
@Resource
|
||||
private BaseTruckService baseTruckService;
|
||||
|
||||
@Resource
|
||||
private AuthService authService;
|
||||
|
||||
@Resource
|
||||
private OrganFeign organFeign;
|
||||
|
||||
@Resource
|
||||
private OrderFeign orderFeign;
|
||||
|
||||
@Resource
|
||||
private DriverJobFeign driverJobFeign;
|
||||
|
||||
@Resource
|
||||
private DriverFeign driverFeign;
|
||||
|
||||
@Resource
|
||||
private TruckFeign truckFeign;
|
||||
|
||||
@Resource
|
||||
private TripsFeign tripsFeign;
|
||||
|
||||
@Resource
|
||||
private TransportService transportService;
|
||||
|
||||
@Resource
|
||||
private TrackFeign trackFeign;
|
||||
|
||||
@Resource
|
||||
private TruckPlanFeign truckPlanFeign;
|
||||
|
||||
/**
|
||||
* 运单分页
|
||||
*
|
||||
* @param vo 运单查询条件
|
||||
* @return 运单分页
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<TransportOrderVO> findTransportOrderByPage(TransportOrderQueryVO vo) {
|
||||
TransportOrderQueryDTO transportOrderDTO = BeanUtil.toBean(vo, TransportOrderQueryDTO.class);
|
||||
PageResponse<TransportOrderDTO> dtoPageResponse = transportOrderFeign.findByPage(transportOrderDTO);
|
||||
return PageResponse.of(dtoPageResponse, this::batchParseTransportOrderDTO2Vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运单批量转换
|
||||
*
|
||||
* @param dtoList 运单DTO
|
||||
* @return 运单VO
|
||||
*/
|
||||
private List<TransportOrderVO> batchParseTransportOrderDTO2Vo(List<TransportOrderDTO> dtoList) {
|
||||
if (CollUtil.isEmpty(dtoList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 机构
|
||||
List<Long> agentIds = dtoList.parallelStream().map(TransportOrderDTO::getStartAgencyId).distinct().collect(Collectors.toList());
|
||||
List<Long> endAgentIds = dtoList.parallelStream().map(TransportOrderDTO::getEndAgencyId).distinct().collect(Collectors.toList());
|
||||
agentIds.addAll(endAgentIds);
|
||||
List<Long> currentAgentIds = dtoList.parallelStream().map(TransportOrderDTO::getCurrentAgencyId).distinct().collect(Collectors.toList());
|
||||
agentIds.addAll(currentAgentIds);
|
||||
List<Long> nextAgencyIds = dtoList.parallelStream().map(TransportOrderDTO::getNextAgencyId).distinct().collect(Collectors.toList());
|
||||
agentIds.addAll(nextAgencyIds);
|
||||
Map<Long, AgencySimpleVO> agencySimpleVOMap = agencyService.batchAgencySimple(agentIds).stream().collect(Collectors.toMap(AgencySimpleVO::getId, v -> v));
|
||||
|
||||
return dtoList.stream().map(dto -> {
|
||||
TransportOrderVO vo = BeanUtil.toBean(dto, TransportOrderVO.class);
|
||||
vo.setStatus(dto.getStatus().getCode());
|
||||
vo.setSchedulingStatus(dto.getSchedulingStatus().getCode());
|
||||
if (ObjectUtil.isEmpty(dto.getOrderId())) {
|
||||
return vo;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(dto.getCurrentAgencyId())) {
|
||||
return vo;
|
||||
}
|
||||
AgencySimpleVO agency = agencySimpleVOMap.get(dto.getCurrentAgencyId());
|
||||
if (ObjectUtil.isEmpty(agency)) {
|
||||
return vo;
|
||||
}
|
||||
vo.setCurrentAgencyName(agency.getName());
|
||||
AgencySimpleVO startAgent = agencySimpleVOMap.get(dto.getStartAgencyId());
|
||||
if (ObjectUtil.isEmpty(startAgent)) {
|
||||
return vo;
|
||||
}
|
||||
vo.setStartAgencyName(startAgent.getName());
|
||||
|
||||
AgencySimpleVO endAgent = agencySimpleVOMap.get(dto.getEndAgencyId());
|
||||
if (ObjectUtil.isEmpty(endAgent)) {
|
||||
return vo;
|
||||
}
|
||||
vo.setEndAgencyName(endAgent.getName());
|
||||
|
||||
AgencySimpleVO nextAgent = agencySimpleVOMap.get(dto.getNextAgencyId());
|
||||
if (ObjectUtil.isEmpty(nextAgent)) {
|
||||
return vo;
|
||||
}
|
||||
vo.setNextAgencyName(nextAgent.getName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 运输任务批量转换
|
||||
*
|
||||
* @param dtoList 运输任务DTO
|
||||
* @return 运维任务VO
|
||||
*/
|
||||
private List<TaskTransportVO> batchParseTransportTaskDTO2Vo(List<TransportTaskDTO> dtoList) {
|
||||
if (CollUtil.isEmpty(dtoList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 车次map
|
||||
List<Long> tripsIds = dtoList.parallelStream().map(TransportTaskDTO::getTransportTripsId).distinct().collect(Collectors.toList());
|
||||
List<TruckTripsDto> tripsDtoList = tripsFeign.findAll(null, tripsIds);
|
||||
Map<Long, TruckTripsDto> transportTripsDTOMap = tripsDtoList.parallelStream().collect(Collectors.toMap(TruckTripsDto::getId, v -> v));
|
||||
|
||||
// 线路map
|
||||
List<Long> lineIds = tripsDtoList.parallelStream().distinct().map(TruckTripsDto::getTransportLineId).distinct().collect(Collectors.toList());
|
||||
Map<Long, TransportLineVO> transportLineVOMap = new HashMap<>();
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
transportLineVOMap = transportService.findTransportLineByIds(lineIds).parallelStream().collect(Collectors.toMap(TransportLineVO::getId, v -> v));
|
||||
}
|
||||
|
||||
// 机构
|
||||
List<Long> startAgentIds = dtoList.parallelStream().map(TransportTaskDTO::getStartAgencyId).distinct().collect(Collectors.toList());
|
||||
List<Long> endAgentIds = dtoList.parallelStream().map(TransportTaskDTO::getEndAgencyId).distinct().collect(Collectors.toList());
|
||||
startAgentIds.addAll(endAgentIds);
|
||||
Map<Long, AgencySimpleVO> agencySimpleVOMap = agencyService.batchAgencySimple(startAgentIds).stream().collect(Collectors.toMap(AgencySimpleVO::getId, v -> v));
|
||||
|
||||
// 车辆
|
||||
Set<Long> truckIds = dtoList.parallelStream().map(TransportTaskDTO::getTruckId).collect(Collectors.toSet());
|
||||
Map<Long, TruckVO> truckVOMap = baseTruckService.truckMap(truckIds);
|
||||
|
||||
Map<Long, TransportLineVO> finalTransportLineVOMap = transportLineVOMap;
|
||||
return dtoList.stream().map(dto -> {
|
||||
TaskTransportVO vo = BeanUtil.toBean(dto, TaskTransportVO.class);
|
||||
vo.setStatus(dto.getStatus().getCode());
|
||||
vo.setAssignedStatus(dto.getAssignedStatus().getCode());
|
||||
vo.setLoadingStatus(dto.getLoadingStatus().getCode());
|
||||
// 车次 线路
|
||||
if (ObjectUtil.isNotEmpty(dto.getTransportTripsId())) {
|
||||
TruckTripsDto tripsById = transportTripsDTOMap.get(dto.getTransportTripsId());
|
||||
if (ObjectUtil.isNotEmpty(tripsById)) {
|
||||
TransportTripsVO transportTripsVO = BeanUtil.toBean(tripsById, TransportTripsVO.class);
|
||||
vo.setTransportTrips(transportTripsVO);
|
||||
|
||||
// 线路
|
||||
TransportLineVO transportLineVO = finalTransportLineVOMap.get(tripsById.getTransportLineId());
|
||||
if (ObjectUtil.isNotEmpty(transportLineVO)) {
|
||||
vo.setTransportLineName(transportLineVO.getName());
|
||||
vo.setTransportLineId(transportLineVO.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 机构
|
||||
if (ObjectUtil.isNotEmpty(dto.getStartAgencyId())) {
|
||||
AgencySimpleVO agencySimpleVO = agencySimpleVOMap.get(dto.getStartAgencyId());
|
||||
vo.setStartAgency(agencySimpleVO);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getEndAgencyId())) {
|
||||
AgencySimpleVO agencySimpleVO = agencySimpleVOMap.get(dto.getEndAgencyId());
|
||||
vo.setEndAgency(agencySimpleVO);
|
||||
}
|
||||
|
||||
// 车辆
|
||||
if (ObjectUtil.isNotEmpty(dto.getTruckId())) {
|
||||
TruckVO truckById = truckVOMap.get(dto.getTruckId());
|
||||
if (ObjectUtil.isNotEmpty(truckById)) {
|
||||
vo.setTruck(truckById);
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询运单
|
||||
*
|
||||
* @param transportOrderIds 运单IDs
|
||||
* @return 运单列表
|
||||
*/
|
||||
private List<TransportOrderVO> batchGetTransportOrder(List<String> transportOrderIds) {
|
||||
List<TransportOrderDTO> transportOrderVOList = transportOrderFeign.findByIds(transportOrderIds.toArray(String[]::new));
|
||||
List<OrderDTO> orderDTOS = orderFeign.findByIds(transportOrderVOList.stream().map(v -> v.getOrderId().toString()).distinct().collect(Collectors.toList()));
|
||||
List<OrderVO> orderVOS = omsService.batchParseOrderDTO2Vo(orderDTOS);
|
||||
Map<Long, OrderVO> orderVOMap = orderVOS.stream().collect(Collectors.toMap(OrderVO::getId, v -> v));
|
||||
return transportOrderVOList.parallelStream().map(v -> {
|
||||
TransportOrderVO vo = BeanUtil.toBean(v, TransportOrderVO.class);
|
||||
vo.setOrder(orderVOMap.get(v.getOrderId()));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 运单简要信息
|
||||
*
|
||||
* @param id 运单ID
|
||||
* @return 运单详情
|
||||
*/
|
||||
@Override
|
||||
public TransportOrderVO findTransportOrderSimple(String id) {
|
||||
TransportOrderDTO dto = transportOrderFeign.findById(id);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
return null;
|
||||
}
|
||||
return parseTransportOrderDTO2Vo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运单详情页面
|
||||
*
|
||||
* @param id 运单ID
|
||||
* @return 运单详情
|
||||
*/
|
||||
@Override
|
||||
public TransportOrderVO findTransportOrderDetail(String id) {
|
||||
TransportOrderVO vo = findTransportOrderSimple(id);
|
||||
appendTransportOrderVO(vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<Integer, Long> countTransportOrder() {
|
||||
return transportOrderFeign.findStatusCount().stream().collect(Collectors.toMap(TransportOrderStatusCountDTO::getStatusCode, TransportOrderStatusCountDTO::getCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换运单
|
||||
* 运单列表页面 和 详情页面
|
||||
*
|
||||
* @param dto 运单DTO
|
||||
* @return 运单VO
|
||||
*/
|
||||
private TransportOrderVO parseTransportOrderDTO2Vo(TransportOrderDTO dto) {
|
||||
TransportOrderVO vo = BeanUtil.toBean(dto, TransportOrderVO.class);
|
||||
vo.setStatus(dto.getStatus().getCode());
|
||||
vo.setSchedulingStatus(dto.getSchedulingStatus().getCode());
|
||||
if (ObjectUtil.isEmpty(dto.getOrderId())) {
|
||||
return vo;
|
||||
}
|
||||
OrderVO orderById = omsService.findOrderSimple(dto.getOrderId());
|
||||
vo.setOrder(orderById);
|
||||
|
||||
if (ObjectUtil.isEmpty(dto.getCurrentAgencyId())) {
|
||||
return vo;
|
||||
}
|
||||
AgencySimpleVO agency = agencyService.agencySimple(dto.getCurrentAgencyId());
|
||||
if (ObjectUtil.isEmpty(agency)) {
|
||||
return vo;
|
||||
}
|
||||
vo.setCurrentAgencyName(agency.getName());
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 补充运单VO详情
|
||||
* 后台运单详情页面
|
||||
*
|
||||
* @param vo 运单VO
|
||||
*/
|
||||
private void appendTransportOrderVO(TransportOrderVO vo) {
|
||||
//获取运输信息
|
||||
List<TaskTransportVO> taskTransportVOList = new ArrayList<>();
|
||||
List<TransportTaskDTO> TransportTaskDTOS = transportTaskFeign.findAllByOrderIdOrTaskId(vo.getId(), null);
|
||||
if (CollUtil.isNotEmpty(TransportTaskDTOS)) {
|
||||
TransportTaskDTOS.forEach(TransportTaskDTO ->
|
||||
taskTransportVOList.add(parseTransportTaskDTO2Vo(TransportTaskDTO))
|
||||
);
|
||||
Collections.reverse(taskTransportVOList);
|
||||
}
|
||||
vo.setTaskTransports(taskTransportVOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运输任务分页
|
||||
*
|
||||
* @param vo 查询条件
|
||||
* @return 运输任务分页
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<TaskTransportVO> findTaskByPage(TaskTransportQueryVO vo) {
|
||||
TransportTaskPageQueryDTO transportTaskPageQueryDTO = BeanUtil.toBean(vo, TransportTaskPageQueryDTO.class);
|
||||
// 查询车辆ID
|
||||
PageResponse<TruckDto> truckDtoPage = truckFeign.findByPage(1, 1000, null, null, vo.getLicensePlate());
|
||||
List<Long> truckIds = truckDtoPage.getItems().parallelStream().map(TruckDto::getId).collect(Collectors.toList());
|
||||
transportTaskPageQueryDTO.setTruckIds(truckIds);
|
||||
PageResponse<TransportTaskDTO> dtoPageResponse = transportTaskFeign.findByPage(transportTaskPageQueryDTO);
|
||||
return PageResponse.of(dtoPageResponse, this::batchParseTransportTaskDTO2Vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运输任务详情
|
||||
*
|
||||
* @param id 运输任务ID
|
||||
* @return 运输任务详情
|
||||
*/
|
||||
@Override
|
||||
public TaskTransportVO findTaskById(Long id) {
|
||||
TransportTaskDTO dto = transportTaskFeign.findById(id);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
return null;
|
||||
}
|
||||
return parseTransportTaskDTO2Vo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动调整运输任务
|
||||
*
|
||||
* @param id 运输任务ID
|
||||
* @param vo 司机 车辆 车次等信息
|
||||
*/
|
||||
@Override
|
||||
public void adjustTask(Long id, TaskTransportUpdateVO vo) {
|
||||
// 根据车辆ID查询司机ID
|
||||
if (CollUtil.isEmpty(vo.getDriverId())) {
|
||||
List<TruckDriverDto> driverDtos = driverFeign.findByTruckId(vo.getTruckId());
|
||||
List<Long> driverIds = driverDtos.parallelStream().map(TruckDriverDto::getUserId).collect(Collectors.toList());
|
||||
vo.setDriverId(driverIds);
|
||||
}
|
||||
TaskTransportUpdateDTO taskTransportUpdateDTO = BeanUtil.toBean(vo, TaskTransportUpdateDTO.class);
|
||||
transportTaskFeign.adjust(id, taskTransportUpdateDTO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运输任务统计
|
||||
*
|
||||
* @return 按状态统计
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, Long> countTask() {
|
||||
return transportTaskFeign.count().stream().collect(Collectors.toMap(TransportTaskStatusCountDTO::getStatusCode, TransportTaskStatusCountDTO::getCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换运输任务
|
||||
*
|
||||
* @param dto 运输任务DTO
|
||||
* @return 运输任务VO
|
||||
*/
|
||||
private TaskTransportVO parseTransportTaskDTO2Vo(TransportTaskDTO dto) {
|
||||
TaskTransportVO vo = BeanUtil.toBean(dto, TaskTransportVO.class);
|
||||
vo.setStatus(dto.getStatus().getCode());
|
||||
vo.setAssignedStatus(dto.getAssignedStatus().getCode());
|
||||
vo.setLoadingStatus(dto.getLoadingStatus().getCode());
|
||||
// 机构
|
||||
if (ObjectUtil.isNotEmpty(dto.getStartAgencyId())) {
|
||||
AgencySimpleVO agency = agencyService.agencySimple(dto.getStartAgencyId());
|
||||
vo.setStartAgency(agency);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getEndAgencyId())) {
|
||||
AgencySimpleVO agency = agencyService.agencySimple(dto.getEndAgencyId());
|
||||
vo.setEndAgency(agency);
|
||||
}
|
||||
|
||||
// 车辆
|
||||
if (ObjectUtil.isNotEmpty(dto.getTruckId())) {
|
||||
TruckVO truckById = baseTruckService.findTruckSimple(dto.getTruckId());
|
||||
if (ObjectUtil.isNotEmpty(truckById)) {
|
||||
vo.setTruck(truckById);
|
||||
}
|
||||
}
|
||||
|
||||
// 运单
|
||||
if (CollUtil.isNotEmpty(dto.getTransportOrderIds())) {
|
||||
List<TransportOrderVO> transportOrderVOS = batchGetTransportOrder(dto.getTransportOrderIds());
|
||||
vo.setTransportOrders(transportOrderVOS);
|
||||
}
|
||||
|
||||
// 司机信息
|
||||
DriverJobPageQueryDTO driverJobPageQueryDTO = DriverJobPageQueryDTO.builder().page(1).pageSize(10).transportTaskId(dto.getId()).build();
|
||||
PageResponse<DriverJobDTO> driverJobPage = driverJobFeign.pageQuery(driverJobPageQueryDTO);
|
||||
if (CollUtil.isNotEmpty(driverJobPage.getItems())) {
|
||||
List<Long> driverIds = CollUtil.getFieldValues(driverJobPage.getItems(), "driverId", Long.class);
|
||||
List<SysUserVO> drivers = authService.users(driverIds).parallelStream().collect(Collectors.toList());
|
||||
vo.setDrivers(drivers);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运输任务坐标
|
||||
*
|
||||
* @param id 运输任务ID
|
||||
* @return 运输任务坐标
|
||||
*/
|
||||
@Override
|
||||
public LinkedHashSet<PointVO> findTaskPointById(Long id) {
|
||||
LinkedHashSet<PointVO> pointVOS = new LinkedHashSet<>();
|
||||
TaskTransportVO taskById = findTaskById(id);
|
||||
AgencyVO startOrg = agencyService.agencyDetail(taskById.getStartAgency().getId());
|
||||
AgencyVO endOrg = agencyService.agencyDetail(taskById.getEndAgency().getId());
|
||||
|
||||
PointVO pointVO1 = new PointVO();
|
||||
pointVO1.setName(startOrg.getName());
|
||||
pointVO1.setMarkerPoints(startOrg.getLongitude().toString(), startOrg.getLatitude().toString());
|
||||
pointVOS.add(pointVO1);
|
||||
PointVO pointVO2 = new PointVO();
|
||||
pointVO2.setName(endOrg.getName());
|
||||
pointVO2.setMarkerPoints(endOrg.getLongitude().toString(), endOrg.getLatitude().toString());
|
||||
pointVOS.add(pointVO2);
|
||||
return pointVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取取派件任务分页数据
|
||||
*
|
||||
* @param vo 查询条件
|
||||
* @return 取派件分页数据
|
||||
*/
|
||||
@Override
|
||||
public PageResponse<PickupDispatchTaskListVO> findTaskPickupDispatchByPage(TaskPickupDispatchQueryVO vo) {
|
||||
//1.构建查询条件
|
||||
PickupDispatchTaskPageQueryDTO pickupDispatchTaskPageQueryDTO = BeanUtil.toBean(vo, PickupDispatchTaskPageQueryDTO.class);
|
||||
|
||||
//2.分页查询
|
||||
PageResponse<PickupDispatchTaskDTO> pageResponse = pickupDispatchTaskFeign.findByPage(pickupDispatchTaskPageQueryDTO);
|
||||
|
||||
//3.dto转为vo
|
||||
return PageResponse.of(pageResponse, PickupDispatchTaskListVO.class, (dto, responseVO) -> {
|
||||
//机构信息
|
||||
OrganDTO organDTO = organFeign.queryById(responseVO.getAgencyId());
|
||||
responseVO.setAgencyName(organDTO.getName());
|
||||
|
||||
//快递员信息
|
||||
if (ObjectUtil.isNotEmpty(dto.getCourierId())) {
|
||||
Result<UserDTO> courier = AuthTemplateThreadLocal.get().opsForUser().getUserById(dto.getCourierId());
|
||||
responseVO.setCourierName(courier.getData().getName());
|
||||
}
|
||||
|
||||
//取消原因
|
||||
if (ObjectUtil.isNotEmpty(dto.getCancelReason())) {
|
||||
responseVO.setCancelReason(dto.getCancelReason().getValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换取派件任务
|
||||
*
|
||||
* @param dto 任务DTO
|
||||
* @return 任务VO
|
||||
*/
|
||||
@Override
|
||||
public TaskPickupDispatchVO parsePickupDispatchTaskDTO2Vo(PickupDispatchTaskDTO dto) {
|
||||
TaskPickupDispatchVO vo = BeanUtil.toBean(dto, TaskPickupDispatchVO.class);
|
||||
vo.setStatus(dto.getStatus().getCode());
|
||||
vo.setAssignedStatus(dto.getAssignedStatus().getCode());
|
||||
vo.setSignStatus(dto.getSignStatus().getCode());
|
||||
if (ObjectUtil.isNotEmpty(dto.getAgencyId())) {
|
||||
AgencySimpleVO agency = agencyService.agencySimple(dto.getAgencyId());
|
||||
vo.setAgency(agency);
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getCourierId())) {
|
||||
SysUserVO user = authService.user(dto.getCourierId());
|
||||
vo.setCourier(user);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配快递员
|
||||
*
|
||||
* @param ids 取派件任务id
|
||||
* @param courierId 快递员ID
|
||||
*/
|
||||
@Override
|
||||
public void updateTaskPickupDispatchById(List<String> ids, Long courierId) {
|
||||
List<Long> taskIds = ids.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
pickupDispatchTaskFeign.updateCourierId(taskIds, 0L, courierId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 空车取消运输任务
|
||||
*
|
||||
* @param id 运输任务id
|
||||
*/
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
public void cancel(Long id) {
|
||||
//1.根据id查询运输任务
|
||||
TransportTaskDTO transportTaskDTO = transportTaskFeign.findById(id);
|
||||
|
||||
//1.1非空载无法取消
|
||||
if (ObjectUtil.notEqual(TransportTaskLoadingStatus.EMPTY, transportTaskDTO.getLoadingStatus())) {
|
||||
throw new SLWebException("运输任务不是空载,无法取消!");
|
||||
}
|
||||
|
||||
//1.2非待执行状态无法取消
|
||||
if (ObjectUtil.notEqual(TransportTaskStatus.PENDING, transportTaskDTO.getStatus())) {
|
||||
throw new SLWebException("运输任务不是待执行状态,无法取消!");
|
||||
}
|
||||
|
||||
//2.取消运输任务
|
||||
transportTaskFeign.updateStatus(id, TransportTaskStatus.CANCELLED);
|
||||
|
||||
//3.取消运输任务关联的司机作业单
|
||||
DriverJobPageQueryDTO driverJobPageQueryDTO = DriverJobPageQueryDTO.builder().page(1).pageSize(10).transportTaskId(id).build();
|
||||
PageResponse<DriverJobDTO> driverJobPage = driverJobFeign.pageQuery(driverJobPageQueryDTO);
|
||||
driverJobPage.getItems().forEach(dto -> driverJobFeign.updateStatus(dto.getId(), DriverJobStatus.CANCELLED));
|
||||
|
||||
//4.取消运输任务后需要完成当前车辆计划,从而能够生成下一次的车辆计划
|
||||
truckPlanFeign.finished(transportTaskDTO.getStartAgencyId(), transportTaskDTO.getTruckPlanId(), transportTaskDTO.getTruckId(), StatusEnum.NORMAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运单轨迹
|
||||
*
|
||||
* @param id 运单ID
|
||||
* @return 轨迹
|
||||
*/
|
||||
@Override
|
||||
public TrackVO findTrackById(String id) {
|
||||
TrackDTO trackDTO = trackFeign.queryByTransportOrderId(id);
|
||||
TrackVO trackVO = BeanUtil.toBean(trackDTO, TrackVO.class);
|
||||
trackVO.setStatus(trackDTO.getStatus().getCode());
|
||||
if (ObjectUtil.isNotEmpty(trackDTO.getType()) && trackDTO.getStatus().equals(TrackStatusEnum.NEW)) {
|
||||
trackVO.setStatus(trackDTO.getType().getCode());
|
||||
}
|
||||
return trackVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.sl.ms.web.manager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.sl.ms.web.manager.service.WorkspaceService;
|
||||
import com.sl.ms.web.manager.vo.workspace.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工作台服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WorkspaceServiceImpl implements WorkspaceService {
|
||||
|
||||
/**
|
||||
* 工作台redisKey
|
||||
*/
|
||||
private static final String WORKBENCH_REDIS_KEY = "WORKSPACE:WORKBENCH";
|
||||
/**
|
||||
* 订单总量redisKey
|
||||
*/
|
||||
private static final String MONTHLY_ORDER_REDIS_KEY = "WORKSPACE:MONTHLY_ORDER";
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param workbenchVO 工作台
|
||||
*/
|
||||
@Override
|
||||
public void saveWorkbench(WorkbenchAddVO workbenchVO) {
|
||||
String json = JSONUtil.toJsonStr(workbenchVO);
|
||||
redisTemplate.opsForList().leftPush(WORKBENCH_REDIS_KEY, json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增订单总量数据
|
||||
*
|
||||
* @param monthlyOrderList 月度订单数据
|
||||
*/
|
||||
@Override
|
||||
public void saveOrderNumber(List<MonthlyOrderAddVO> monthlyOrderList) {
|
||||
// 先删除所有
|
||||
redisTemplate.delete(MONTHLY_ORDER_REDIS_KEY);
|
||||
|
||||
// 订单月度数据转为json
|
||||
List<String> monthlyOrderJson = monthlyOrderList.stream().map(JSONUtil::toJsonStr).collect(Collectors.toList());
|
||||
|
||||
// 订单数据存到redis
|
||||
redisTemplate.opsForList().leftPushAll(MONTHLY_ORDER_REDIS_KEY, monthlyOrderJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一条数据
|
||||
*
|
||||
* @return 工作台数据
|
||||
*/
|
||||
@Override
|
||||
public WorkbenchVO findOne() {
|
||||
// 以当前日期位于本年度的天数进行轮询,mod3的结果取redis索引
|
||||
int count = DateUtil.dayOfYear(new Date());
|
||||
int index = count % 3;
|
||||
|
||||
// 获取redis中的数据
|
||||
String json = redisTemplate.opsForList().index(WORKBENCH_REDIS_KEY, index);
|
||||
|
||||
// json格式化
|
||||
WorkbenchAddVO workbenchAddVO = JSONUtil.toBean(json, WorkbenchAddVO.class);
|
||||
|
||||
// 预定义数据
|
||||
LocalDate localDate = LocalDate.now().minusMonths(6);
|
||||
List<MonthlyOrderVO> monthlyOrderList = new ArrayList<>();
|
||||
OrderLineChartVO orderLineChartVO = new OrderLineChartVO();
|
||||
|
||||
// redis中获取月度订单数据
|
||||
List<String> monthlyOrderJson = redisTemplate.opsForList().range(MONTHLY_ORDER_REDIS_KEY, 0, -1);
|
||||
if (ObjectUtil.isNotEmpty(monthlyOrderJson)) {
|
||||
// json数据转换为对象,并转为map
|
||||
List<MonthlyOrderAddVO> monthlyOrderAddList = monthlyOrderJson.stream().map(x -> JSONUtil.toBean(x, MonthlyOrderAddVO.class)).collect(Collectors.toList());
|
||||
Map<Integer, Integer> monthlyOrderMap = monthlyOrderAddList.stream().collect(Collectors.toMap(MonthlyOrderAddVO::getMonth, MonthlyOrderAddVO::getOrderNumber, (key1, key2) -> key2));
|
||||
|
||||
// 月度订单数据封装
|
||||
for (int i = 0; i < 6; i++) {
|
||||
localDate = localDate.plusMonths(1);
|
||||
Integer value = monthlyOrderMap.get(localDate.getMonthValue());
|
||||
monthlyOrderList.add(new MonthlyOrderVO(localDate, value));
|
||||
}
|
||||
|
||||
// 求最大值、最小值、平均值
|
||||
Integer max = monthlyOrderList.stream().mapToInt(MonthlyOrderVO::getOrderNumber).max().orElse(0);
|
||||
Integer min = monthlyOrderList.stream().mapToInt(MonthlyOrderVO::getOrderNumber).min().orElse(0);
|
||||
double average = monthlyOrderList.stream().mapToInt(MonthlyOrderVO::getOrderNumber).average().getAsDouble();
|
||||
|
||||
// 封装最大值、最小值、平均值
|
||||
orderLineChartVO.setMonthlyOrderList(monthlyOrderList);
|
||||
orderLineChartVO.setOrderMaxNumber(max);
|
||||
orderLineChartVO.setOrderAverageNumber(min);
|
||||
orderLineChartVO.setOrderMinNumber((int) Math.round(average));
|
||||
}
|
||||
|
||||
// 组装工作台数据
|
||||
WorkbenchVO workbenchVO = BeanUtil.toBean(workbenchAddVO, WorkbenchVO.class);
|
||||
workbenchVO.setOrderLineChart(orderLineChartVO);
|
||||
return workbenchVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除所有
|
||||
*/
|
||||
@Override
|
||||
public void deleteAll() {
|
||||
redisTemplate.delete(WORKBENCH_REDIS_KEY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.sl.ms.web.manager.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangxiaobing
|
||||
* @Description: 用于导出Excel
|
||||
*/
|
||||
@Slf4j
|
||||
public class ExcelUtil {
|
||||
|
||||
/**
|
||||
* 用于导出Excel表
|
||||
*
|
||||
* @param fileName 导出excel文件名
|
||||
* @param exportClass 导出List中的对象.class
|
||||
* @param data 需要导出的List
|
||||
* @return ResponseEntity <byte[]> 对象
|
||||
*/
|
||||
public static ResponseEntity<byte[]> export(List data, Class exportClass, String fileName) {
|
||||
|
||||
//对于中文名称的文件进行转码
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("文件名编码转换失败 ", e);
|
||||
return writeToTxt("文件名编码转换失败", "error");
|
||||
}
|
||||
|
||||
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
|
||||
try {
|
||||
EasyExcel.write(byteArrayOutputStream, exportClass)
|
||||
.autoCloseStream(Boolean.TRUE).sheet("sheet1")
|
||||
.doWrite(data);
|
||||
} catch (Exception e) {
|
||||
log.error("导出excel转换错误", e);
|
||||
return writeToTxt("导出excel转换错误", "error");
|
||||
}
|
||||
byte[] bytes = byteArrayOutputStream.toByteArray();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
HttpStatus statusCode = HttpStatus.OK;
|
||||
ResponseEntity<byte[]> entity = new ResponseEntity<>(bytes, headers, statusCode);
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于导出txt
|
||||
*
|
||||
* @param message 此字符串信息将会被写入到txt文件中
|
||||
* @return 响应实体
|
||||
*/
|
||||
public static ResponseEntity<byte[]> writeToTxt(String message, String fileName) {
|
||||
|
||||
//对于中文名称的文件进行转码
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("文件名编码转换失败 ", e);
|
||||
return writeToTxt("文件名编码转换失败", "error");
|
||||
}
|
||||
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
BufferedOutputStream bufferedOutputStream = null;
|
||||
StringBuffer write;
|
||||
try {
|
||||
bufferedOutputStream = new BufferedOutputStream(baos);
|
||||
|
||||
write = new StringBuffer();
|
||||
write.append(message);
|
||||
bufferedOutputStream.write(write.toString().getBytes("UTF-8"));
|
||||
|
||||
bufferedOutputStream.flush();
|
||||
bufferedOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
log.error("导出错误 ", e);
|
||||
return writeToTxt("导出错误", "error");
|
||||
} finally {
|
||||
try {
|
||||
bufferedOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
log.error("关闭字节流错误 ", e);
|
||||
}
|
||||
}
|
||||
|
||||
byte[] bytes = baos.toByteArray();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Content-Disposition", "attachment;filename=" + fileName + ".txt");
|
||||
HttpStatus statusCode = HttpStatus.OK;
|
||||
ResponseEntity<byte[]> entity = new ResponseEntity<>(bytes, headers, statusCode);
|
||||
|
||||
return entity;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于读取excel
|
||||
*
|
||||
* @param file 文件参数
|
||||
* @param importClass 导入对象class
|
||||
* @param analysisEventListener 分析事件监听器
|
||||
*/
|
||||
public static void readExcel(MultipartFile file, Class importClass, AnalysisEventListener analysisEventListener) {
|
||||
// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
||||
try {
|
||||
EasyExcel.read(file.getInputStream(), importClass, analysisEventListener).sheet().doRead();
|
||||
} catch (IOException e) {
|
||||
log.error("excel文件上传出现错误: {}", e.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("出现未知错误: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.sl.ms.web.manager.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.WorkSchedulingExportVO;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 导入Excel监听器
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ImportVOListener extends AnalysisEventListener<WorkSchedulingExportVO> {
|
||||
|
||||
List<WorkSchedulingExportVO> list = Lists.newLinkedList();
|
||||
|
||||
List<ExcelDataConvertException> listException = new ArrayList<>();
|
||||
|
||||
Map<Integer, String> excelHeadMap = new HashMap<>(10);
|
||||
|
||||
@Override
|
||||
public void invoke(WorkSchedulingExportVO vo, AnalysisContext analysisContext) {
|
||||
if (!StrUtil.equals(JSONUtil.toJsonStr(vo), "{}")) {
|
||||
log.info("解析到一条数据:{}", JSONUtil.toJsonStr(vo));
|
||||
list.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
log.info("所有数据解析完成!");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
||||
excelHeadMap = headMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(Exception exception, AnalysisContext context) {
|
||||
log.error("解析失败,但是继续解析下一行:{}", exception.getMessage());
|
||||
// 如果是某一个单元格的转换异常 能获取到具体行号
|
||||
// 如果要获取头的信息 配合invokeHeadMap使用
|
||||
if (exception instanceof ExcelDataConvertException) {
|
||||
ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
|
||||
log.error("第{}行,第{}列解析异常", excelDataConvertException.getRowIndex(),
|
||||
excelDataConvertException.getColumnIndex());
|
||||
listException.add(excelDataConvertException);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.sl.ms.web.manager.util;
|
||||
|
||||
import com.alibaba.excel.metadata.CellData;
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.handler.CellWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单元格设置文本格式
|
||||
*/
|
||||
public class RowFormatSetTextHandler implements CellWriteHandler {
|
||||
|
||||
@Override
|
||||
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||
//设置单元格格式为文本
|
||||
Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||
CellStyle cellStyle = workbook.createCellStyle();
|
||||
DataFormat dataFormat = workbook.createDataFormat();
|
||||
cellStyle.setDataFormat(dataFormat.getFormat("@"));
|
||||
cell.setCellStyle(cellStyle);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||
//设置单元格格式为文本
|
||||
Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||
CellStyle cellStyle = workbook.createCellStyle();
|
||||
DataFormat dataFormat = workbook.createDataFormat();
|
||||
cellStyle.setDataFormat(dataFormat.getFormat("@"));
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sl.ms.web.manager.vo.agency;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "机构简要信息")
|
||||
public class AgencySimpleVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "机构名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "机构类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "子部门简要信息列表")
|
||||
private List<AgencySimpleVO> subAgencies;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.sl.ms.web.manager.vo.agency;
|
||||
|
||||
import cn.hutool.core.annotation.Alias;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "机构信息")
|
||||
public class AgencyUpdateVO {
|
||||
@ApiModelProperty(value = "省级行政机构ID")
|
||||
private Long provinceId;
|
||||
|
||||
@ApiModelProperty(value = "市级行政机构ID")
|
||||
private Long cityId;
|
||||
|
||||
@ApiModelProperty(value = "县级行政机构ID")
|
||||
private Long countyId;
|
||||
|
||||
@ApiModelProperty(value = "父级机构")
|
||||
private AgencySimpleVO parent;
|
||||
|
||||
@ApiModelProperty(value = "机构id", required = true)
|
||||
@Alias("bid")
|
||||
@NotNull(message = "机构id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
private String name;
|
||||
@ApiModelProperty(value = "类型,1:一级转运,2:二级转运,3:网点", required = true)
|
||||
@Max(value = 3, message = "类型值必须是1、2、3")
|
||||
@Min(value = 1, message = "类型值必须是1、2、3")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "电话", required = true)
|
||||
private String phone;
|
||||
@ApiModelProperty(value = "地址", required = true)
|
||||
private String address;
|
||||
@Max(value = 180, message = "值必须是 0 - 180")
|
||||
@Min(value = 0, message = "值必须是0 - 180")
|
||||
@ApiModelProperty(value = "纬度", required = true)
|
||||
private Double latitude;
|
||||
@Max(value = 90, message = "值必须是 0 - 90")
|
||||
@Min(value = 0, message = "值必须是0 - 90")
|
||||
@ApiModelProperty(value = "经度", required = true)
|
||||
private Double longitude;
|
||||
@ApiModelProperty(value = "父节点id", required = true)
|
||||
private Long parentId;
|
||||
@ApiModelProperty(value = "负责人", required = true)
|
||||
private String managerName;
|
||||
@ApiModelProperty(value = "扩展字段,以json格式存储")
|
||||
private String extra;
|
||||
@ApiModelProperty(value = "是否可用", required = true)
|
||||
private Boolean status;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.sl.ms.web.manager.vo.agency;
|
||||
|
||||
import cn.hutool.core.annotation.Alias;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.AreaSimpleVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "机构信息")
|
||||
public class AgencyVO {
|
||||
|
||||
@ApiModelProperty(value = "所属省份")
|
||||
private AreaSimpleVO province;
|
||||
|
||||
@ApiModelProperty(value = "所属城市")
|
||||
private AreaSimpleVO city;
|
||||
|
||||
@ApiModelProperty(value = "所属区县")
|
||||
private AreaSimpleVO county;
|
||||
|
||||
@ApiModelProperty(value = "父级机构")
|
||||
private AgencySimpleVO parent;
|
||||
|
||||
@ApiModelProperty(value = "机构id", required = true)
|
||||
@Alias("bid")
|
||||
@NotNull(message = "机构id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
private String name;
|
||||
@ApiModelProperty(value = "类型,1:一级转运,2:二级转运,3:网点", required = true)
|
||||
@Max(value = 3, message = "类型值必须是1、2、3")
|
||||
@Min(value = 1, message = "类型值必须是1、2、3")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "电话", required = true)
|
||||
private String phone;
|
||||
@ApiModelProperty(value = "地址", required = true)
|
||||
private String address;
|
||||
@ApiModelProperty(value = "纬度", required = true)
|
||||
private Double latitude;
|
||||
@ApiModelProperty(value = "经度", required = true)
|
||||
private Double longitude;
|
||||
@ApiModelProperty(value = "父节点id", required = true)
|
||||
private Long parentId;
|
||||
@ApiModelProperty(value = "负责人", required = true)
|
||||
private String managerName;
|
||||
@ApiModelProperty(value = "扩展字段,以json格式存储")
|
||||
private String extra;
|
||||
@ApiModelProperty(value = "是否可用", required = true)
|
||||
private Boolean status;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.sl.ms.web.manager.vo.agency;
|
||||
|
||||
import com.sl.ms.scope.dto.Coordinate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "业务范围信息")
|
||||
public class ServiceScopeVO {
|
||||
|
||||
@ApiModelProperty(value = "业务id,可以是机构或快递员", required = true)
|
||||
@NotNull(message = "bid不能为空")
|
||||
private Long bid;
|
||||
|
||||
@ApiModelProperty(value = "类型,1-机构,2-快递员", required = true)
|
||||
@NotNull(message = "type不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "多边形坐标点,至少3个坐标点,首尾坐标必须相同", required = true)
|
||||
@Size(min = 3, message = "坐标列表至少3个坐标点")
|
||||
private List<Coordinate> polygon;
|
||||
|
||||
@ApiModelProperty(value = "纬度", required = true)
|
||||
private Double latitude;
|
||||
|
||||
@ApiModelProperty(value = "经度", required = true)
|
||||
private Double longitude;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long created;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updated;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sl.ms.web.manager.vo.auth;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("快递员信息")
|
||||
public class CourierVO {
|
||||
@ApiModelProperty(value = "快递员id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "快递员姓名")
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sl.ms.web.manager.vo.auth;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "角色信息")
|
||||
public class RoleVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "机构类型")
|
||||
private Integer agencyType;
|
||||
|
||||
@ApiModelProperty(value = "机构类型名称")
|
||||
private String agencyTypeName;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "最近更新时间")
|
||||
private String lastUpdateTime;
|
||||
|
||||
@ApiModelProperty(value = "最近更新人")
|
||||
private SysUserVO updater;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.sl.ms.web.manager.vo.auth;
|
||||
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "用户信息")
|
||||
public class SysUserVO {
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "员工账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "员工姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "工号")
|
||||
private String workNumber;
|
||||
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "所属机构信息")
|
||||
private AgencySimpleVO agency;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "岗位 1为员工 2为快递员 3为司机")
|
||||
private Integer station;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String stationName;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "账号状态 0:禁用 1:正常")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建者信息")
|
||||
private SysUserVO creator;
|
||||
|
||||
@ApiModelProperty(value = "创建时间,格式: yyyy-MM-dd HH:mm:ss")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "角色信息")
|
||||
private List<String> roleNames;
|
||||
|
||||
@ApiModelProperty(value = "工作状态 0休息 1上班")
|
||||
private Integer workStatus;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@ApiModelProperty("工作日期")
|
||||
private String workDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "行政区域简要信息")
|
||||
public class AreaSimpleVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "行政名称")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String lng;
|
||||
@ApiModelProperty(value = "纬度")
|
||||
private String lat;
|
||||
|
||||
@ApiModelProperty(value = "多边形经纬度坐标集合")
|
||||
private List<List<Map<String, String>>> mutiPoints;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AreaVO {
|
||||
@ApiModelProperty(value = "所属省份")
|
||||
private AreaSimpleVO province;
|
||||
|
||||
@ApiModelProperty(value = "所属城市")
|
||||
private AreaSimpleVO city;
|
||||
|
||||
@ApiModelProperty(value = "所属区县")
|
||||
private AreaSimpleVO county;
|
||||
|
||||
@ApiModelProperty(value = "地址", required = true)
|
||||
private String address;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckTypeVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* GoodsTypeVo
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "货物类型信息")
|
||||
public class GoodsTypeVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "货物类型名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "默认重量,单位:千克")
|
||||
private BigDecimal defaultWeight = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "默认体积,单位:方")
|
||||
private BigDecimal defaultVolume = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "说明")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型")
|
||||
private List<TruckTypeVO> truckTypes;
|
||||
|
||||
@ApiModelProperty("状态 0:禁用 1:正常")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 载荷取件
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoadRangeVO {
|
||||
/**
|
||||
* 最小载荷;重量单位:吨,体积单位:立方米
|
||||
*/
|
||||
private BigDecimal minLoad;
|
||||
|
||||
/**
|
||||
* 最大载荷;重量单位:吨,体积单位:立方米
|
||||
*/
|
||||
private BigDecimal maxLoad;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WorkSchedulingAddVO {
|
||||
@ApiModelProperty("用户ID列表")
|
||||
private List<Long> userIdList;
|
||||
|
||||
@ApiModelProperty("工作模式id")
|
||||
private Long workPatternId;
|
||||
|
||||
@ApiModelProperty("工作模式类型,1:礼拜制,2:连续制")
|
||||
private Byte workPatternType;
|
||||
|
||||
@ExcelProperty("用户类型:1:员工,2:快递员,3:司机")
|
||||
private Byte userType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("排班分页查询")
|
||||
@Data
|
||||
public class WorkSchedulingExportVO {
|
||||
|
||||
@ExcelProperty("用户类型:1:员工,2:快递员,3:司机")
|
||||
private Byte userType;
|
||||
|
||||
@ExcelProperty("网点")
|
||||
private Long agencyId;
|
||||
|
||||
@ExcelProperty("员工名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("员工编号")
|
||||
private String employeeNumber;
|
||||
|
||||
@ExcelProperty("电话")
|
||||
private String phone;
|
||||
|
||||
@ExcelProperty("工作模式id")
|
||||
private Long workPatternId;
|
||||
|
||||
@ExcelProperty("工作模式类型,1:礼拜制,2:连续制")
|
||||
private Byte workPatternType;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sl.ms.web.manager.vo.baseCommon;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WorkSchedulingVO {
|
||||
@ApiModelProperty("排班id列表")
|
||||
private List<Long> userIdList;
|
||||
|
||||
@ApiModelProperty("工作模式id")
|
||||
private Long workPatternId;
|
||||
|
||||
@ApiModelProperty("工作模式类型,1:礼拜制,2:连续制")
|
||||
private Byte workPatternType;
|
||||
|
||||
@ExcelProperty("用户类型:1:员工,2:快递员,3:司机")
|
||||
private Byte userType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机绑定车辆
|
||||
*/
|
||||
@Data
|
||||
public class BindingDriversVO {
|
||||
|
||||
@ApiModelProperty(value = "车辆id")
|
||||
private Long truckId;
|
||||
|
||||
@ApiModelProperty(value = "司机id列表")
|
||||
private List<Long> driverIds;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车次绑定车辆
|
||||
*/
|
||||
@Data
|
||||
public class BindingTrucksVO {
|
||||
|
||||
@ApiModelProperty(value = "车次id")
|
||||
private Long transportTripsId;
|
||||
|
||||
@ApiModelProperty(value = "车辆id列表")
|
||||
private List<Long> truckIds;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "司机驾驶证信息")
|
||||
public class DriverLicenseVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "司机id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "准驾车型")
|
||||
private String allowableType;
|
||||
|
||||
@ApiModelProperty(value = "初次领证日期")
|
||||
private String initialCertificateDate;
|
||||
|
||||
@ApiModelProperty(value = "有效期限")
|
||||
private String validPeriod;
|
||||
|
||||
@ApiModelProperty(value = "驾驶证号")
|
||||
private String licenseNumber;
|
||||
|
||||
@ApiModelProperty(value = "驾龄")
|
||||
private Integer driverAge;
|
||||
|
||||
@ApiModelProperty(value = "驾驶证类型")
|
||||
private String licenseType;
|
||||
|
||||
@ApiModelProperty(value = "从业资格证信息")
|
||||
private String qualificationCertificate;
|
||||
|
||||
@ApiModelProperty(value = "入场证信息")
|
||||
private String passCertificate;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String picture;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DriverUpdateVO {
|
||||
@ApiModelProperty(value = "司机id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "司机姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "工号")
|
||||
private String workNumber;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "工作状态")
|
||||
private Integer workStatus;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "司机基本信息")
|
||||
public class DriverVO {
|
||||
|
||||
@ApiModelProperty(value = "司机ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "司机姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "工号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "所属机构信息")
|
||||
private AgencySimpleVO agency;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "使用车辆")
|
||||
private TruckVO truck;
|
||||
|
||||
@ApiModelProperty(value = "工作状态 0休息 1上班")
|
||||
private Integer workStatus;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@ApiModelProperty("工作日期")
|
||||
private String workDate;
|
||||
|
||||
/**
|
||||
* 图片信息
|
||||
*/
|
||||
@ApiModelProperty(value = "图片信息")
|
||||
private String picture;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TransportTripsUpdateVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车次名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "发车时间")
|
||||
private Integer departureTime;
|
||||
|
||||
@ApiModelProperty(value = "持续时间")
|
||||
private Integer estimatedTime;
|
||||
|
||||
@ApiModelProperty(value = "所属线路")
|
||||
private Long transportLineId;
|
||||
|
||||
@ApiModelProperty(value = "周期,1为天,2为周,3为月")
|
||||
private Integer period;
|
||||
|
||||
@ApiModelProperty(value = "周期名称")
|
||||
private String periodName;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车次信息")
|
||||
public class TransportTripsVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车次名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "发车时间")
|
||||
private Integer departureTime;
|
||||
|
||||
@ApiModelProperty(value = "持续时间")
|
||||
private Integer estimatedTime;
|
||||
|
||||
@ApiModelProperty(value = "到达时间")
|
||||
private Integer arriveTime;
|
||||
|
||||
@ApiModelProperty(value = "所属线路")
|
||||
private TransportLineVO transportLine;
|
||||
|
||||
@ApiModelProperty(value = "周期,1为天,2为周,3为月")
|
||||
private Integer period;
|
||||
|
||||
@ApiModelProperty(value = "周期名称")
|
||||
private String periodName;
|
||||
|
||||
@ApiModelProperty(value = "所选车辆和司机")
|
||||
private List<TruckDriverVO> truckDrivers;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import com.sl.ms.web.manager.vo.transportLine.TransportLineVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车辆司机车次线路关联信息")
|
||||
public class TruckDriverTripsVO {
|
||||
@ApiModelProperty(value = "司机")
|
||||
private DriverVO driver;
|
||||
|
||||
@ApiModelProperty(value = "车辆")
|
||||
private TruckVO truck;
|
||||
|
||||
@ApiModelProperty(value = "线路信息")
|
||||
private TransportLineVO transportLine;
|
||||
|
||||
@ApiModelProperty(value = "车次信息")
|
||||
private TransportTripsVO transportTrips;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车辆和司机关联信息")
|
||||
public class TruckDriverVO {
|
||||
@ApiModelProperty(value = "司机")
|
||||
private DriverVO driver;
|
||||
|
||||
@ApiModelProperty(value = "车辆")
|
||||
private TruckVO truck;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车辆行驶证信息")
|
||||
public class TruckLicenseVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "发动机编号")
|
||||
private String engineNumber;
|
||||
|
||||
@ApiModelProperty(value = "注册时间,格式:yyyy-MM-dd HH:mm:ss")
|
||||
private String registrationDate;
|
||||
|
||||
@ApiModelProperty(value = "国家强制报废日期,格式:yyyy-MM-dd HH:mm:ss")
|
||||
private String mandatoryScrap;
|
||||
|
||||
@ApiModelProperty(value = "检验有效期,格式:yyyy-MM-dd HH:mm:ss")
|
||||
private String expirationDate;
|
||||
|
||||
@ApiModelProperty(value = "整备质量")
|
||||
private BigDecimal overallQuality = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "核定载质量")
|
||||
private BigDecimal allowableWeight = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "外廓尺寸")
|
||||
private String outsideDimensions;
|
||||
|
||||
@ApiModelProperty(value = "行驶证有效期,格式:yyyy-MM-dd HH:mm:ss")
|
||||
private String validityPeriod;
|
||||
|
||||
@ApiModelProperty(value = "行驶证号")
|
||||
private String transportCertificateNumber;
|
||||
|
||||
@ApiModelProperty(value = "图片信息")
|
||||
private String picture;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车辆位置信息")
|
||||
public class TruckLocationVO {
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型名称")
|
||||
private String truckTypeName;
|
||||
|
||||
@ApiModelProperty(value = "车牌号")
|
||||
private String licensePlate;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 回车登记列表元素
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "回车登记列表元素")
|
||||
public class TruckReturnRegisterListVO {
|
||||
|
||||
@ApiModelProperty(value = "回车登记id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车辆id")
|
||||
private Long truckId;
|
||||
|
||||
@ApiModelProperty(value = "车牌号码")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty(value = "运输任务id")
|
||||
private Long transportTaskId;
|
||||
|
||||
@ApiModelProperty(value = "起始机构id")
|
||||
private Long startAgencyId;
|
||||
|
||||
@ApiModelProperty(value = "起始机构名称")
|
||||
private String startAgencyName;
|
||||
|
||||
@ApiModelProperty(value = "结束机构id")
|
||||
private Long endAgencyId;
|
||||
|
||||
@ApiModelProperty(value = "结束机构名称")
|
||||
private String endAgencyName;
|
||||
|
||||
@ApiModelProperty(value = "运单数量")
|
||||
private Integer transportOrderNumber;
|
||||
|
||||
@ApiModelProperty(value = "出车时间", example = "2022-09-12 15:16:00")
|
||||
private LocalDateTime outStorageTime;
|
||||
|
||||
@ApiModelProperty(value = "回车时间", example = "2022-09-12 15:37:00")
|
||||
private LocalDateTime intoStorageTime;
|
||||
|
||||
@ApiModelProperty(value = "车辆是否可用")
|
||||
private Boolean isAvailable;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 回车登记分页查询条件
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "回车登记分页查询条件")
|
||||
public class TruckReturnRegisterPageQueryVO {
|
||||
|
||||
@ApiModelProperty(value = "页码", example = "1", required = true)
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "页面大小", example = "10", required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(value = "运输任务id")
|
||||
private Long transportTaskId;
|
||||
|
||||
@ApiModelProperty(value = "起始机构id")
|
||||
private Long startAgencyId;
|
||||
|
||||
@ApiModelProperty(value = "结束机构id")
|
||||
private Long endAgencyId;
|
||||
|
||||
@ApiModelProperty(value = "开始回车时间", example = "2022-09-12 15:37:00")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime intoStorageStartTime;
|
||||
|
||||
@ApiModelProperty(value = "结束回车时间", example = "2022-09-13 15:37:00")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime intoStorageEndTime;
|
||||
|
||||
@ApiModelProperty(value = "车辆是否可用")
|
||||
private Boolean isAvailable;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import com.sl.ms.base.domain.enums.TruckAccidentTypeEnum;
|
||||
import com.sl.ms.base.domain.enums.TruckBreakRulesTypeEnum;
|
||||
import com.sl.ms.base.domain.enums.TruckFaultTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 回车登记详情
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "回车登记详情")
|
||||
public class TruckReturnRegisterVO {
|
||||
|
||||
@ApiModelProperty(value = "回车登记id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "运输任务id")
|
||||
private Long transportTaskId;
|
||||
|
||||
@ApiModelProperty(value = "车辆id")
|
||||
private Long truckId;
|
||||
|
||||
@ApiModelProperty(value = "车牌号码")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty(value = "起始机构id")
|
||||
private Long startAgencyId;
|
||||
|
||||
@ApiModelProperty(value = "起始机构名称")
|
||||
private String startAgencyName;
|
||||
|
||||
@ApiModelProperty(value = "结束机构id")
|
||||
private Long endAgencyId;
|
||||
|
||||
@ApiModelProperty(value = "结束机构名称")
|
||||
private String endAgencyName;
|
||||
|
||||
@ApiModelProperty(value = "出车时间")
|
||||
private LocalDateTime outStorageTime;
|
||||
|
||||
@ApiModelProperty(value = "回车时间")
|
||||
private LocalDateTime intoStorageTime;
|
||||
|
||||
@ApiModelProperty("司机id列表")
|
||||
private List<Long> driverIds;
|
||||
|
||||
@ApiModelProperty("司机姓名")
|
||||
private String driverName;
|
||||
|
||||
@ApiModelProperty(value = "车辆是否违章")
|
||||
private Boolean isBreakRules;
|
||||
|
||||
@ApiModelProperty(value = "违章类型,1-闯红灯,2-无证驾驶,3-超载,4-酒后驾驶,5-超速行驶")
|
||||
private TruckBreakRulesTypeEnum breakRulesType;
|
||||
|
||||
@ApiModelProperty(value = "违章说明,类型为“其他”时填写")
|
||||
private String breakRulesDescription;
|
||||
|
||||
@ApiModelProperty(value = "罚款金额")
|
||||
private BigDecimal penaltyAmount;
|
||||
|
||||
@ApiModelProperty(value = "扣分")
|
||||
private Integer deductPoints;
|
||||
|
||||
@ApiModelProperty(value = "车辆是否故障")
|
||||
private Boolean isFault;
|
||||
|
||||
@ApiModelProperty(value = "车辆是否可用")
|
||||
private Boolean isAvailable;
|
||||
|
||||
@ApiModelProperty(value = "故障类型,1-发动机启动困难,2-不着车,3-漏油,4-漏水,5-照明失灵,6-有异响,7-排烟异常,8-温度异常,9-其他")
|
||||
private TruckFaultTypeEnum faultType;
|
||||
|
||||
@ApiModelProperty(value = "故障说明,类型为“其他”时填写")
|
||||
private String faultDescription;
|
||||
|
||||
@ApiModelProperty(value = "故障图片")
|
||||
private String faultImages;
|
||||
|
||||
@ApiModelProperty(value = "车辆是否发生事故")
|
||||
private Boolean isAccident;
|
||||
|
||||
@ApiModelProperty(value = "事故类型,1-直行事故,2-追尾事故,3-超车事故,4-左转弯事故,5-右转弯事故,6-弯道事故,7-坡道事故,8-会车事故,9-其他")
|
||||
private TruckAccidentTypeEnum accidentType;
|
||||
|
||||
@ApiModelProperty(value = "事故说明,类型为“其他”时填写")
|
||||
private String accidentDescription;
|
||||
|
||||
@ApiModelProperty(value = "事故图片")
|
||||
private String accidentImages;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import com.sl.ms.web.manager.vo.baseCommon.GoodsTypeVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车辆类型")
|
||||
public class TruckTypeVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "准载重量")
|
||||
private BigDecimal allowableLoad = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "准载体积")
|
||||
private BigDecimal allowableVolume = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "长")
|
||||
private BigDecimal measureLong = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "宽")
|
||||
private BigDecimal measureWidth = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "高")
|
||||
private BigDecimal measureHigh = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "货物类型列表")
|
||||
private List<GoodsTypeVO> goodsTypes;
|
||||
|
||||
@ApiModelProperty(value = "车型数量")
|
||||
private Integer num;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.sl.ms.web.manager.vo.baseTruck;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车辆信息")
|
||||
public class TruckVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型Id")
|
||||
private Long truckTypeId;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型名称")
|
||||
private String truckTypeName;
|
||||
|
||||
@ApiModelProperty(value = "品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty(value = "车牌号码")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty(value = "GPS设备id")
|
||||
private String deviceGpsId;
|
||||
|
||||
@ApiModelProperty(value = "准载重量")
|
||||
private BigDecimal allowableLoad = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "准载体积")
|
||||
private BigDecimal allowableVolume = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "车辆行驶证信息id")
|
||||
private Long truckLicenseId;
|
||||
|
||||
@ApiModelProperty(value = "状态 0:禁用 1:正常")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 运输状态 0:已到达 1:运输中
|
||||
*/
|
||||
@ApiModelProperty(value = "运输状态 0:已到达 1:运输中")
|
||||
private Integer runStatus;
|
||||
|
||||
@ApiModelProperty(value = "工作状态 0:停用 1:启用")
|
||||
private Integer workStatus;
|
||||
|
||||
@ApiModelProperty(value = "关联线路")
|
||||
private String transportLineName;
|
||||
|
||||
@ApiModelProperty(value = "关联司机")
|
||||
private String driverName;
|
||||
|
||||
@ApiModelProperty(value = "司机数量")
|
||||
private Integer driverNum;
|
||||
|
||||
/**
|
||||
* 满载系数
|
||||
*/
|
||||
@ApiModelProperty(value = "满载系数")
|
||||
// @NonNull
|
||||
private Double loadingRatio;
|
||||
|
||||
/**
|
||||
* 图片信息
|
||||
*/
|
||||
@ApiModelProperty(value = "图片信息")
|
||||
private String picture;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.sl.ms.web.manager.vo.carriage;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CarriageVO {
|
||||
|
||||
/**
|
||||
* 运费模板id
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模板类型:1-同城寄,2-省内寄,3-经济区互寄,4-跨省
|
||||
*/
|
||||
@ApiModelProperty(value = "模板类型:1-同城寄,2-省内寄,3-经济区互寄,4-跨省", required = true)
|
||||
private Integer templateType;
|
||||
|
||||
/**
|
||||
* 运送类型:1-普快,2-特快
|
||||
*/
|
||||
@ApiModelProperty(value = "运送类型:1-普快,2-特快", required = true)
|
||||
private Integer transportType;
|
||||
|
||||
/**
|
||||
* 关联城市:1-全国,2-京津冀,3-江浙沪,4-川渝,5-黑吉辽
|
||||
*/
|
||||
|
||||
@ApiModelProperty(value = "关联城市:1-全国,2-京津冀,3-江浙沪,4-川渝,5-黑吉辽", required = true)
|
||||
private List<String> associatedCityList;
|
||||
|
||||
/**
|
||||
* 首重价格
|
||||
*/
|
||||
@ApiModelProperty(value = "首重价格", required = true)
|
||||
private Double firstWeight;
|
||||
|
||||
/**
|
||||
* 续重价格
|
||||
*/
|
||||
@ApiModelProperty(value = "续重价格", required = true)
|
||||
private Double continuousWeight;
|
||||
|
||||
/**
|
||||
* 轻抛系数
|
||||
*/
|
||||
@ApiModelProperty(value = "轻抛系数", required = true)
|
||||
private Integer lightThrowingCoefficient;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime created;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updated;
|
||||
|
||||
@ApiModelProperty(value = "运费")
|
||||
private Double expense;
|
||||
|
||||
@ApiModelProperty(value = "计算重量")
|
||||
private Double computeWeight;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.sl.ms.web.manager.vo.oms;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 货品总重量
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class OrderCargoUpdateVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@NonNull
|
||||
@ApiModelProperty(value = "订单信息")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty(value = "货物类型信息")
|
||||
private Long goodsTypeId;
|
||||
|
||||
@ApiModelProperty(value = "货物名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "货物单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "货品货值")
|
||||
private BigDecimal cargoValue = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "货品条码")
|
||||
private String cargoBarcode;
|
||||
|
||||
@ApiModelProperty(value = "货品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty(value = "货品体积")
|
||||
private BigDecimal volume = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "货品重量")
|
||||
private BigDecimal weight = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "货品备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "货品总体积")
|
||||
private BigDecimal totalVolume = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "货品总重量")
|
||||
private BigDecimal totalWeight = new BigDecimal("0.0");
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.sl.ms.web.manager.vo.oms;
|
||||
|
||||
import com.sl.ms.web.manager.vo.baseCommon.GoodsTypeVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 货品总重量
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "货物信息")
|
||||
public class OrderCargoVO {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "货物类型信息")
|
||||
private GoodsTypeVO goodsType;
|
||||
|
||||
@ApiModelProperty(value = "货物名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "货物单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "货品货值")
|
||||
private BigDecimal cargoValue;
|
||||
|
||||
@ApiModelProperty(value = "货品条码")
|
||||
private String cargoBarcode;
|
||||
|
||||
@ApiModelProperty(value = "货品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty(value = "货品体积")
|
||||
private BigDecimal volume;
|
||||
|
||||
@ApiModelProperty(value = "货品重量")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ApiModelProperty(value = "货品备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "货品总体积")
|
||||
private BigDecimal totalVolume;
|
||||
|
||||
@ApiModelProperty(value = "货品总重量")
|
||||
private BigDecimal totalWeight;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.sl.ms.web.manager.vo.oms;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("订单轨迹参数")
|
||||
public class OrderLocusVO {
|
||||
@ApiModelProperty("业务id")
|
||||
private String businessId;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
private String ge___time;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String le___time;
|
||||
|
||||
@ApiModelProperty("运输任务id")
|
||||
private String transportTaskId;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.sl.ms.web.manager.vo.oms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class OrderQueryVO {
|
||||
|
||||
@ApiModelProperty(value = "页码")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "页尺寸")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "订单类型,1为同城订单,2为城际订单")
|
||||
private Integer orderType;
|
||||
|
||||
@ApiModelProperty(value = "取件类型,1为网点自寄,2为上门取件")
|
||||
private Integer pickupType;
|
||||
|
||||
@ApiModelProperty(value = "下单时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "客户id")
|
||||
private Long memberId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "收件人详细地址")
|
||||
private String receiverAddress;
|
||||
|
||||
@ApiModelProperty(value = "收件人姓名")
|
||||
private String receiverName;
|
||||
|
||||
@ApiModelProperty(value = "收件人电话")
|
||||
private String receiverPhone;
|
||||
|
||||
@ApiModelProperty("发件人省份id")
|
||||
private Long senderProvinceId;
|
||||
@ApiModelProperty("发件人城市id")
|
||||
private Long senderCityId;
|
||||
@ApiModelProperty("发件人区域id")
|
||||
private Long senderCountyId;
|
||||
|
||||
@ApiModelProperty("收件人省份id")
|
||||
private Long receiverProvinceId;
|
||||
@ApiModelProperty("收件人城市id")
|
||||
private Long receiverCityId;
|
||||
@ApiModelProperty("收件人区域id")
|
||||
private Long receiverCountyId;
|
||||
|
||||
@ApiModelProperty(value = "发件人详细地址")
|
||||
private String senderAddress;
|
||||
|
||||
@ApiModelProperty(value = "发件人姓名")
|
||||
private String senderName;
|
||||
|
||||
@ApiModelProperty(value = "发件人电话")
|
||||
private String senderPhone;
|
||||
|
||||
@ApiModelProperty(value = "付款方式,1.预结2到付")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@ApiModelProperty(value = "付款状态,1.未付2已付")
|
||||
private Integer paymentStatus;
|
||||
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty(value = "预计到达时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime estimatedArrivalTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "订单状态: 23000为待取件,23001为已取件,23002为网点自寄," +
|
||||
"23003为网点入库,23004为待装车,23005为运输中,23006为网点出库,23007为待派送," +
|
||||
"23008为派送中,23009为已签收,23010为拒收,230011为已取消")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.sl.ms.web.manager.vo.oms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sl.ms.web.manager.vo.baseCommon.AreaSimpleVO;
|
||||
import com.sl.ms.web.manager.vo.work.TaskPickupDispatchVO;
|
||||
import com.sl.ms.web.manager.vo.work.TransportOrderPointVO;
|
||||
import com.sl.ms.web.manager.vo.work.TransportOrderVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "订单信息")
|
||||
public class OrderVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "货品集合")
|
||||
private List<OrderCargoVO> orderCargoDTOS;
|
||||
|
||||
@ApiModelProperty(value = "订单类型,1为同城订单,2为城际订单")
|
||||
private Integer orderType;
|
||||
|
||||
@ApiModelProperty(value = "取件类型,1为网点自寄,2为上门取件")
|
||||
private Integer pickupType;
|
||||
|
||||
@ApiModelProperty(value = "下单时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "客户id")
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty(value = "收件人省份")
|
||||
private AreaSimpleVO receiverProvince;
|
||||
|
||||
@ApiModelProperty(value = "收件人城市")
|
||||
private AreaSimpleVO receiverCity;
|
||||
|
||||
@ApiModelProperty(value = "收件人区县")
|
||||
private AreaSimpleVO receiverCounty;
|
||||
|
||||
@ApiModelProperty(value = "收件人详细地址")
|
||||
private String receiverAddress;
|
||||
|
||||
@ApiModelProperty(value = "收件人姓名")
|
||||
private String receiverName;
|
||||
|
||||
@ApiModelProperty(value = "收件人电话")
|
||||
private String receiverPhone;
|
||||
|
||||
@ApiModelProperty(value = "发件人省份")
|
||||
private AreaSimpleVO senderProvince;
|
||||
|
||||
@ApiModelProperty(value = "发件人城市")
|
||||
private AreaSimpleVO senderCity;
|
||||
|
||||
@ApiModelProperty(value = "发件人区县")
|
||||
private AreaSimpleVO senderCounty;
|
||||
|
||||
@ApiModelProperty(value = "发件人详细地址")
|
||||
private String senderAddress;
|
||||
|
||||
@ApiModelProperty(value = "发件人姓名")
|
||||
private String senderName;
|
||||
|
||||
@ApiModelProperty(value = "发件人电话")
|
||||
private String senderPhone;
|
||||
|
||||
@ApiModelProperty(value = "付款方式,1.预结2到付")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@ApiModelProperty(value = "付款状态,1.未付2已付")
|
||||
private Integer paymentStatus;
|
||||
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal amount = new BigDecimal("0.0");
|
||||
|
||||
@ApiModelProperty(value = "预计到达时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime estimatedArrivalTime;
|
||||
|
||||
@ApiModelProperty(value = "距离,单位:米")
|
||||
private Double distance;
|
||||
|
||||
/**
|
||||
* 订单状态: 22000已关闭, 23000为待取件,23001为已取件,23002为网点自寄,23003为网点入库,
|
||||
* 23004为待装车,23005为运输中,23006为网点出库,23007为待派送,23008为派送中,
|
||||
* 23009为已签收,23010为拒收,230011为已取消
|
||||
*/
|
||||
@ApiModelProperty(value = "订单状态: 22000已关闭,23000为待取件,23001为已取件,23002为网点自寄," +
|
||||
"23003为网点入库,23004为待装车,23005为运输中,23006为网点出库,23007为待派送," +
|
||||
"23008为派送中,23009为已签收,23010为拒收,230011为已取消")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "页码")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "页尺寸")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(value = "取件信息")
|
||||
private TaskPickupDispatchVO taskPickup;
|
||||
|
||||
@ApiModelProperty(value = "派件信息")
|
||||
private TaskPickupDispatchVO taskDispatch;
|
||||
|
||||
@ApiModelProperty(value = "拒收派件信息")
|
||||
private TaskPickupDispatchVO taskRejectionDispatch;
|
||||
|
||||
@ApiModelProperty(value = "运单信息")
|
||||
private TransportOrderVO transportOrder;
|
||||
|
||||
/**
|
||||
* 预计取件时间
|
||||
*/
|
||||
@ApiModelProperty(value = "预计取件时间")
|
||||
private LocalDateTime estimatedStartTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updated;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String mark;
|
||||
|
||||
@ApiModelProperty(value = "运单信息流")
|
||||
List<TransportOrderPointVO> transportOrderPointVOS;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sl.ms.web.manager.vo.transportLine;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zzj
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TransportLineQueryVO {
|
||||
|
||||
@ApiModelProperty(value = "路线名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String number;
|
||||
|
||||
@ApiModelProperty(value = "起点机构id")
|
||||
private Long startOrganId;
|
||||
|
||||
@ApiModelProperty(value = "终点机构id")
|
||||
private Long endOrganId;
|
||||
|
||||
@ApiModelProperty(value = "页数")
|
||||
private Integer page = 1;
|
||||
|
||||
@ApiModelProperty(value = "页数大小")
|
||||
private Integer pageSize = 10;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.sl.ms.web.manager.vo.transportLine;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "线路信息")
|
||||
public class TransportLineVO {
|
||||
|
||||
@ApiModelProperty(value = "ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String number;
|
||||
|
||||
@ApiModelProperty(value = "成本")
|
||||
private Double cost;
|
||||
|
||||
@ApiModelProperty(value = "类型,1:干线,2:支线,3:接驳路线", required = true)
|
||||
@Max(value = 3, message = "类型值必须是1、2、3")
|
||||
@Min(value = 1, message = "类型值必须是1、2、3")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "路线名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "距离,单位:千米")
|
||||
private Double distance;
|
||||
|
||||
@ApiModelProperty(value = "时间,单位:分钟")
|
||||
private Long time;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long created;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Long updated;
|
||||
|
||||
@ApiModelProperty(value = "扩展字段,以json格式存储")
|
||||
private String extra;
|
||||
|
||||
@ApiModelProperty(value = "起点机构id")
|
||||
private Long startOrganId;
|
||||
|
||||
@ApiModelProperty(value = "起点机构名称,只有在查询时返回")
|
||||
private String startOrganName;
|
||||
|
||||
@ApiModelProperty(value = "终点机构id")
|
||||
private Long endOrganId;
|
||||
|
||||
@ApiModelProperty(value = "终点机构名称,只有在查询时返回")
|
||||
private String endOrganName;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel("成本配置")
|
||||
public class CostConfigurationVO {
|
||||
@ApiModelProperty(value = "线路类型, TRUNK_LINE(1, \"干线\", \"一级转运中心到一级转运中心\"),\n" +
|
||||
" BRANCH_LINE(2, \"支线\", \"一级转运中心与二级转运中心之间线路\"),\n" +
|
||||
" CONNECT_LINE(3, \"接驳路线\", \"二级转运中心到网点\"),", required = true)
|
||||
@NotNull(message = "线路类型不能为空!")
|
||||
@Min(value = 1, message = "线路类型最小为1!")
|
||||
@Max(value = 3, message = "线路类型最大为3!")
|
||||
private Integer transportLineType;
|
||||
|
||||
@ApiModelProperty(value = "成本,只支持输入数字,小数点后2位,不能为空\n" +
|
||||
"默认值:干线0.8元、支线1.2元、接驳1.5", required = true)
|
||||
@NotNull(message = "成本不能为空!")
|
||||
private Double cost;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel("调度配置")
|
||||
public class DispatchConfigurationVO {
|
||||
@ApiModelProperty(value = "调度时间,单位:小时。分配运输任务的提前量,限定1-48小时", required = true)
|
||||
@NotNull(message = "调度时间不能为空!")
|
||||
@Min(value = 1, message = "调度时间最小为1!")
|
||||
@Max(value = 48, message = "调度时间最大为48!")
|
||||
private Integer dispatchTime;
|
||||
|
||||
@ApiModelProperty(value = "调度方式,1转运次数最少,2成本最低;默认成本最低", required = true)
|
||||
@NotNull(message = "调度方式不能为空!")
|
||||
@Min(value = 1, message = "调度方式最小为1!")
|
||||
@Max(value = 2, message = "调度方式最大为2!")
|
||||
private Integer dispatchMethod;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class MarkerPointVO {
|
||||
@ApiModelProperty("精度")
|
||||
private Double lng;
|
||||
@ApiModelProperty("纬度")
|
||||
private Double lat;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sl.ms.work.domain.enums.pickupDispatchtask.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "取派件任务列表数据")
|
||||
public class PickupDispatchTaskListVO {
|
||||
|
||||
@ApiModelProperty(value = "取派件任务id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "所在营业部id")
|
||||
private Long agencyId;
|
||||
|
||||
@ApiModelProperty(value = "所在营业部名称")
|
||||
private String agencyName;
|
||||
|
||||
@ApiModelProperty(value = "任务类型,1为取件任务,2为派件任务")
|
||||
private PickupDispatchTaskType taskType;
|
||||
|
||||
@ApiModelProperty(value = "任务状态,1为新任务、2为已完成、3为已取消")
|
||||
private PickupDispatchTaskStatus status;
|
||||
|
||||
@ApiModelProperty(value = "任务分配状态(2已分配3待人工分配)")
|
||||
private PickupDispatchTaskAssignedStatus assignedStatus;
|
||||
|
||||
@ApiModelProperty(value = "签收状态(1为已签收,2为拒收)")
|
||||
private PickupDispatchTaskSignStatus signStatus;
|
||||
|
||||
@ApiModelProperty(value = "签收人,1本人,2代收")
|
||||
private SignRecipientEnum signRecipient;
|
||||
|
||||
@ApiModelProperty(value = "快递员id")
|
||||
private Long courierId;
|
||||
|
||||
@ApiModelProperty(value = "快递员姓名")
|
||||
private String courierName;
|
||||
|
||||
@ApiModelProperty(value = "订单id")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty(value = "预计开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime estimatedStartTime;
|
||||
|
||||
@ApiModelProperty(value = "实际开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime actualStartTime;
|
||||
|
||||
@ApiModelProperty(value = "预计完成时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime estimatedEndTime;
|
||||
|
||||
@ApiModelProperty(value = "实际完成时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime actualEndTime;
|
||||
|
||||
@ApiModelProperty(value = "取消时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
@ApiModelProperty(value = "取消原因")
|
||||
private String cancelReason;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("取派件任务统计")
|
||||
public class PickupDispatchTaskQuantityStatisticsVO {
|
||||
@ApiModelProperty(value = "任务总数")
|
||||
private Integer total;
|
||||
|
||||
@ApiModelProperty(value = "新任务数量")
|
||||
private Integer newTaskCount;
|
||||
|
||||
@ApiModelProperty(value = "已完成任务数量")
|
||||
private Integer completedTaskCount;
|
||||
|
||||
@ApiModelProperty(value = "已取消任务数量")
|
||||
private Integer canceledTaskCount;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("位置打点")
|
||||
public class PointVO {
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
@ApiModelProperty("坐标")
|
||||
private MarkerPoint markerPoint;
|
||||
|
||||
public void setMarkerPoints(String lng, String lat) {
|
||||
MarkerPoint markerPoint = new MarkerPoint();
|
||||
markerPoint.setLat(lat);
|
||||
markerPoint.setLng(lng);
|
||||
this.markerPoint = markerPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PointVO) {
|
||||
PointVO orderPointVO = (PointVO) obj;
|
||||
return (name.equals(orderPointVO.name));
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Data
|
||||
class MarkerPoint {
|
||||
@ApiModelProperty("精度")
|
||||
private String lng;
|
||||
@ApiModelProperty("纬度")
|
||||
private String lat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sl.ms.work.domain.enums.pickupDispatchtask.*;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TaskPickupDispatchQueryVO {
|
||||
@ApiModelProperty(value = "当前页数", example = "1", required = true)
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "每页条数", example = "10", required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("取派件任务id,可模糊查询")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("订单id,可模糊查询")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("营业部id")
|
||||
private Long agencyId;
|
||||
|
||||
@ApiModelProperty(value = "任务类型,1为取件任务,2为派件任务", required = true)
|
||||
@NotNull(message = "任务类型不能为空!")
|
||||
@Range(min = 1, max = 2, message = "任务类型错误!")
|
||||
private PickupDispatchTaskType taskType;
|
||||
|
||||
@ApiModelProperty(value = "任务状态,1为新任务、2为已完成、3为已取消")
|
||||
private PickupDispatchTaskStatus status;
|
||||
|
||||
@ApiModelProperty("任务分配状态(2已分配,3待人工分配)")
|
||||
private PickupDispatchTaskAssignedStatus assignedStatus;
|
||||
|
||||
@ApiModelProperty(value = "签收状态(1为已签收,2为拒收)")
|
||||
private PickupDispatchTaskSignStatus signStatus;
|
||||
|
||||
@ApiModelProperty(value = "最小预计完成时间", example = "2022-08-15 00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime minEstimatedEndTime;
|
||||
|
||||
@ApiModelProperty(value = "最大预计完成时间", example = "2022-09-15 00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime maxEstimatedEndTime;
|
||||
|
||||
@ApiModelProperty(value = "最小实际完成时间", example = "2022-08-15 00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime minActualEndTime;
|
||||
|
||||
@ApiModelProperty(value = "最大实际完成时间", example = "2022-09-15 00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime maxActualEndTime;
|
||||
|
||||
@ApiModelProperty(value = "删除:0-否,1-是;不传则查全部")
|
||||
private PickupDispatchTaskIsDeleted isDeleted;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.ms.web.manager.vo.oms.OrderVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "取派件任务信息")
|
||||
public class TaskPickupDispatchVO {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "订单信息")
|
||||
private OrderVO order;
|
||||
|
||||
@ApiModelProperty(value = "任务类型,1为取件任务,2为派件任务")
|
||||
private Integer taskType;
|
||||
|
||||
@ApiModelProperty(value = "任务状态,1为新任务、2为已完成、3为已取消")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "签收状态(1为已签收,2为拒收)")
|
||||
private Integer signStatus;
|
||||
|
||||
@ApiModelProperty(value = "任务所属网点信息")
|
||||
private AgencySimpleVO agency;
|
||||
|
||||
@ApiModelProperty(value = "快递员信息")
|
||||
private SysUserVO courier;
|
||||
|
||||
@ApiModelProperty(value = "预计开始时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime estimatedStartTime;
|
||||
|
||||
@ApiModelProperty(value = "实际开始时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime actualStartTime;
|
||||
|
||||
@ApiModelProperty(value = "预计完成时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime estimatedEndTime;
|
||||
|
||||
@ApiModelProperty(value = "实际完成时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime actualEndTime;
|
||||
|
||||
@ApiModelProperty(value = "取消时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
@ApiModelProperty(value = "任务分配状态(2已分配3待人工分配)")
|
||||
private Integer assignedStatus;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String mark;
|
||||
|
||||
@ApiModelProperty(value = "任务创建时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "页码")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "页尺寸")
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TaskTransportQueryVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "任务状态,1为待执行(对应 待提货)、2为进行中(对应在途)、3为待确认(保留状态)、4为已完成(对应 已交付)、5为已取消")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "计划到达时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime planArrivalTime;
|
||||
|
||||
@ApiModelProperty(value = "页码")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "页尺寸")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("起始机构id")
|
||||
private Long startAgencyId;
|
||||
|
||||
@ApiModelProperty("目的机构id")
|
||||
private Long endAgencyId;
|
||||
|
||||
@ApiModelProperty("任务分配状态(1未分配2已分配3待人工分配)")
|
||||
private Integer assignedStatus;
|
||||
|
||||
@ApiModelProperty("满载状态(1.半载2.满载3.空载)")
|
||||
private Integer loadingStatus;
|
||||
|
||||
@ApiModelProperty("车辆id")
|
||||
private Long truckId;
|
||||
|
||||
@ApiModelProperty("车牌号码")
|
||||
private String licensePlate;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("手动调整运输任务")
|
||||
@Data
|
||||
public class TaskTransportUpdateVO {
|
||||
@ApiModelProperty(value = "运输任务Id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车次Id")
|
||||
private Long transportTripsId;
|
||||
|
||||
@ApiModelProperty(value = "车辆Id")
|
||||
private Long truckId;
|
||||
|
||||
@ApiModelProperty(value = "司机Id")
|
||||
private List<Long> driverId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.sl.ms.web.manager.vo.work;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sl.ms.web.manager.vo.agency.AgencySimpleVO;
|
||||
import com.sl.ms.web.manager.vo.auth.SysUserVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TransportTripsVO;
|
||||
import com.sl.ms.web.manager.vo.baseTruck.TruckVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "运输任务信息")
|
||||
public class TaskTransportVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "车次")
|
||||
private TransportTripsVO transportTrips;
|
||||
|
||||
@ApiModelProperty(value = "起始机构")
|
||||
private AgencySimpleVO startAgency;
|
||||
|
||||
@ApiModelProperty(value = "目的机构")
|
||||
private AgencySimpleVO endAgency;
|
||||
|
||||
@ApiModelProperty(value = "任务状态,1为待执行(对应 待提货)、2为进行中(对应在途)、3为待确认(保留状态)、4为已完成(对应 已交付)、5为已取消")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "任务分配状态(2已分配3待人工分配)")
|
||||
private Integer assignedStatus;
|
||||
|
||||
@ApiModelProperty(value = "满载状态(1.半载2.满载3.空载)")
|
||||
private Integer loadingStatus;
|
||||
|
||||
@ApiModelProperty(value = "车辆")
|
||||
private TruckVO truck;
|
||||
|
||||
@ApiModelProperty(value = "提货凭证")
|
||||
private String cargoPickUpPicture;
|
||||
|
||||
@ApiModelProperty(value = "货物照片")
|
||||
private String cargoPicture;
|
||||
|
||||
@ApiModelProperty(value = "运回单凭证")
|
||||
private String transportCertificate;
|
||||
|
||||
@ApiModelProperty(value = "计划发车时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime planDepartureTime;
|
||||
|
||||
@ApiModelProperty(value = "实际发车时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime actualDepartureTime;
|
||||
|
||||
@ApiModelProperty(value = "计划到达时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime planArrivalTime;
|
||||
|
||||
@ApiModelProperty(value = "实际到达时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime actualArrivalTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "交付货物照片")
|
||||
private String deliverPicture;
|
||||
|
||||
@ApiModelProperty(value = "提货纬度")
|
||||
private String deliveryLatitude;
|
||||
|
||||
@ApiModelProperty(value = "提货经度")
|
||||
private String deliveryLongitude;
|
||||
|
||||
@ApiModelProperty(value = "交付纬度")
|
||||
private String deliverLatitude;
|
||||
|
||||
@ApiModelProperty(value = "交付经度")
|
||||
private String deliverLongitude;
|
||||
|
||||
@ApiModelProperty(value = "任务创建时间")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "运单列表")
|
||||
private List<TransportOrderVO> transportOrders;
|
||||
|
||||
@ApiModelProperty(value = "司机列表")
|
||||
private List<SysUserVO> drivers;
|
||||
|
||||
@ApiModelProperty(value = "运单数量")
|
||||
private Integer transportOrderCount;
|
||||
|
||||
@ApiModelProperty(value = "司机姓名,查询条件")
|
||||
private String driverName;
|
||||
|
||||
@ApiModelProperty(value = "剩余时间")
|
||||
private String remainingTime;
|
||||
|
||||
@ApiModelProperty(value = "线路名称")
|
||||
private String transportLineName;
|
||||
|
||||
@ApiModelProperty(value = "线路Id")
|
||||
private Long transportLineId;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updated;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user