Browse Source

陆运修改

sunhz 3 years ago
parent
commit
3a57d66d9d

+ 2 - 17
blade-service-api/blade-client-api/src/main/java/org/springblade/client/constant/LandConstant.java

@@ -13,9 +13,9 @@ public interface LandConstant {
 	String ORDER = "LAND_ORDER";
 
 	/**
-	 * 陆运车队
+	 * 陆运订单明细
 	 */
-	String FLEET = "BASIC_LAND_FLEET";
+	String ORDER_ITEM = "LAND_ORDER_ITEM";
 
 	/**
 	 * 陆运司机
@@ -28,16 +28,6 @@ public interface LandConstant {
 	String VEHICLE = "BASIC_LAND_VEHICLE";
 
 	/**
-	 * 客户角色
-	 */
-	String CORP_ROLE = "CORP";
-
-	/**
-	 * 车队角色
-	 */
-	String FLEET_ROLE = "FLEET";
-
-	/**
 	 * 司机角色
 	 */
 	String DRIVER_ROLE = "DRIVER";
@@ -62,9 +52,4 @@ public interface LandConstant {
 	 */
 	String USER_PASSWORD = "123456";
 
-	/**
-	 * 车队角色
-	 */
-	String FLEET_CHINESE = "车队";
-
 }

+ 26 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/CorpsDesc.java

@@ -325,6 +325,32 @@ public class CorpsDesc implements Serializable {
     //本月待到账返利
     private BigDecimal monthProfit;
 
+	/**
+	 * 道路经营许可证号
+	 */
+	@ApiModelProperty(value = "道路经营许可证号")
+	private String roadOperationKey;
+	/**
+	 * 道路经营许可范围
+	 */
+	@ApiModelProperty(value = "道路经营许可范围")
+	private String roadOperationScope;
+	/**
+	 * 登记机关
+	 */
+	@ApiModelProperty(value = "登记机关")
+	private String registrationAuthority;
+	/**
+	 * 成立日期
+	 */
+	@ApiModelProperty(value = "成立日期")
+	private Date establishDate;
+	/**
+	 * 使用车辆数量
+	 */
+	@ApiModelProperty(value = "使用车辆数量")
+	private Integer vehicleCount;
+
 	@TableField(exist = false)
 	private String userType;
 

+ 1 - 5
blade-service-api/blade-client-api/src/main/java/org/springblade/client/feign/ILandDriverClient.java

@@ -11,11 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 )
 public interface ILandDriverClient {
 	String API_PREFIX = "/client";
-	String GET_DRIVER_ID = API_PREFIX + "/getDriverId";
-	String GET_DRIVER = API_PREFIX + "/getDriverId";
-
-	@GetMapping(GET_DRIVER_ID)
-	Long getDriverId(@RequestParam("userId") Long userId);
+	String GET_DRIVER = API_PREFIX + "/getDriver";
 
 	@GetMapping(GET_DRIVER)
 	LandDriver getDriver(@RequestParam("id") Long id);

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

@@ -23,11 +23,13 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springblade.client.entity.CommonFile;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 陆运订单明细表实体类
@@ -334,4 +336,7 @@ public class OrderItem implements Serializable {
 	@TableField(exist = false)
 	private String addressDetail;
 
+	@TableField(exist = false)
+	private List<CommonFile> fileList;
+
 }

+ 8 - 18
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescController.java

@@ -105,16 +105,6 @@ public class CorpsDescController extends BladeController {
 	}
 
 	/**
-	 * 车队详情
-	 */
-	@GetMapping("/fleet-list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "车队", notes = "传入corpsDesc")
-	public R<List<CorpsDesc>> fleetList(CorpsDesc corpsDesc) {
-		return R.data(corpsDescService.getFleetList(corpsDesc));
-	}
-
-	/**
 	 * 自定义分页 客户详情
 	 */
 	@GetMapping("/page")
@@ -296,9 +286,9 @@ public class CorpsDescController extends BladeController {
 		}
 		LambdaQueryWrapper<CorpsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		if ("KG".equals(corpsDesc.getCorpType())) {
-			lambdaQueryWrapper.in(CorpsDesc::getCorpType, "KH", "GYS");
+			lambdaQueryWrapper.and(i -> i.like(CorpsDesc::getCorpType, "KH").or().like(CorpsDesc::getCorpType, "GYS"));
 		} else {
-			lambdaQueryWrapper.eq(CorpsDesc::getCorpType, corpsDesc.getCorpType());
+			lambdaQueryWrapper.like(CorpsDesc::getCorpType, corpsDesc.getCorpType());
 		}
 		lambdaQueryWrapper.like(Func.isNotEmpty(corpsDesc.getCname()), CorpsDesc::getCname, corpsDesc.getCname());
 		lambdaQueryWrapper.like(Func.isNotEmpty(corpsDesc.getCode()), CorpsDesc::getCode, corpsDesc.getCode());
@@ -318,13 +308,13 @@ public class CorpsDescController extends BladeController {
 	}
 
 	/**
-	 * 创建用
+	 * 同步客
 	 */
-	@GetMapping("/user")
-	@ApiOperationSupport(order = 8)
-	@ApiOperation(value = "删除", notes = "传入ids")
-	public R user(@RequestBody CorpsDesc corpsDesc) {
-		return corpsDescService.createUser(corpsDesc);
+	@PostMapping("/copy")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "同步客户", notes = "传入corpsDesc")
+	public R copy(@RequestBody CorpsDesc corpsDesc) {
+		return corpsDescService.copy(corpsDesc);
 	}
 
 }

+ 2 - 2
blade-service/blade-client/src/main/java/org/springblade/client/corps/mapper/CorpsDescMapper.xml

@@ -65,10 +65,10 @@
             and code like CONCAT(CONCAT('%', #{CorpsDesc.code}), '%')
         </if>
         <if test="CorpsDesc.corpType!=null and CorpsDesc.corpType != '' and CorpsDesc.corpType != 'KG'">
-            and corp_type = #{CorpsDesc.corpType}
+            and corp_type like CONCAT('%', #{CorpsDesc.corpType}, '%')
         </if>
         <if test="CorpsDesc.corpType!=null and CorpsDesc.corpType != '' and CorpsDesc.corpType == 'KG'">
-            and corp_type in ('KH','GYS')
+            and (corp_type like '%KH%' or corp_type like '%GYS%')
         </if>
         <if test="CorpsDesc.cname!=null and CorpsDesc.cname != ''">
             and cname like CONCAT(CONCAT('%', #{CorpsDesc.cname}), '%')

+ 2 - 9
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/ICorpsDescService.java

@@ -115,18 +115,11 @@ public interface ICorpsDescService extends IService<CorpsDesc> {
 	R importSupplierDesc(List<CorpsSupplierExcel> data, Boolean isCovered, String corpType);
 
 	/**
-	 * 自定义分页
-	 *
-	 * @return
-	 */
-	List<CorpsDesc> getFleetList(CorpsDesc corpsDesc);
-
-	/**
-	 * 创建用户
+	 * 同步客户
 	 *
 	 * @param corpsDesc
 	 * @return
 	 */
-	R createUser(CorpsDesc corpsDesc);
+	R copy(CorpsDesc corpsDesc);
 
 }

+ 4 - 68
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java

@@ -423,78 +423,14 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
 		}
 	}
 
-	@Override
-	public List<CorpsDesc> getFleetList(CorpsDesc corpsDesc) {
-		CorpsType corpsType = corpsTypeMapper.selectOne(new LambdaQueryWrapper<CorpsType>()
-			.eq(CorpsType::getCname, LandConstant.FLEET_CHINESE)
-			.eq(CorpsType::getTenantId, AuthUtil.getTenantId())
-			.eq(CorpsType::getIsDeleted, 0)
-		);
-
-		if (ObjectUtil.isEmpty(corpsType)) {
-			return null;
-		}
-
-		List<Long> corpIdList = corpsTypeDescMapper.selectList(new LambdaQueryWrapper<CorpsTypeDesc>()
-			.eq(CorpsTypeDesc::getCorpTypeId, corpsType.getId())
-		).stream().map(CorpsTypeDesc::getCorpId).collect(Collectors.toList());
-
-		if (CollectionUtil.isEmpty(corpIdList)) {
-			return null;
-		}
-
-		return baseMapper.selectList(new LambdaQueryWrapper<CorpsDesc>()
-			.like(StringUtil.isNotBlank(corpsDesc.getCname()), CorpsDesc::getCname, corpsDesc.getCname())
-			.in(CorpsDesc::getId, corpIdList)
-			.eq(CorpsDesc::getIsDeleted, 0)
-		);
-	}
 
 	@Override
-	@Transactional(rollbackFor = Exception.class)
-	@GlobalTransactional(rollbackFor = Exception.class)
-	public R createUser(CorpsDesc corpsDesc) {
+	public R copy(CorpsDesc corpsDesc) {
 		CorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
-		if (ObjectUtil.isEmpty(desc)) {
-			return R.fail("操作失败");
-		}
-
-		String typeName = corpsTypeDescMapper.selectTypeName(desc.getId());
-		if (StringUtil.isEmpty(typeName)) {
-			return R.fail("获取客户类型失败");
-		}
-
-		if (LandConstant.FLEET_CHINESE.equals(typeName)) {
-			typeName = LandConstant.FLEET_ROLE;
-		} else {
-			typeName = LandConstant.CORP_ROLE;
-		}
-
-		R<String> sysMessage;
-		if (LandConstant.IS_ADMIN.equals(corpsDesc.getUserType())) {
-			sysMessage = sysClient.getRoleIdString(AuthUtil.getTenantId(), typeName, LandConstant.LAND_ADMIN);
-		} else {
-			sysMessage = sysClient.getRoleIdString(AuthUtil.getTenantId(), typeName, 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(desc.getCname());
-		user.setPassword(LandConstant.USER_PASSWORD);
-		user.setName(desc.getCname());
-		user.setRealName(desc.getCname());
-		user.setRoleId(sysMessage.getData());
-		user.setDeptId(corpsDesc.getDeptId());
-		userClient.saveUser(user);
-
-		desc.setUserId(user.getId());
+		desc.setCorpType(desc.getCorpType() + "," + corpsDesc.getCorpType());
 		baseMapper.updateById(desc);
-		return R.success("操作成功");
+		saveOrUpdateTypeDesc(corpsDesc, AuthUtil.getUserId(), corpsDesc.getId(), new Date(), desc.getTenantId());
+		return R.success("同步成功");
 	}
 
 

+ 1 - 9
blade-service/blade-client/src/main/java/org/springblade/client/land/feign/LandDriverClient.java

@@ -19,15 +19,7 @@ public class LandDriverClient implements ILandDriverClient {
 	private final ILandDriverService landDriverService;
 
 	@Override
-	@GetMapping(GET_DRIVER_ID)
-	public Long getDriverId(Long userId) {
-		return landDriverService.getOne(new LambdaQueryWrapper<LandDriver>()
-			.eq(LandDriver::getUserId, userId)
-			.eq(LandDriver::getIsDeleted, 0)
-		).getId();
-	}
-
-	@Override
+	@GetMapping(GET_DRIVER)
 	public LandDriver getDriver(Long id) {
 		return landDriverService.getById(id);
 	}

+ 22 - 0
blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderItemController.java

@@ -22,6 +22,7 @@ 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;
@@ -33,6 +34,7 @@ import org.springblade.land.vo.OrderItemVO;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * 陆运订单明细表 控制器
@@ -201,4 +203,24 @@ public class OrderItemController extends BladeController {
 		return R.status(orderItemService.finished(id));
 	}
 
+	/**
+	 * 附件上传
+	 */
+	@PostMapping("/file")
+	@ApiOperationSupport(order = 15)
+	@ApiOperation(value = "附件上传", notes = "传入fileList")
+	public R file(@RequestBody OrderItem orderItem) {
+		return R.status(orderItemService.file(orderItem));
+	}
+
+	/**
+	 * 附件列表
+	 */
+	@GetMapping("/file-list")
+	@ApiOperationSupport(order = 16)
+	@ApiOperation(value = "附件列表", notes = "传入id")
+	public R fileList(Long id) {
+		return R.data(orderItemService.fileList(id));
+	}
+
 }

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

@@ -18,6 +18,7 @@ package org.springblade.land.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.client.entity.CommonFile;
 import org.springblade.core.mp.support.Query;
 import org.springblade.land.entity.OrderItem;
 import org.springblade.land.vo.OrderItemVO;
@@ -123,4 +124,20 @@ public interface IOrderItemService extends IService<OrderItem> {
 	 */
 	boolean finished(Long id);
 
+	/**
+	 * 附件上传
+	 *
+	 * @param orderItem
+	 * @return
+	 */
+	boolean file(OrderItem orderItem);
+
+	/**
+	 * 附件上传
+	 *
+	 * @param id
+	 * @return
+	 */
+	List<CommonFile> fileList(Long id);
+
 }

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

@@ -21,9 +21,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 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.entity.CommonFile;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.LandDriver;
+import org.springblade.client.feign.ICommonFileClient;
 import org.springblade.client.feign.ICorpsDescClient;
 import org.springblade.client.feign.ILandDriverClient;
 import org.springblade.core.mp.support.Condition;
@@ -65,6 +69,8 @@ public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem
 
 	private final ILandDriverClient landDriverClient;
 
+	private final ICommonFileClient commonFileClient;
+
 	@Override
 	public IPage<OrderItemVO> selectOrderItemPage(IPage<OrderItemVO> page, OrderItemVO orderItem) {
 		return page.setRecords(baseMapper.selectOrderItemPage(page, orderItem));
@@ -317,6 +323,28 @@ public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem
 		return true;
 	}
 
+	@Override
+	@GlobalTransactional(rollbackFor = Exception.class)
+	public boolean file(OrderItem orderItem) {
+		List<CommonFile> fileList = orderItem.getFileList();
+		fileList.forEach(file -> {
+			if (ObjectUtil.isEmpty(file.getId())) {
+				file.setPid(orderItem.getId());
+				file.setSource(LandConstant.ORDER_ITEM);
+			}
+		});
+		return true;
+	}
+
+	@Override
+	public List<CommonFile> fileList(Long id) {
+		R<List<CommonFile>> fileList = commonFileClient.getList(id, LandConstant.ORDER_ITEM);
+		if (fileList.isSuccess() && fileList.getData() != null) {
+			return fileList.getData();
+		}
+		return Collections.emptyList();
+	}
+
 	private void addChange(OrderItem orderItem, Integer status) {
 		OrderChange change = new OrderChange();
 		change.setOrderId(orderItem.getOrderId());