Browse Source

陆运修改

sunhz 3 years ago
parent
commit
eff17cc62b
24 changed files with 518 additions and 83 deletions
  1. 12 1
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/CorpsAttn.java
  2. 4 11
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/CorpsDesc.java
  3. 11 5
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/LandDriver.java
  4. 0 3
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/feign/ICorpsDescClient.java
  5. 3 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/OrderItem.java
  6. 0 11
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
  7. 0 5
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
  8. 10 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
  9. 30 0
      blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsAttnController.java
  10. 0 9
      blade-service/blade-client/src/main/java/org/springblade/client/corps/feign/CorpsDescClient.java
  11. 11 2
      blade-service/blade-client/src/main/java/org/springblade/client/corps/service/ICorpsAttnService.java
  12. 52 0
      blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsAttnServiceImpl.java
  13. 0 6
      blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java
  14. 16 1
      blade-service/blade-client/src/main/java/org/springblade/client/land/controller/LandDriverController.java
  15. 14 0
      blade-service/blade-client/src/main/java/org/springblade/client/land/controller/LandVehicleController.java
  16. 103 0
      blade-service/blade-client/src/main/java/org/springblade/client/land/excel/DriverExcel.java
  17. 159 0
      blade-service/blade-client/src/main/java/org/springblade/client/land/excel/VehicleExcel.java
  18. 26 22
      blade-service/blade-client/src/main/java/org/springblade/client/land/service/impl/LandDriverServiceImpl.java
  19. 10 2
      blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderItemController.java
  20. 8 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/IOrderItemService.java
  21. 42 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderItemServiceImpl.java
  22. 1 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderServiceImpl.java
  23. 0 5
      blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
  24. 6 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

+ 12 - 1
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/CorpsAttn.java

