Browse Source

2022年12月2日17:57:06

纪新园 3 years ago
parent
commit
7d342e1a8a
16 changed files with 449 additions and 43 deletions
  1. 12 0
      blade-service-api/blade-box-tube-api/src/main/java/org/springblade/box/tube/entity/TradingBox.java
  2. 1 1
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/vo/DataAnalysisVO.java
  3. 1 1
      blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/controller/ArchivesController.java
  4. 10 0
      blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/controller/TradingBoxRentController.java
  5. 2 0
      blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/ITradingBoxService.java
  6. 123 2
      blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/impl/TradingBoxServiceImpl.java
  7. 1 0
      blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/impl/TransportServiceImpl.java
  8. 11 2
      blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescController.java
  9. 79 0
      blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescPartsController.java
  10. 28 21
      blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsTypeController.java
  11. 2 0
      blade-service/blade-client/src/main/java/org/springblade/client/corps/mapper/CorpsDescMapper.java
  12. 155 0
      blade-service/blade-client/src/main/java/org/springblade/client/corps/mapper/CorpsDescMapper.xml
  13. 8 2
      blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java
  14. 6 4
      blade-service/blade-land/src/main/java/org/springblade/land/controller/StatisticsAnalysisController.java
  15. 8 8
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/OrderMapper.xml
  16. 2 2
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/partsapp/AppPartsController.java

+ 12 - 0
blade-service-api/blade-box-tube-api/src/main/java/org/springblade/box/tube/entity/TradingBox.java

@@ -205,5 +205,17 @@ public class TradingBox implements Serializable {
 	@ApiModelProperty(value = "箱数")
 	private int boxNumber;
 
+	/**
+	 * 起租,退租
+	 */
+	@TableField(exist = false)
+	private String rentType;
+
+	/**
+	 * 起租,退租日期
+	 */
+	@TableField(exist = false)
+	private Date rentDate;
+
 
 }

+ 1 - 1
blade-service-api/blade-land-api/src/main/java/org/springblade/land/vo/DataAnalysisVO.java