@@ -17,8 +17,8 @@
 package org.springblade.client.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -92,6 +92,11 @@ public class CorpsAttn implements Serializable {
 	@ApiModelProperty(value = "版本")
 	private String version;
 	/**
+	 * 用户ID
+	 */
+	@ApiModelProperty(value = "用户ID")
+	private Long userId;
+	/**
 	 * 租户id
 	 */
 	@ApiModelProperty(value = "租户id")
@@ -137,4 +142,10 @@ public class CorpsAttn implements Serializable {
 
 	private String email;
 
+	@TableField(exist = false)
+	private String deptId;
+
+	@TableField(exist = false)
+	private String roleId;
+
 }

+ 4 - 11
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/CorpsDesc.java

@@ -16,7 +16,10 @@
  */
 package org.springblade.client.entity;
 
-import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -201,11 +204,6 @@ public class CorpsDesc implements Serializable {
 	@ApiModelProperty(value = "版本")
 	private String version;
 	/**
-	 * 用户id
-	 */
-	@ApiModelProperty(value = "用户id")
-	private Long userId;
-	/**
 	 * 租户id
 	 */
 	@ApiModelProperty(value = "租户id")
@@ -351,9 +349,4 @@ public class CorpsDesc implements Serializable {
 	@ApiModelProperty(value = "使用车辆数量")
 	private Integer vehicleCount;
 
-	@TableField(exist = false)
-	private String userType;
-
-	@TableField(exist = false)
-	private String deptId;
 }

+ 11 - 5
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/LandDriver.java

@@ -82,7 +82,9 @@ public class LandDriver implements Serializable {
 	 * 驾驶证有效期
 	 */
 	@ApiModelProperty(value = "驾驶证有效期")
-	private String driveExpire;
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date driveExpire;
 	/**
 	 * 资格证证件号
 	 */
@@ -92,7 +94,9 @@ public class LandDriver implements Serializable {
 	 * 资格证有效期
 	 */
 	@ApiModelProperty(value = "资格证有效期")
-	private String qualifiedExpire;
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date qualifiedExpire;
 	/**
 	 * 押运证证件号
 	 */
@@ -102,7 +106,9 @@ public class LandDriver implements Serializable {
 	 * 押运证有效期
 	 */
 	@ApiModelProperty(value = "押运证有效期")
-	private String escortExpire;
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date escortExpire;
 	/**
 	 * 状态(0 正常 1停用)
 	 */
@@ -160,9 +166,9 @@ public class LandDriver implements Serializable {
 	private String fleetName;
 
 	@TableField(exist = false)
-	private String userType;
+	private String deptId;
 
 	@TableField(exist = false)
-	private String deptId;
+	private String roleId;
 
 }

+ 0 - 3
blade-service-api/blade-client-api/src/main/java/org/springblade/client/feign/ICorpsDescClient.java

@@ -105,7 +105,4 @@ public interface ICorpsDescClient {
 	@GetMapping(GET_COUNT)
 	int getCount();
 
-	@GetMapping(GET_FLEET_ID)
-	Long getFleetId(@RequestParam("userId") Long userId);
-
 }

+ 3 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/OrderItem.java

@@ -339,4 +339,7 @@ public class OrderItem implements Serializable {
 	@TableField(exist = false)
 	private List<CommonFile> fileList;
 
+	@TableField(exist = false)
+	private List<Long> idList;
+
 }

+ 0 - 11
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java

@@ -51,7 +51,6 @@ public interface ISysClient {
 	String POST_NAMES = API_PREFIX + "/post-names";
 	String ROLE = API_PREFIX + "/role";
 	String ROLE_IDS = API_PREFIX + "/role-ids";
-	String ROLE_ID_STRING = API_PREFIX + "/role-id-string";
 	String ROLE_NAME = API_PREFIX + "/role-name";
 	String ROLE_NAMES = API_PREFIX + "/role-names";
 	String ROLE_ALIAS = API_PREFIX + "/role-alias";
@@ -209,16 +208,6 @@ public interface ISysClient {
 	R<String> getRoleIds(@RequestParam("tenantId") String tenantId, @RequestParam("roleNames") String roleNames);
 
 	/**
-	 * 获取角色id
-	 *
-	 * @param tenantId  租户id
-	 * @param roleAlias 角色名
-	 * @return 角色id
-	 */
-	@GetMapping(ROLE_ID_STRING)
-	R<String> getRoleIdString(@RequestParam("tenantId") String tenantId, @RequestParam("roleAlias") String... roleAlias);
-
-	/**
 	 * 获取角色名
 	 *
 	 * @param id 主键

+ 0 - 5
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java

@@ -111,11 +111,6 @@ public class ISysClientFallback implements ISysClient {
 	}
 
 	@Override
-	public R<String> getRoleIdString(String tenantId, String... roleAlias) {
-		return R.fail("获取数据失败");
-	}
-
-	@Override
 	public R<String> getRoleName(Long id) {
 		return R.fail("获取数据失败");
 	}

+ 10 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java

@@ -48,6 +48,7 @@ public interface IUserClient {
 	String USER_INFO_BY_ACCOUNT = API_PREFIX + "/user-info-by-account";
 	String USER_AUTH_INFO = API_PREFIX + "/user-auth-info";
 	String SAVE_USER = API_PREFIX + "/save-user";
+	String UPDATE_USER = API_PREFIX + "/update-user";
 	String REMOVE_USER = API_PREFIX + "/remove-user";
 	String GAIN_USER = API_PREFIX + "/gainUser";
 	String USER_INFO_BY_NAME=API_PREFIX+"/user-info-by-name";
@@ -127,6 +128,15 @@ public interface IUserClient {
 	R<Boolean> saveUser(@RequestBody User user);
 
 	/**
+	 * 修改用户
+	 *
+	 * @param user 用户实体
+	 * @return
+	 */
+	@PostMapping(UPDATE_USER)
+	R<Boolean> updateUser(@RequestBody User user);
+
+	/**
 	 * 删除用户
 	 *
 	 * @param tenantIds 租户id集合

+ 30 - 0
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsAttnController.java

@@ -1,5 +1,6 @@
 package org.springblade.client.corps.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -12,9 +13,11 @@ import org.springblade.client.vo.CorpsAttnVO;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ObjectUtil;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -113,5 +116,32 @@ public class CorpsAttnController extends BladeController {
 		return R.status(corpsAttnService.removeByIds(Func.toLongList(ids)));
 	}
 
+	/**
+	 * 创建用户
+	 */
+	@PostMapping("/user")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "创建用户", notes = "传入corpsAttn")
+	public R user(@RequestBody CorpsAttn corpsAttn) {
+		return corpsAttnService.createUser(corpsAttn);
+	}
+
+	/**
+	 * 获取登录用户客户ID
+	 */
+	@PostMapping("/get-corp")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "获取登录用户客户ID")
+	public R getCorp() {
+		CorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<CorpsAttn>()
+			.eq(CorpsAttn::getUserId, AuthUtil.getUserId())
+			.eq(CorpsAttn::getIsDeleted, 0)
+		);
+
+		if (ObjectUtil.isNotEmpty(corpsAttn)) {
+			return R.data(corpsAttn.getPid());
+		}
+		return R.data(null);
+	}
 
 }

+ 0 - 9
blade-service/blade-client/src/main/java/org/springblade/client/corps/feign/CorpsDescClient.java

@@ -26,7 +26,6 @@ import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.List;
 import java.util.Map;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @NonDS
@@ -141,12 +140,4 @@ public class CorpsDescClient implements ICorpsDescClient {
 			.eq(CorpsDesc::getIsDeleted, 0));
 	}
 
-	@Override
-	@GetMapping(GET_FLEET_ID)
-	public Long getFleetId(Long userId) {
-		return service.getOne(new LambdaQueryWrapper<CorpsDesc>()
-			.eq(CorpsDesc::getUserId, userId)
-			.eq(CorpsDesc::getIsDeleted, 0)
-		).getId();
-	}
 }

+ 11 - 2
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/ICorpsAttnService.java

@@ -1,9 +1,10 @@
 package org.springblade.client.corps.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.client.entity.CorpsAttn;
 import org.springblade.client.vo.CorpsAttnVO;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.tool.api.R;
 
 /**
  * 客户联系人 服务类
@@ -35,4 +36,12 @@ public interface ICorpsAttnService extends IService<CorpsAttn> {
 	 */
 	String selectCorpsAttnCname(CorpsAttn corpsAttn);
 
+	/**
+	 * 创建用户
+	 *
+	 * @param corpsAttn
+	 * @return
+	 */
+	R createUser(CorpsAttn corpsAttn);
+
 }

+ 52 - 0
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsAttnServiceImpl.java

@@ -2,12 +2,21 @@ package org.springblade.client.corps.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
+import org.springblade.client.constant.LandConstant;
 import org.springblade.client.corps.mapper.CorpsAttnMapper;
 import org.springblade.client.corps.service.ICorpsAttnService;
 import org.springblade.client.entity.CorpsAttn;
 import org.springblade.client.vo.CorpsAttnVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 客户联系人 服务实现类
@@ -19,6 +28,8 @@ import org.springframework.stereotype.Service;
 @AllArgsConstructor
 public class CorpsAttnServiceImpl extends ServiceImpl<CorpsAttnMapper, CorpsAttn> implements ICorpsAttnService {
 
+	private final IUserClient userClient;
+
 	@Override
 	public IPage<CorpsAttnVO> selectCorpsAttnPage(IPage<CorpsAttnVO> page, CorpsAttnVO corpsAttn) {
 		return page.setRecords(baseMapper.selectCorpsAttnPage(page, corpsAttn));
@@ -48,4 +59,45 @@ public class CorpsAttnServiceImpl extends ServiceImpl<CorpsAttnMapper, CorpsAttn
 		}
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class)
+	public R createUser(CorpsAttn corpsAttn) {
+		CorpsAttn attn = baseMapper.selectById(corpsAttn.getId());
+
+		User user = new User();
+		user.setTenantId(AuthUtil.getTenantId());
+		user.setUserType(1);
+		user.setAccount(attn.getCname());
+		user.setName(attn.getCname());
+		user.setRealName(attn.getCname());
+		user.setUserType(1);
+		user.setPhone(attn.getTel());
+		user.setRoleId(attn.getRoleId());
+		user.setDeptId(attn.getDeptId());
+
+		if (ObjectUtil.isNotEmpty(attn.getUserId())) {
+			user.setId(attn.getUserId());
+			R<Boolean> result = userClient.updateUser(user);
+
+			if (!result.isSuccess()) {
+				throw new ServiceException(result.getMsg());
+			}
+		} else {
+			user.setPassword(LandConstant.USER_PASSWORD);
+			R<Boolean> result = userClient.saveUser(user);
+			if (!result.isSuccess()) {
+				throw new ServiceException(result.getMsg());
+			}
+
+			R<User> userTemp = userClient.userByAccount(AuthUtil.getTenantId(), attn.getCname());
+			if (!userTemp.isSuccess()) {
+				throw new ServiceException(userTemp.getMsg());
+			}
+			attn.setUserId(userTemp.getData().getId());
+			baseMapper.updateById(attn);
+		}
+		return R.success("操作成功");
+	}
+
 }