@@ -44,7 +44,7 @@ public class DataAnalysisVO {
 	private BigDecimal freightPay;
 
 	//平台购买数
-	private int platformBuy;
+	private BigDecimal platformBuy;
 
 	//租户
 	private String tenantId;

+ 1 - 1
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/controller/ArchivesController.java

@@ -197,7 +197,7 @@ public class ArchivesController extends BladeController {
 			.eq(ObjectUtils.isNotNull(archives.getBoxSource()), Archives::getBoxSource, archives.getBoxSource());
 		lambdaQueryWrapper.eq(ObjectUtils.isNotNull(archives.getBoxMakingCompanyId()), Archives::getBoxMakingCompanyId, archives.getBoxMakingCompanyId());
 		lambdaQueryWrapper.eq(ObjectUtils.isNotNull(archives.getBoxStatus()), Archives::getBoxStatus, archives.getBoxStatus());
-		lambdaQueryWrapper.eq( Archives::getStatus, "使用");
+		lambdaQueryWrapper.eq( Archives::getStatus, "使用");
 		List<Archives> list = new ArrayList<>();
 		IPage<Archives> pages = archivesService.page(Condition.getPage(query), lambdaQueryWrapper);
 		if (pages.getRecords().size() > 0) {

+ 10 - 0
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/controller/TradingBoxRentController.java

@@ -197,5 +197,15 @@ public class TradingBoxRentController extends BladeController {
 		return R.data(check);
 	}
 
+	/**
+	 * 起租
+	 */
+	@PostMapping("/startingRent")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入tradingBox")
+	public R startingRent(@Valid @RequestBody TradingBox tradingBox) {
+		return R.data(tradingBoxService.startingRent(tradingBox));
+	}
+
 
 }

+ 2 - 0
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/ITradingBoxService.java

@@ -54,4 +54,6 @@ public interface ITradingBoxService extends IService<TradingBox> {
 	R passCancel(Long id);
 
 	TradingBox withdrawTradingBox(TradingBox tradingBox);
+
+	TradingBox startingRent(TradingBox tradingBox);
 }

+ 123 - 2
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/impl/TradingBoxServiceImpl.java

@@ -17,12 +17,10 @@
 package org.springblade.box.tube.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
@@ -198,6 +196,16 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		List<TradingBoxItem> tradingBoxItemList = tradingBox.getTradingBoxItemsList();
 		if (ObjectUtils.isNotNull(tradingBoxItemList) && tradingBoxItemList.size() > 0) {
 			for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
+				if ("BUY".equals(tradingBox.getType())) {
+					tradingBoxItem.setBoxSource("购买");
+					tradingBoxItem.setBoxStatus("待使用");
+				} else {
+					if (tradingBoxItem.getBoxSource().equals("购买")) {
+						tradingBoxItem.setBoxStatus("卖出");
+					} else {
+						tradingBoxItem.setBoxStatus("退租");
+					}
+				}
 				if (tradingBoxItem.getId() == null) {
 					tradingBoxItem.setCreateUser(AuthUtil.getUserId());
 					tradingBoxItem.setCreateTime(new Date());
@@ -777,6 +785,119 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 	}
 
 	/**
+	 * 起租,退租
+	 *
+	 * @param tradingBox
+	 * @return
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	public TradingBox startingRent(TradingBox tradingBox) {
+		if ("1".equals(tradingBox.getRentType())) {
+			List<TradingBoxItem> tradingBoxItemList = tradingBox.getTradingBoxItemsList();
+			if (tradingBoxItemList.size() < 1) {
+				throw new RuntimeException("明细不能为空");
+			}
+			for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
+				tradingBoxItem.setLeaseCommencementDate(tradingBox.getRentDate());
+				tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
+				tradingBoxItem.setUpdateTime(new Date());
+				tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
+				tradingBoxItemMapper.updateById(tradingBoxItem);
+				if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
+					//更新箱档案信息
+					Archives archivesR = archivesMapper.selectOne(new LambdaQueryWrapper<Archives>().eq(Archives::getIsDeleted, 0).eq(Archives::getTenantId, AuthUtil.getTenantId()).eq(Archives::getCode, tradingBoxItem.getCode()));
+					Archives archives = new Archives();
+					if (ObjectUtils.isNotNull(archivesR)) {
+						BeanUtil.copy(archivesR, archives);
+					}
+
+					if (tradingBox.getType().equals("ZR")){
+						archives.setCode(tradingBoxItem.getCode());
+						archives.setName(tradingBoxItem.getBoxType());
+						archives.setVolume(tradingBoxItem.getVolume());
+						archives.setGorssWeight(tradingBoxItem.getGrossWeight());
+						archives.setStatus(tradingBoxItem.getStatus());
+						archives.setTypeId(tradingBoxItem.getBoxTypeId());
+						archives.setAddressId(tradingBoxItem.getAddressId());
+						archives.setAddress(tradingBoxItem.getAddress());
+						archives.setNewDate(tradingBoxItem.getNewDate());
+						archives.setEmptyWeight(tradingBoxItem.getEmptyWeight());
+						archives.setTare(tradingBoxItem.getTare());
+						archives.setLoadingWeight(tradingBoxItem.getLoadingWeight());
+						archives.setBoxMakingCompany(tradingBoxItem.getBoxMakingCompany());
+						archives.setBoxMakingCompanyId(tradingBoxItem.getBoxMakingCompanyId());
+						archives.setBoxMakingDate(tradingBoxItem.getBoxMakingDate());
+						archives.setLeaseCommencementDate(tradingBoxItem.getLeaseCommencementDate());
+						archives.setBoxAge(tradingBoxItem.getBoxAge());
+						archives.setPurchaseDate(tradingBox.getPurchaseDate());
+						archives.setContractNo(tradingBox.getContractNo());
+						archives.setBoxSource("租入");
+						archives.setBoxStatus("待使用");
+						archives.setLeasingCompanyId(tradingBox.getPurchaseCompanyId());
+						archives.setLeasingCompany(tradingBox.getPurchaseCompanyName());
+						if (ObjectUtils.isNotNull(archivesR)) {
+							archives.setUpdateTime(new Date());
+							archives.setUpdateUserName(AuthUtil.getUserName());
+							archives.setUpdateUser(AuthUtil.getUserId());
+							archivesMapper.updateById(archives);
+
+						} else {
+							archives.setBoxSource(tradingBoxItem.getBoxSource());
+							archives.setBoxStatus(tradingBoxItem.getBoxStatus());
+							archives.setCreateUser(AuthUtil.getUserId());
+							archives.setCreateTime(new Date());
+							archives.setCreateUserName(AuthUtil.getUserName());
+							archives.setTenantId(AuthUtil.getTenantId());
+							archivesMapper.insert(archives);
+							List<ArchivesFiles> archivesFilesList = BeanUtil.copy(tradingBoxItem.getTradingBoxFilesList(), ArchivesFiles.class);
+							for (ArchivesFiles archivesFiles : archivesFilesList) {
+								archivesFiles.setId(null);
+								archivesFiles.setPid(archives.getId());
+								archivesFiles.setFileName(archivesFiles.getLabel());
+								archivesFiles.setUrl(archivesFiles.getValue());
+								archivesFiles.setCreateUser(AuthUtil.getUserId());
+								archivesFiles.setCreateTime(new Date());
+								archivesFilesMapper.insert(archivesFiles);
+							}
+						}
+					}else{
+
+					}
+
+
+
+					//记录箱轨迹信息
+					ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
+					if ("ZR".equals(tradingBox.getType())) {
+						archivesTrajectory.setStatus("租入");
+					} else if ("ZC".equals(tradingBox.getType())) {
+						archivesTrajectory.setStatus("租出");
+					}
+					archivesTrajectory.setContractNo(tradingBox.getContractNo());
+					archivesTrajectory.setBillType(tradingBox.getType());
+					archivesTrajectory.setCode(tradingBoxItem.getCode());
+					archivesTrajectory.setAddress(tradingBoxItem.getAddress());
+					archivesTrajectory.setNewDate(tradingBoxItem.getNewDate());
+					archivesTrajectory.setCreateTime(new Date());
+					archivesTrajectory.setCreateUser(AuthUtil.getUserId());
+					archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
+					archivesTrajectory.setTenantId(AuthUtil.getTenantId());
+					archivesTrajectoryMapper.insert(archivesTrajectory);
+				} else {
+					throw new RuntimeException("箱号不能为空");
+				}
+
+			}
+
+		} else {
+
+		}
+		return null;
+	}
+
+	/**
 	 * 订单生成账单 并且推送财务消息
 	 *
 	 * @param billType 货款类型: 申请 收费 付费

+ 1 - 0
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/impl/TransportServiceImpl.java

@@ -217,6 +217,7 @@ public class TransportServiceImpl extends ServiceImpl<TransportMapper, Transport
 				//更新箱档案信息
 				if (ObjectUtils.isNotNull(transportItem.getCode())) {
 					Archives archives = new Archives();
+					archives.setBoxStatus("使用中");
 					archives.setCode(transportItem.getCode());
 					archives.setAddress(transportItem.getAddress());
 					archives.setAddressId(transportItem.getAddressId());

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

@@ -358,7 +358,12 @@ public class CorpsDescController extends BladeController {
 		lambdaQueryWrapper.eq(CorpsDesc::getTenantId, AuthUtil.getTenantId());
 		lambdaQueryWrapper.eq(CorpsDesc::getIsDeleted, 0);
 		lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCname()), CorpsDesc::getCname, corpsDesc.getCname());
-		lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCorpType()), CorpsDesc::getCorpType, corpsDesc.getCorpType());
+		if ("234557".equals(AuthUtil.getTenantId())){
+//			lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCorpType()), CorpsDesc::getCorpType, corpsDesc.getCorpType());
+			lambdaQueryWrapper.apply("find_in_set(corp_type,'" + corpsDesc.getCorpType() + "')");
+		}else{
+			lambdaQueryWrapper.like(StringUtil.isNotBlank(corpsDesc.getCorpType()), CorpsDesc::getCorpType, corpsDesc.getCorpType());
+		}
 
 		String role = AuthUtil.getUserRole();
 		if (!role.contains("admin")){//admin能看全部,不是admin根据分管员查询
@@ -565,7 +570,11 @@ public class CorpsDescController extends BladeController {
 		if ("KG".equals(corpsDesc.getCorpType())) {
 			lambdaQueryWrapper.and(i -> i.like(CorpsDesc::getCorpType, "KH").or().like(CorpsDesc::getCorpType, "GYS"));
 		} else {
-			lambdaQueryWrapper.like(CorpsDesc::getCorpType, corpsDesc.getCorpType());
+			if ("234557".equals(AuthUtil.getTenantId())){
+				lambdaQueryWrapper.apply("find_in_set(corp_type,'" + corpsDesc.getCorpType() + "')");
+			}else{
+				lambdaQueryWrapper.like(CorpsDesc::getCorpType, corpsDesc.getCorpType());
+			}
 		}
 		String role = AuthUtil.getUserRole();
 		if (!role.contains("admin")){//admin能看全部,不是admin根据分管员查询

+ 79 - 0
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescPartsController.java

@@ -1,23 +1,39 @@
 package org.springblade.client.corps.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.client.corps.service.ICorpsDescService;
+import org.springblade.client.corps.service.ICorpsTypeDescService;
+import org.springblade.client.corps.service.ICorpsTypeService;
+import org.springblade.client.corps.service.impl.CorpsAddrServiceImpl;
 import org.springblade.client.dto.CorpsDescDto;
+import org.springblade.client.entity.CorpsAddr;
 import org.springblade.client.entity.CorpsDesc;
+import org.springblade.client.entity.CorpsType;
+import org.springblade.client.entity.CorpsTypeDesc;
+import org.springblade.client.feign.IRedisClient;
+import org.springblade.client.vo.CorpsDescVO;
 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.CollectionUtil;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.finance.feign.IFinanceClient;
 import org.springblade.purchase.sales.entity.Order;
 import org.springblade.purchase.sales.feign.IOrderDescClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -26,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
 import java.math.BigDecimal;
 import java.math.MathContext;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 客户详情 控制器(配件系统)
@@ -40,7 +57,11 @@ import java.util.*;
 public class CorpsDescPartsController extends BladeController {
 
 	private final ICorpsDescService corpsDescService;
+	private final ICorpsTypeService corpsTypeService;
+	private final IUserClient userClient;
 	private final IOrderDescClient orderDescClient;
+	private final ICorpsTypeDescService corpsTypeDescService;
+	private CorpsAddrServiceImpl corpsAddrService;
 
 	/**
 	 * 详情
@@ -253,4 +274,62 @@ public class CorpsDescPartsController extends BladeController {
 		return R.data(map);
 	}
 
+	/**
+	 * 分页 客户详情
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入corpsDesc")
+	public R<IPage<CorpsDescVO>> list(CorpsDescVO corpsDesc, Query query) {
+		IPage<CorpsDescVO> pages = corpsDescService.selectCorpsDescPage(Condition.getPage(query), corpsDesc);
+
+		String belongtocompany = "";//所属公司ids
+		for (CorpsDescVO descVO: pages.getRecords()){
+			if (ObjectUtil.isNotEmpty(descVO.getBelongtocompany())){
+				belongtocompany = belongtocompany + descVO.getBelongtocompany() + ",";
+			}
+		}
+		List<CorpsDesc> corpsDescList = corpsDescService.selectByCorpIds(belongtocompany);
+
+		if (CollectionUtils.isNotEmpty(pages.getRecords())) {
+			pages.getRecords().forEach(item -> {
+				if (StringUtils.isNotBlank(item.getAdminProfiles())) {
+					List<User> updateUserList = userClient.selectUserIds(item.getAdminProfiles());
+					StringBuffer stringBuffer = new StringBuffer();
+					if (CollectionUtils.isNotEmpty(updateUserList)) {
+						updateUserList.forEach(items -> {
+							if (items != null) {
+								stringBuffer.append(items.getName()).append(",");
+							}
+						});
+					}
+					item.setAdminProfilesName(stringBuffer.toString());
+				}
+				if (item.getBelongtocompany() != null){
+					if (ObjectUtil.isNotEmpty(corpsDescList)) {
+						item.setBelongCompany(corpsDescList.stream().filter(e -> e.getId().toString().equals(item.getBelongtocompany())).findFirst().get().getCname());
+					}
+				}
+
+				List<Long> typeIdList = corpsTypeDescService.list(new LambdaQueryWrapper<CorpsTypeDesc>().eq(CorpsTypeDesc::getCorpId, item.getId()))
+					.stream().map(CorpsTypeDesc::getCorpTypeId).collect(Collectors.toList());
+
+				if (CollectionUtil.isNotEmpty(typeIdList)) {
+					String typeName = corpsTypeService.list(new LambdaQueryWrapper<CorpsType>()
+						.in(CorpsType::getId, typeIdList)
+						.eq(CorpsType::getCorpType, item.getCorpType())
+						.eq(CorpsType::getIsDeleted, 0)
+					).stream().map(CorpsType::getCname).collect(Collectors.joining(","));
+					item.setCorpsTypeName(typeName);
+				}
+				//获取客户地址
+				List<CorpsAddr> corpsAddrList = corpsAddrService.list(new QueryWrapper<CorpsAddr>().eq("pid", item.getId()).eq("is_deleted", 0).eq("status", 0).eq("type", 0));
+				if (corpsAddrList != null && corpsAddrList.size()>0) {
+					item.setAddr(corpsAddrList.get(0).getDetailedAddress());
+				}
+			});
+		}
+		return R.data(pages);
+	}
+
 }

+ 28 - 21
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsTypeController.java

@@ -16,28 +16,29 @@
  */
 package org.springblade.client.corps.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
+import org.springblade.client.corps.service.ICorpsTypeService;
 import org.springblade.client.entity.CorpsType;
+import org.springblade.client.vo.CorpsTypeVO;
+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.BladeUser;
+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.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.client.vo.CorpsTypeVO;
-import org.springblade.client.corps.service.ICorpsTypeService;
-import org.springblade.core.boot.ctrl.BladeController;
 
+import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -106,12 +107,12 @@ public class CorpsTypeController extends BladeController {
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入corpsType")
 	public R update(@Valid @RequestBody CorpsType corpsType) {
-		if (corpsType.getId() == null){
-			return R.fail(500,"请选择要删除的数据");
+		if (corpsType.getId() == null) {
+			return R.fail(500, "请选择要删除的数据");
 		}
 		Integer count = corpsTypeService.count(new QueryWrapper<CorpsType>().eq("parent_id", corpsType.getId()).eq("is_deleted", 0));
-		if (count != null && count>0){
-			return R.fail(500,"存在下级类别不能删除");
+		if (count != null && count > 0) {
+			return R.fail(500, "存在下级类别不能删除");
 		}
 		corpsType.setIsDeleted(1);
 		return R.status(corpsTypeService.updateById(corpsType));
@@ -124,14 +125,14 @@ public class CorpsTypeController extends BladeController {
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入corpsType")
 	public R submit(@Valid @RequestBody CorpsType corpsType) {
-		if (StringUtils.isBlank(corpsType.getTenantId())){
+		if (StringUtils.isBlank(corpsType.getTenantId())) {
 			corpsType.setTenantId(SecureUtil.getTenantId());
 		}
-		if (StringUtils.isBlank(corpsType.getCname())){
-			return R.fail(500,"名称不能为空");
+		if (StringUtils.isBlank(corpsType.getCname())) {
+			return R.fail(500, "名称不能为空");
 		}
-		if ("NotUNIQUE".equals(corpsTypeService.selectCorpsTypeCname(corpsType))){
-			return R.fail(500,"名称已存在");
+		if ("NotUNIQUE".equals(corpsTypeService.selectCorpsTypeCname(corpsType))) {
+			return R.fail(500, "名称已存在");
 		}
 		return R.status(corpsTypeService.saveMessage(corpsType));
 	}
@@ -146,6 +147,7 @@ public class CorpsTypeController extends BladeController {
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 		return R.status(corpsTypeService.removeByIds(Func.toLongList(ids)));
 	}
+
 	/**
 	 * 获取客户类别树形结构
 	 *
@@ -154,18 +156,19 @@ public class CorpsTypeController extends BladeController {
 	@GetMapping("/tree")
 	@ApiOperationSupport(order = 7)
 	@ApiOperation(value = "树形结构", notes = "树形结构")
-	public R<List<CorpsTypeVO>> tree(String tenantId, BladeUser bladeUser,String corpType) {
-		List<CorpsTypeVO> tree = corpsTypeService.tree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()),corpType);
+	public R<List<CorpsTypeVO>> tree(String tenantId, BladeUser bladeUser, String corpType) {
+		List<CorpsTypeVO> tree = corpsTypeService.tree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), corpType);
 		return R.data(tree);
 	}
+
 	/**
 	 * 懒加载获取部门树形结构
 	 */
 	@GetMapping("/lazy-tree")
 	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "懒加载树形结构", notes = "树形结构")
-	public R<List<CorpsTypeVO>> lazyTree(String tenantId, Long parentId, BladeUser bladeUser,String corpType,String cname) {
-		List<CorpsTypeVO> tree = corpsTypeService.lazyTree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId,corpType,cname);
+	public R<List<CorpsTypeVO>> lazyTree(String tenantId, Long parentId, BladeUser bladeUser, String corpType, String cname) {
+		List<CorpsTypeVO> tree = corpsTypeService.lazyTree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId, corpType, cname);
 		return R.data(tree);
 	}
 
@@ -176,7 +179,11 @@ public class CorpsTypeController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入corpsType")
 	public R<List<CorpsType>> list(CorpsType corpsType) {
-		List<CorpsType> pages = corpsTypeService.list(Condition.getQueryWrapper(corpsType));
+		LambdaQueryWrapper<CorpsType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(CorpsType::getIsDeleted, 0)
+			.eq(CorpsType::getTenantId, AuthUtil.getTenantId())
+			.apply("find_in_set(corp_type,'" + corpsType.getCorpType() + "')");
+		List<CorpsType> pages = corpsTypeService.list(lambdaQueryWrapper);
 		return R.data(pages);
 	}
 

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

@@ -106,4 +106,6 @@ public interface CorpsDescMapper extends BaseMapper<CorpsDesc> {
 	 * @return
 	 */
 	List<CorpsDescDto> selectPartsCorpsStatistics(@Param("CorpsDesc")CorpsDescDto corpsDescDto);
+
+	List<CorpsDescVO> selectCorpsDescPageZD(IPage page, @Param("CorpsDesc") CorpsDescVO corpsDesc);
 }

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

@@ -490,4 +490,159 @@
         </if>
         ORDER BY cname ASC
     </select>
+    <select id="selectCorpsDescPageZD" resultType="org.springblade.client.vo.CorpsDescVO">
+        select
+        *
+        from
+        basic_corps_desc
+        where
+        1 = 1
+        <if test="CorpsDesc.id!=null">
+            and id = #{CorpsDesc.id}
+        </if>
+        <if test="CorpsDesc.isDeleted!=null">
+            and is_deleted = #{CorpsDesc.isDeleted}
+        </if>
+        <if test="CorpsDesc.code!=null and CorpsDesc.code != ''">
+            and code like CONCAT(CONCAT('%', #{CorpsDesc.code}), '%')
+        </if>
+        <if test="CorpsDesc.corpType!=null and CorpsDesc.corpType != '' and CorpsDesc.corpType != 'KG'">
+            and find_in_set(corp_type ,#{CorpsDesc.corpType})
+        </if>
+        <if test="CorpsDesc.corpType!=null and CorpsDesc.corpType != '' and CorpsDesc.corpType == 'KG'">
+            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}), '%')
+        </if>
+        <if test="CorpsDesc.line!=null and CorpsDesc.line != ''">
+            and line like CONCAT(CONCAT('%', #{CorpsDesc.line}), '%')
+        </if>
+        <if test="CorpsDesc.enname!=null and CorpsDesc.enname != ''">
+            and enname = #{CorpsDesc.enname}
+        </if>
+        <if test="CorpsDesc.goodtypes!=null and CorpsDesc.goodtypes != ''">
+            and goodtypes like CONCAT(CONCAT('%', #{CorpsDesc.goodtypes}), '%')
+        </if>
+        <if test="CorpsDesc.companytype!=null and CorpsDesc.companytype != ''">
+            and companytype = #{CorpsDesc.companytype}
+        </if>
+        <if test="CorpsDesc.belongtoarea!=null and CorpsDesc.belongtoarea != ''">
+            and belongtoarea like CONCAT(CONCAT('%',  #{CorpsDesc.belongtoarea}), '%')
+        </if>
+        <if test="CorpsDesc.attn!=null and CorpsDesc.attn != ''">
+            and attn like CONCAT(CONCAT('%',  #{CorpsDesc.attn}), '%')
+        </if>
+        <if test="CorpsDesc.tel!=null and CorpsDesc.tel != ''">
+            and tel = #{CorpsDesc.tel}
+        </if>
+        <if test="CorpsDesc.position!=null and CorpsDesc.position != ''">
+            and id = #{CorpsDesc.position}
+        </if>
+        <if test="CorpsDesc.invioceTitle!=null and CorpsDesc.invioceTitle != ''">
+            and invioce_title = #{CorpsDesc.invioceTitle}
+        </if>
+        <if test="CorpsDesc.taxCode!=null and CorpsDesc.taxCode != ''">
+            and tax_code = #{CorpsDesc.taxCode}
+        </if>
+        <if test="CorpsDesc.invioceAddrTel!=null and CorpsDesc.invioceAddrTel != ''">
+            and invioce_addr_tel = #{CorpsDesc.invioceAddrTel}
+        </if>
+        <if test="CorpsDesc.accountName!=null and CorpsDesc.accountName != ''">
+            and account_name = #{CorpsDesc.accountName}
+        </if>
+        <if test="CorpsDesc.accountBank!=null and CorpsDesc.accountBank != ''">
+            and account_bank = #{CorpsDesc.accountBank}
+        </if>
+        <if test="CorpsDesc.accountNo!=null and CorpsDesc.accountNo != ''">
+            and account_no = #{CorpsDesc.accountNo}
+        </if>
+        <if test="CorpsDesc.accountNameFcy!=null and CorpsDesc.accountNameFcy != ''">
+            and account_name_fcy = #{CorpsDesc.accountNameFcy}
+        </if>
+        <if test="CorpsDesc.accountBankFcy!=null and CorpsDesc.accountBankFcy != ''">
+            and account_bank_fcy = #{CorpsDesc.accountBankFcy}
+        </if>
+        <if test="CorpsDesc.accountNoFcy!=null and CorpsDesc.accountNoFcy != ''">
+            and account_no_fcy = #{CorpsDesc.accountNoFcy}
+        </if>
+        <if test="CorpsDesc.addr!=null and CorpsDesc.addr != ''">
+            and addr = #{CorpsDesc.addr}
+        </if>
+        <if test="CorpsDesc.storageAddr!=null and CorpsDesc.storageAddr != ''">
+            and storage_addr = #{CorpsDesc.storageAddr}
+        </if>
+        <if test="CorpsDesc.subStorageAddr!=null and CorpsDesc.subStorageAddr != ''">
+            and sub_storage_addr = #{CorpsDesc.subStorageAddr}
+        </if>
+        <if test="CorpsDesc.creditstatus!=null and CorpsDesc.creditstatus != ''">
+            and creditstatus = #{CorpsDesc.creditstatus}
+        </if>
+        <if test="CorpsDesc.creditLevel!=null and CorpsDesc.creditLevel != ''">
+            and credit_level like CONCAT(CONCAT('%',  #{CorpsDesc.creditLevel}), '%')
+        </if>
+        <if test="CorpsDesc.adminProfiles!=null and CorpsDesc.adminProfiles != ''">
+            and (admin_profiles like CONCAT(CONCAT('%',  #{CorpsDesc.adminProfiles}), '%')
+            or admin_profiles = '' or admin_profiles IS NULL)
+        </if>
+        <if test="CorpsDesc.belongtocompany!=null and CorpsDesc.belongtocompany != ''">
+            and (belongtocompany = #{CorpsDesc.belongtocompany}
+            or belongtocompany IS NULL)
+        </if>
+        <if test="CorpsDesc.creditGrant!=null">
+            and credit_grant = #{CorpsDesc.creditGrant}
+        </if>
+        <if test="CorpsDesc.creditDay!=null">
+            and credit_day = #{CorpsDesc.creditDay}
+        </if>
+        <if test="CorpsDesc.creditRate!=null">
+            and credit_rate = #{CorpsDesc.creditRate}
+        </if>
+        <if test="CorpsDesc.remarks!=null and CorpsDesc.remarks != ''">
+            and remarks = #{CorpsDesc.remarks}
+        </if>
+        <if test="CorpsDesc.version!=null and CorpsDesc.version != ''">
+            and version = #{CorpsDesc.version}
+        </if>
+        <if test="CorpsDesc.tenantId!=null and CorpsDesc.tenantId != ''">
+            and tenant_id = #{CorpsDesc.tenantId}
+        </if>
+        <if test="CorpsDesc.createUser!=null">
+            and create_user = #{CorpsDesc.createUser}
+        </if>
+        <if test="CorpsDesc.updateUser!=null">
+            and update_user = #{CorpsDesc.updateUser}
+        </if>
+        <if test="CorpsDesc.status!=null">
+            and status = #{CorpsDesc.status}
+        </if>
+        <if test='CorpsDesc.typeList !=null and CorpsDesc.typeList.size>0'>
+            and id in (
+            SELECT
+            DISTINCT
+            corp_id
+            FROM
+            basic_corps_type_desc
+            WHERE
+            status = 0
+            AND corp_type_id in
+            <foreach collection="CorpsDesc.typeList" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
+
+        <if test="CorpsDesc.sort != null and CorpsDesc.sort != '' and CorpsDesc.sort == 0 and CorpsDesc.typeSort == 1">
+            ORDER BY cname ASC
+        </if>
+        <if test="CorpsDesc.sort != null and CorpsDesc.sort != '' and CorpsDesc.sort == 0 and CorpsDesc.typeSort == 2">
+            ORDER BY tel ASC
+        </if>
+        <if test="CorpsDesc.sort != null and CorpsDesc.sort != '' and CorpsDesc.sort == 1 and CorpsDesc.typeSort == 1">
+            ORDER BY cname DESC
+        </if>
+        <if test="CorpsDesc.sort != null and CorpsDesc.sort != '' and CorpsDesc.sort == 1 and CorpsDesc.typeSort == 2">
+            ORDER BY tel DESC
+        </if>
+    </select>
 </mapper>

+ 8 - 2
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/impl/CorpsDescServiceImpl.java

@@ -105,8 +105,14 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
 			String cName = corpsDesc.getCname().replaceAll(" ","");
 			corpsDesc.setCname(cName);
 		}
-		IPage<CorpsDescVO> page1 = page.setRecords(baseMapper.selectCorpsDescPage(page, corpsDesc));
-		return page1;
+		corpsDesc.setIsDeleted(0);
+		if ("234557".equals(AuthUtil.getTenantId())){
+			IPage<CorpsDescVO> page1 = page.setRecords(baseMapper.selectCorpsDescPageZD(page, corpsDesc));
+			return page1;
+		}else{
+			IPage<CorpsDescVO> page1 = page.setRecords(baseMapper.selectCorpsDescPage(page, corpsDesc));
+			return page1;
+		}
 	}
 
 	@Override

+ 6 - 4
blade-service/blade-land/src/main/java/org/springblade/land/controller/StatisticsAnalysisController.java

@@ -28,8 +28,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 
 @RestController
@@ -59,7 +61,7 @@ public class StatisticsAnalysisController {
 			order.setBillType("XS");
 			order.setCorpId(dataAnalysisVO_.getCorpId());
 			List<Order> orderList = orderDescClient.getByBillNo(order);
-			dataAnalysisVO_.setPlatformBuy(orderList.size());
+			dataAnalysisVO_.setPlatformBuy(orderList.stream().map(Order::getDebitAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 		}
 		return R.data(pages);
 	}
@@ -78,7 +80,7 @@ public class StatisticsAnalysisController {
 			order.setBillType("XS");
 			order.setCorpId(dataAnalysisVO_.getCorpId());
 			List<Order> orderList = orderDescClient.getByBillNo(order);
-			dataAnalysisVO_.setPlatformBuy(orderList.size());
+			dataAnalysisVO_.setPlatformBuy(orderList.stream().map(Order::getDebitAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 		}
 		ExcelUtil.export(response, "导出箱档案信息", "导出数据表", BeanUtil.copy(list, DataAnalysisEXcel.class), DataAnalysisEXcel.class);
 	}
@@ -93,7 +95,7 @@ public class StatisticsAnalysisController {
 		LambdaQueryWrapper<LandOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(LandOrder::getIsDeleted, 0)
 			.eq(LandOrder::getTenantId, AuthUtil.getTenantId())
-			.eq(ObjectUtils.isNotNull(dataAnalysisVO.getCorpId()),LandOrder::getCorpId, dataAnalysisVO.getCorpId());
+			.eq(ObjectUtils.isNotNull(dataAnalysisVO.getCorpId()),LandOrder::getFleetId, dataAnalysisVO.getCorpId());
 		if (dataAnalysisVO.getBsDateList() != null && dataAnalysisVO.getBsDateList().size() > 1) {
 			lambdaQueryWrapper.ge(LandOrder::getBsDate, dataAnalysisVO.getBsDateList().get(0));
 			lambdaQueryWrapper.le(LandOrder::getBsDate, dataAnalysisVO.getBsDateList().get(1));
@@ -102,7 +104,7 @@ public class StatisticsAnalysisController {
 		List<DataAnalysisVO> dataAnalysisVOList = new ArrayList<>();
 		for (LandOrder landOrder : pages.getRecords()) {
 			DataAnalysisVO DataAnalysisVO_ = new DataAnalysisVO();
-			CorpsDesc corpsDesc = corpsDescClient.getCorpId(landOrder.getCorpId());
+			CorpsDesc corpsDesc = corpsDescClient.getCorpId(landOrder.getFleetId());
 			if (ObjectUtils.isNotNull(corpsDesc)) {
 				DataAnalysisVO_.setCorpName(corpsDesc.getCname());
 			}

+ 8 - 8
blade-service/blade-land/src/main/java/org/springblade/land/mapper/OrderMapper.xml

@@ -169,17 +169,17 @@
             sum( lo.freight_collect ) AS freightCollect
         FROM
             land_order lo
-                LEFT JOIN basic_corps_desc bcd ON lo.corp_id = bcd.id
+                LEFT JOIN basic_corps_desc bcd ON lo.fleet_id = bcd.id
         WHERE
             lo.is_deleted = 0
           AND lo.tenant_id = '234557'
-          AND lo.corp_id != ""
+          AND lo.fleet_id != ""
         <if test="dataAnalysisVO.corpName != null  and  dataAnalysisVO.corpName != ''">and bcd.cname like concat('%', #{dataAnalysisVO.corpName}, '%')</if>
-        <if test="dataAnalysisVO.corpId != null and  dataAnalysisVO.corpId != ''">and lo.corp_id like concat('%', #{dataAnalysisVO.corpId}, '%')</if>
+        <if test="dataAnalysisVO.corpId != null and  dataAnalysisVO.corpId != ''">and lo.fleet_id like concat('%', #{dataAnalysisVO.corpId}, '%')</if>
         <if test="dataAnalysisVO.bsDateList != null and  dataAnalysisVO.bsDateList[0] != ''">and lo.arrival_time &gt;= #{dataAnalysisVO.bsDateList[0]}</if>
         <if test="dataAnalysisVO.bsDateList != null and  dataAnalysisVO.bsDateList[1] != ''">and lo.arrival_time &lt;= #{dataAnalysisVO.bsDateList[1]}</if>
         GROUP BY
-            lo.corp_id
+            lo.fleet_id
     </select>
     <select id="dataAnalysisExport" resultType="org.springblade.land.vo.DataAnalysisVO">
         SELECT
@@ -189,16 +189,16 @@
         sum( lo.freight_collect ) AS freightCollect
         FROM
         land_order lo
-        LEFT JOIN basic_corps_desc bcd ON lo.corp_id = bcd.id
+        LEFT JOIN basic_corps_desc bcd ON lo.fleet_id = bcd.id
         WHERE
         lo.is_deleted = 0
         AND lo.tenant_id = '234557'
-        AND lo.corp_id != ""
+        AND lo.fleet_id != ""
         <if test="dataAnalysisVO.corpName != null  and  dataAnalysisVO.corpName != ''">and bcd.cname like concat('%', #{dataAnalysisVO.corpName}, '%')</if>
-        <if test="dataAnalysisVO.corpId != null and  dataAnalysisVO.corpId != ''">and lo.corp_id like concat('%', #{dataAnalysisVO.corpId}, '%')</if>
+        <if test="dataAnalysisVO.corpId != null and  dataAnalysisVO.corpId != ''">and lo.fleet_id like concat('%', #{dataAnalysisVO.corpId}, '%')</if>
         <if test="dataAnalysisVO.bsDateList != null and  dataAnalysisVO.bsDateList[0] != ''">and lo.arrival_time &gt;= #{dataAnalysisVO.bsDateList[0]}</if>
         <if test="dataAnalysisVO.bsDateList != null and  dataAnalysisVO.bsDateList[1] != ''">and lo.arrival_time &lt;= #{dataAnalysisVO.bsDateList[1]}</if>
         GROUP BY
-        lo.corp_id
+        lo.fleet_id
     </select>
 </mapper>

+ 2 - 2
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/partsapp/AppPartsController.java

@@ -476,7 +476,7 @@ public class AppPartsController extends BladeController {
 	@ApiOperation(value = "分页", notes = "传入order")
 	public R<IPage<Order>> detailsList(OrderVO order, Query query) {
 		LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.eq(Order::getTenantId, order.getTenantId());//租户id
+		lambdaQueryWrapper.eq(Order::getTenantId, AuthUtil.getTenantId());//租户id
 		lambdaQueryWrapper.eq(Order::getIsDeleted, 0);//订单是否有效
 		if (ObjectUtils.isNotNull(order.getCorpsName())) {
 			String corpsName = order.getCorpsName().replaceAll(" ","");
@@ -529,7 +529,7 @@ public class AppPartsController extends BladeController {
 	@ApiOperation(value = "统计分析", notes = "传入orderAcctVO")
 	public void detailsListExport(OrderVO order, HttpServletResponse response) {
 		LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.eq(Order::getTenantId, order.getTenantId());//租户id
+		lambdaQueryWrapper.eq(Order::getTenantId, AuthUtil.getTenantId());//租户id
 		lambdaQueryWrapper.eq(Order::getIsDeleted, 0);//订单是否有效
 		if (ObjectUtils.isNotNull(order.getCorpsName())) {
 			String corpsName = order.getCorpsName().replaceAll(" ","");