+ 0 - 6
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java

@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
-import org.springblade.client.constant.LandConstant;
 import org.springblade.client.corps.excel.CorpsCompanyExcel;
 import org.springblade.client.corps.excel.CorpsExcel;
 import org.springblade.client.corps.excel.CorpsSupplierExcel;
@@ -22,11 +20,7 @@ import org.springblade.client.vo.CorpsDescVO;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.CollectionUtil;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.system.feign.ISysClient;
-import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;

+ 16 - 1
blade-service/blade-client/src/main/java/org/springblade/client/land/controller/LandDriverController.java

@@ -29,9 +29,11 @@ import org.springblade.client.corps.service.ICorpsDescService;
 import org.springblade.client.entity.CommonFile;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.LandDriver;
+import org.springblade.client.land.excel.DriverExcel;
 import org.springblade.client.land.service.ILandDriverService;
 import org.springblade.client.vo.LandDriverVO;
 import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -41,7 +43,9 @@ import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -158,6 +162,17 @@ public class LandDriverController extends BladeController {
 		return R.status(landDriverService.saveDriver(landDriver));
 	}
 
+	/**
+	 * 导出模板
+	 */
+	@GetMapping("/export-template")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "导出模板")
+	public void exportPrice(HttpServletResponse response) {
+		List<DriverExcel> list = new ArrayList<>();
+		ExcelUtil.export(response, "导出模板-陆运司机", "导入数据表", list, DriverExcel.class);
+	}
+
 
 	/**
 	 * 删除 陆运司机表
@@ -173,7 +188,7 @@ public class LandDriverController extends BladeController {
 	 * 创建用户
 	 */
 	@PostMapping("/user")
-	@ApiOperationSupport(order = 8)
+	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "删除", notes = "传入ids")
 	public R user(@RequestBody LandDriver landDriver) {
 		return landDriverService.createUser(landDriver);

+ 14 - 0
blade-service/blade-client/src/main/java/org/springblade/client/land/controller/LandVehicleController.java

@@ -27,11 +27,13 @@ import org.springblade.client.common.service.ICommonFileService;
 import org.springblade.client.constant.LandConstant;
 import org.springblade.client.corps.service.ICorpsDescService;
 import org.springblade.client.entity.*;
+import org.springblade.client.land.excel.VehicleExcel;
 import org.springblade.client.land.service.ILandDriverService;
 import org.springblade.client.land.service.ILandVehicleChangeService;
 import org.springblade.client.land.service.ILandVehicleService;
 import org.springblade.client.vo.LandVehicleVO;
 import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -43,7 +45,9 @@ import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -217,5 +221,15 @@ public class LandVehicleController extends BladeController {
 		return R.status(landVehicleService.removeVehicle(Func.toLongList(ids)));
 	}
 
+	/**
+	 * 导出模板
+	 */
+	@GetMapping("/export-template")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "导出模板")
+	public void exportPrice(HttpServletResponse response) {
+		List<VehicleExcel> list = new ArrayList<>();
+		ExcelUtil.export(response, "导出模板-陆运车辆", "导入数据表", list, VehicleExcel.class);
+	}
 
 }

+ 103 - 0
blade-service/blade-client/src/main/java/org/springblade/client/land/excel/DriverExcel.java

@@ -0,0 +1,103 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.land.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 陆运司机Excel
+ *
+ * @author BladeX
+ * @since 2022-03-08
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class DriverExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 司机姓名
+	 */
+	@ExcelProperty(value = "司机姓名")
+	private String name;
+	/**
+	 * 所属车队
+	 */
+	@ExcelProperty(value = "所属车队")
+	private String fleetName;
+	/**
+	 * 身份证号
+	 */
+	@ExcelProperty(value = "身份证号")
+	private String idCard;
+	/**
+	 * 准驾车型
+	 */
+	@ExcelProperty(value = "准驾车型")
+	private String permitModel;
+	/**
+	 * 电话
+	 */
+	@ExcelProperty(value = "电话")
+	private String tel;
+	/**
+	 * 性别
+	 */
+	@ExcelProperty(value = "性别")
+	private String sex;
+	/**
+	 * 驾驶证有效期
+	 */
+	@ExcelProperty(value = "驾驶证有效期")
+	private Date driveExpire;
+	/**
+	 * 资格证证件号
+	 */
+	@ExcelProperty(value = "资格证证件号")
+	private String qualifiedNo;
+	/**
+	 * 资格证有效期
+	 */
+	@ExcelProperty(value = "资格证有效期")
+	private Date qualifiedExpire;
+	/**
+	 * 押运证证件号
+	 */
+	@ExcelProperty(value = "押运证证件号")
+	private String escortNo;
+	/**
+	 * 押运证有效期
+	 */
+	@ExcelProperty(value = "押运证有效期")
+	private Date escortExpire;
+	/**
+	 * 备注
+	 */
+	@ExcelProperty(value = "备注")
+	private String remarks;
+
+}

+ 159 - 0
blade-service/blade-client/src/main/java/org/springblade/client/land/excel/VehicleExcel.java

@@ -0,0 +1,159 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.land.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 陆运车辆Excel
+ *
+ * @author BladeX
+ * @since 2022-03-08
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class VehicleExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 所属车队
+	 */
+	@ExcelProperty(value = "所属车队")
+	private String fleetName;
+	/**
+	 * 所属司机
+	 */
+	@ExcelProperty(value = "所属司机")
+	private String driverName;
+	/**
+	 * 车牌号
+	 */
+	@ExcelProperty(value = "车牌号")
+	private String plateNo;
+	/**
+	 * 挂车号
+	 */
+	@ExcelProperty(value = "挂车号")
+	private String trailerNo;
+	/**
+	 * 燃油类型
+	 */
+	@ExcelProperty(value = "燃油类型")
+	private String fuelType;
+	/**
+	 * 车辆类型
+	 */
+	@ExcelProperty(value = "车辆类型")
+	private String type;
+	/**
+	 * 品牌
+	 */
+	@ExcelProperty(value = "品牌")
+	private String brand;
+	/**
+	 * 制造单位
+	 */
+	@ExcelProperty(value = "制造单位")
+	private String manufacturer;
+	/**
+	 * 发证机关
+	 */
+	@ExcelProperty(value = "发证机关")
+	private String issuingAuthority;
+	/**
+	 * 牵引车辆型号
+	 */
+	@ExcelProperty(value = "牵引车辆型号")
+	private String towModel;
+	/**
+	 * 牵引车车架号
+	 */
+	@ExcelProperty(value = "牵引车车架号")
+	private String towVin;
+	/**
+	 * 挂车型号
+	 */
+	@ExcelProperty(value = "挂车型号")
+	private String trailerModel;
+	/**
+	 * 挂车车架号
+	 */
+	@ExcelProperty(value = "挂车车架号")
+	private String trailerVin;
+	/**
+	 * 发动机型号
+	 */
+	@ExcelProperty(value = "发动机型号")
+	private String engineModel;
+	/**
+	 * 核载人数
+	 */
+	@ExcelProperty(value = "核载人数")
+	private Integer allowPassenger;
+	/**
+	 * 购车日期
+	 */
+	@ExcelProperty(value = "购车日期")
+	private Date purchaseDate;
+	/**
+	 * 注册日期
+	 */
+	@ExcelProperty(value = "注册日期")
+	private Date registerDate;
+	/**
+	 * 报废日期
+	 */
+	@ExcelProperty(value = "报废日期")
+	private Date scrapDate;
+	/**
+	 * 外廓尺寸(mm)
+	 */
+	@ExcelProperty(value = "外廓尺寸(mm)")
+	private BigDecimal oto;
+	/**
+	 * 总重量(kg)
+	 */
+	@ExcelProperty(value = "总重量(kg)")
+	private BigDecimal totalWeight;
+	/**
+	 * 核定重量(kg)
+	 */
+	@ExcelProperty(value = "核定重量(kg)")
+	private BigDecimal approvedWeight;
+	/**
+	 * 装备重量(kg)
+	 */
+	@ExcelProperty(value = "装备重量(kg)")
+	private BigDecimal equipmentWeight;
+	/**
+	 * 备注
+	 */
+	@ExcelProperty(value = "备注")
+	private String remarks;
+
+}

+ 26 - 22
blade-service/blade-client/src/main/java/org/springblade/client/land/service/impl/LandDriverServiceImpl.java

@@ -28,10 +28,10 @@ import org.springblade.client.entity.LandDriver;
 import org.springblade.client.land.mapper.LandDriverMapper;
 import org.springblade.client.land.service.ILandDriverService;
 import org.springblade.client.vo.LandDriverVO;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
@@ -54,8 +54,6 @@ public class LandDriverServiceImpl extends ServiceImpl<LandDriverMapper, LandDri
 
 	private final IUserClient userClient;
 
-	private final ISysClient sysClient;
-
 	@Override
 	public IPage<LandDriverVO> selectLandDriverPage(IPage<LandDriverVO> page, LandDriverVO landDriver) {
 		return page.setRecords(baseMapper.selectLandDriverPage(page, landDriver));
@@ -113,34 +111,40 @@ public class LandDriverServiceImpl extends ServiceImpl<LandDriverMapper, LandDri
 	@GlobalTransactional(rollbackFor = Exception.class)
 	public R createUser(LandDriver landDriver) {
 		LandDriver driver = baseMapper.selectById(landDriver.getId());
-		if (ObjectUtil.isEmpty(driver)) {
-			return R.fail("操作失败");
-		}
-
-		R<String> sysMessage;
-		if (LandConstant.IS_ADMIN.equals(landDriver.getUserType())) {
-			sysMessage = sysClient.getRoleIdString(AuthUtil.getTenantId(), LandConstant.DRIVER_ROLE, LandConstant.LAND_ADMIN);
-		} else {
-			sysMessage = sysClient.getRoleIdString(AuthUtil.getTenantId(), LandConstant.DRIVER_ROLE, LandConstant.LAND_OPERATOR);
-		}
-
-		if (!sysMessage.isSuccess() || sysMessage.getData() == null) {
-			return R.fail("缺少必要角色");
-		}
 
 		User user = new User();
 		user.setTenantId(AuthUtil.getTenantId());
 		user.setUserType(1);
 		user.setAccount(driver.getName());
-		user.setPassword(LandConstant.USER_PASSWORD);
 		user.setName(driver.getName());
 		user.setRealName(driver.getName());
-		user.setRoleId(sysMessage.getData());
+		user.setUserType(1);
+		user.setSex(driver.getSex());
+		user.setPhone(driver.getTel());
+		user.setRoleId(landDriver.getRoleId());
 		user.setDeptId(landDriver.getDeptId());
-		userClient.saveUser(user);
 
-		driver.setUserId(user.getId());
-		baseMapper.updateById(driver);
+		if (ObjectUtil.isNotEmpty(driver.getUserId())) {
+			user.setId(driver.getUserId());
+			R<Boolean> result = userClient.updateUser(user);
+
+			if (!result.isSuccess()) {
+				throw new ServiceException(result.getMsg());
+			}
+		} else {
+			user.setPassword(LandConstant.USER_PASSWORD);
+			R<Boolean> result = userClient.saveUser(user);
+			if (!result.isSuccess()) {
+				throw new ServiceException(result.getMsg());
+			}
+
+			R<User> userTemp = userClient.userByAccount(AuthUtil.getTenantId(), driver.getName());
+			if (!userTemp.isSuccess()) {
+				throw new ServiceException(userTemp.getMsg());
+			}
+			driver.setUserId(userTemp.getData().getId());
+			baseMapper.updateById(driver);
+		}
 		return R.success("操作成功");
 	}
 

+ 10 - 2
blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderItemController.java

@@ -22,7 +22,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
-import org.springblade.client.entity.CommonFile;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -34,7 +33,6 @@ import org.springblade.land.vo.OrderItemVO;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.List;
 
 /**
  * 陆运订单明细表 控制器
@@ -144,6 +142,16 @@ public class OrderItemController extends BladeController {
 	}
 
 	/**
+	 * 调度
+	 */
+	@PostMapping("/dispatch-batch")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "调度", notes = "传入orderItem")
+	public R dispatchBatch(@RequestBody OrderItem orderItem) {
+		return R.data(orderItemService.dispatchBatch(orderItem));
+	}
+
+	/**
 	 * 取消调度
 	 */
 	@GetMapping("/cancel-dispatch")

+ 8 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/IOrderItemService.java

@@ -77,6 +77,14 @@ public interface IOrderItemService extends IService<OrderItem> {
 	OrderItem dispatch(OrderItem orderItem);
 
 	/**
+	 * 调度
+	 *
+	 * @param orderItem
+	 * @return
+	 */
+	List<OrderItem> dispatchBatch(OrderItem orderItem);
+
+	/**
 	 * 取消调度
 	 *
 	 * @param id

+ 42 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderItemServiceImpl.java

@@ -207,6 +207,48 @@ public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
+	public List<OrderItem> dispatchBatch(OrderItem orderItem) {
+		orderItem.getIdList().forEach(id -> {
+			OrderItem item = new OrderItem();
+			item.setId(id);
+			item.setFleetId(orderItem.getFleetId());
+			item.setStatus(1);
+			item.setDispatchTime(new Date());
+			item.setUpdateUser(AuthUtil.getUserId());
+			item.setUpdateTime(new Date());
+			baseMapper.updateById(item);
+
+			addChange(baseMapper.selectById(id), 1);
+		});
+
+		List<OrderItem> itemList = baseMapper.selectList(new LambdaQueryWrapper<OrderItem>()
+			.eq(OrderItem::getOrderId, orderItem.getOrderId())
+			.eq(OrderItem::getKind, 2)
+			.eq(OrderItem::getIsDeleted, 0)
+		);
+		itemList.forEach(item -> {
+			if (ObjectUtil.isNotEmpty(item.getFleetId())) {
+				R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getFleetId());
+				if (corpMessage.isSuccess() && corpMessage.getData() != null) {
+					item.setFleetName(corpMessage.getData().getCname());
+				}
+			}
+
+			if (ObjectUtil.isNotEmpty(item.getDriverId())) {
+				LandDriver driver = landDriverClient.getDriver(item.getDriverId());
+				item.setDriverName(driver.getName());
+			}
+		});
+
+		Order order = new Order();
+		order.setId(orderItem.getOrderId());
+		order.setStatus(2);
+		orderMapper.updateById(order);
+		return itemList;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public OrderItem cancelDispatch(Long id) {
 		baseMapper.update(null, new LambdaUpdateWrapper<OrderItem>()
 			.set(OrderItem::getFleetId, null)

+ 1 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderServiceImpl.java

@@ -188,6 +188,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		if (order.getKind() == 1) {
 			orderQueryWrapper.orderByDesc(Order::getCreateTime);
 		} else if (order.getKind() == 2) {
+			orderQueryWrapper.ne(Order::getStatus, 0);
 			orderQueryWrapper.orderByDesc(Order::getUpdateTime);
 		}
 

+ 0 - 5
blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java

@@ -164,11 +164,6 @@ public class SysClient implements ISysClient {
 	}
 
 	@Override
-	public R<String> getRoleIdString(String tenantId, String... roleAlias) {
-		return R.data(roleService.getRoleIdString(tenantId, roleAlias));
-	}
-
-	@Override
 	@GetMapping(ROLE_NAME)
 	public R<String> getRoleName(Long id) {
 		return R.data(roleService.getById(id).getRoleName());

+ 6 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

@@ -107,6 +107,12 @@ public class UserClient implements IUserClient {
 	}
 
 	@Override
+	@PostMapping(UPDATE_USER)
+	public R<Boolean> updateUser(@RequestBody User user) {
+		return R.data(service.updateUser(user));
+	}
+
+	@Override
 	@PostMapping(REMOVE_USER)
 	public R<Boolean> removeUser(String tenantIds) {
 		return R.data(service.remove(Wrappers.<User>query().lambda().in(User::getTenantId, Func.toStrList(tenantIds))));