Explorar el Código

2022年10月24日17:48:06

纪新园 hace 3 años
padre
commit
df8527603a

+ 155 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/dto/CorpsDescDto.java

@@ -0,0 +1,155 @@
+/*
+ *      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.dto;
+
+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;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 客户详情实体类(配件系统)
+ *
+ * @author BladeX
+ * @since 2021-09-13
+ */
+@Data
+@TableName("basic_corps_desc")
+@ApiModel(value = "CorpsDesc对象", description = "客户详情")
+public class CorpsDescDto implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 主键
+	 */
+	@ApiModelProperty(value = "主键")
+	@TableId(value = "id", type = IdType.ASSIGN_ID)
+	private Long id;
+	/**
+	 * 客户名称
+	 */
+	@ApiModelProperty(value = "客户名称")
+	private String cname;
+	/**
+	 * 客户简称
+	 */
+	@ApiModelProperty(value = "客户简称")
+	private String shortName;
+
+	/**
+	 * 电话
+	 */
+	@ApiModelProperty(value = "电话")
+	private String tel;
+
+	/**
+	 * 状态
+	 */
+	@ApiModelProperty(value = "状态")
+	private Integer status;
+
+	/**
+	 * 是否已删除
+	 */
+	@ApiModelProperty(value = "是否已删除")
+	private Integer isDeleted;
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
+	/**
+	 * 客户类别
+	 */
+	@TableField(exist = false)
+	private String corpsTypeId;
+	/**
+	 * 客户类别
+	 */
+	@TableField(exist = false)
+	private List<Long> typeList;
+
+	/**
+	 * 客户类别中文
+	 */
+	@TableField(exist = false)
+	private String corpsTypeName;
+
+	/**
+	 * 客户类型
+	 */
+	@ApiModelProperty(value = "客户类型")
+	private String corpType;
+
+	/**
+	 * 应收账款
+	 */
+	@TableField(exist = false)
+	private BigDecimal debitAmount;
+	/**
+	 * 已收账款
+	 */
+	@TableField(exist = false)
+	private BigDecimal settlmentAmount;
+	/**
+	 * 未收账款
+	 */
+	@TableField(exist = false)
+	private BigDecimal balanceAmount;
+
+	/**
+	 * 预(收)付款
+	 */
+	@TableField(exist = false)
+	private BigDecimal advancePayment;
+
+	/**
+	 * 开始时间
+	 */
+	@TableField(exist = false)
+	private String startTime;
+
+	/**
+	 * 结束时间
+	 */
+	@TableField(exist = false)
+	private String endTime;
+
+	/**
+	 * 已送货
+	 */
+	@TableField(exist = false)
+	private BigDecimal deliveringAmount;
+
+	/**
+	 * 主键
+	 */
+	@TableField(exist = false)
+	private Long ids;
+
+
+}

+ 1 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/Order.java

@@ -989,4 +989,5 @@ public class Order implements Serializable {
 	 */
 	@TableField(exist = false)
 	private String domesticAbroad;
+
 }

+ 6 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/OrderFees.java

@@ -198,5 +198,11 @@ public class OrderFees implements Serializable {
 	@ApiModelProperty(value = "开票金额")
 	private BigDecimal invoiceAmount;
 
+	/**
+	 * 费用来源
+	 */
+	@ApiModelProperty(value = "费用来源")
+	private String srcType;
+
 
 }

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

@@ -0,0 +1,179 @@
+package org.springblade.client.corps.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+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.dto.CorpsDescDto;
+import org.springblade.client.entity.CorpsDesc;
+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.purchase.sales.entity.Order;
+import org.springblade.purchase.sales.feign.IOrderDescClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 客户详情 控制器(配件系统)
+ *
+ * @author BladeX
+ * @since 2021-09-13
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/partsCorps")
+@Api(value = "客户详情", tags = "客户详情接口")
+public class CorpsDescPartsController extends BladeController {
+
+	private final ICorpsDescService corpsDescService;
+	private final IOrderDescClient orderDescClient;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入corpsDesc")
+	public R<CorpsDesc> detail(CorpsDesc corpsDesc) {
+		CorpsDesc detail = corpsDescService.getMessageByID(corpsDesc);
+		return R.data(detail);
+	}
+
+	/**
+	 * 自定义分页 客户详情
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入corpsDesc")
+	public R<IPage<CorpsDescDto>> page(CorpsDescDto corpsDescDto, Query query) {
+		corpsDescDto.setIsDeleted(0);//默认查有效的
+		corpsDescDto.setTenantId(SecureUtil.getTenantId());
+		IPage<CorpsDescDto> pages = corpsDescService.selectPartsCorpsDescPage(Condition.getPage(query), corpsDescDto);
+		for (CorpsDescDto corpsDescDto1 : pages.getRecords()) {
+			Order order = new Order();
+			order.setCorpId(corpsDescDto1.getId());
+			order.setBillType("XS");
+			order.setTradeType("JXS");
+			order.setStartTime(corpsDescDto.getStartTime());
+			order.setEndTime(corpsDescDto.getEndTime());
+			List<Order> orderList = orderDescClient.getByBillNo(order);
+			if (ObjectUtils.isNotNull(orderList)) {
+				//未收账款
+				corpsDescDto1.setBalanceAmount(orderList.stream().map(Order::getBalanceAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				//应收账款
+				corpsDescDto1.setDebitAmount(orderList.stream().map(Order::getDebitAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				//已收账款
+				corpsDescDto1.setSettlmentAmount(orderList.stream().map(Order::getSettlmentAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				//预(收)付款
+				corpsDescDto1.setAdvancePayment(orderList.stream().map(Order::getAdvancePayment).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+			} else {
+				//未收账款
+				corpsDescDto1.setBalanceAmount(new BigDecimal(0));
+				//应收账款
+				corpsDescDto1.setDebitAmount(new BigDecimal(0));
+				//已收账款
+				corpsDescDto1.setSettlmentAmount(new BigDecimal(0));
+				//预(收)付款
+				corpsDescDto1.setAdvancePayment(new BigDecimal(0));
+			}
+		}
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 客户详情(统计)
+	 */
+	@GetMapping("/pageStatistics")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入corpsDesc")
+	public R<Map<String, Object>> pageStatistics(CorpsDescDto corpsDescDto) {
+		corpsDescDto.setIsDeleted(0);//默认查有效的
+		corpsDescDto.setTenantId(SecureUtil.getTenantId());
+		List<CorpsDescDto> corpsDescDtoList = corpsDescService.selectPartsCorpsStatistics(corpsDescDto);
+		Map<String, Object> map = new HashMap<>();
+		//应收账款
+		BigDecimal debitAmount = new BigDecimal("0.00");
+		//已收账款
+		BigDecimal settlmentAmount = new BigDecimal("0.00");
+		//未收账款
+		BigDecimal balanceAmount = new BigDecimal("0.00");
+		// 预(收)付款
+		BigDecimal advancePayment = new BigDecimal("0.00");
+		for (CorpsDescDto corpsDescDto1 : corpsDescDtoList) {
+			Order order = new Order();
+			order.setCorpId(corpsDescDto1.getId());
+			order.setBillType("XS");
+			order.setTradeType("JXS");
+			order.setStartTime(corpsDescDto.getStartTime());
+			order.setEndTime(corpsDescDto.getEndTime());
+			List<Order> orderList = orderDescClient.getByBillNo(order);
+			if (ObjectUtils.isNotNull(orderList)) {
+				//未收账款
+				balanceAmount = balanceAmount.add(orderList.stream().map(Order::getBalanceAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				//应收账款
+				debitAmount = debitAmount.add(orderList.stream().map(Order::getDebitAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				//已收账款
+				settlmentAmount = settlmentAmount.add(orderList.stream().map(Order::getSettlmentAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				//预(收)付款
+				advancePayment = advancePayment.add(orderList.stream().map(Order::getAdvancePayment).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+			} else {
+				//未收账款
+				corpsDescDto1.setBalanceAmount(new BigDecimal(0));
+				//应收账款
+				corpsDescDto1.setDebitAmount(new BigDecimal(0));
+				//已收账款
+				corpsDescDto1.setSettlmentAmount(new BigDecimal(0));
+				//预(收)付款
+				corpsDescDto1.setAdvancePayment(new BigDecimal(0));
+			}
+		}
+		//未收账款
+		map.put("balanceAmount", balanceAmount);
+		//应收账款
+		map.put("debitAmount", debitAmount);
+		//已收账款
+		map.put("settlmentAmount", settlmentAmount);
+		//预(收)付款
+		map.put("advancePayment", advancePayment);
+		//已送货
+		map.put("deliveringAmount", new BigDecimal(0));
+		return R.data(map);
+	}
+
+	/**
+	 * 客户下拉选
+	 */
+	@GetMapping("/getCorpsAll")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "", notes = "")
+	public R<List<Map<String, Object>>> getCorpsAll() {
+		LambdaQueryWrapper<CorpsDesc> corpsDescQueryWrapper = new LambdaQueryWrapper<>();
+		corpsDescQueryWrapper.eq(CorpsDesc::getIsDeleted, 0).eq(CorpsDesc::getTenantId, AuthUtil.getTenantId()).eq(CorpsDesc::getCorpType, "KH");
+		List<CorpsDesc> corpsDescDtoList = corpsDescService.list(corpsDescQueryWrapper);
+		List<Map<String, Object>> list = new ArrayList<>();
+		for (CorpsDesc corpsDesc : corpsDescDtoList) {
+			Map<String, Object> map = new HashMap<>();
+			map.put("value", corpsDesc.getId());
+			if (ObjectUtils.isNotNull(corpsDesc.getTel())) {
+				map.put("label", corpsDesc.getCname() + "(" + corpsDesc.getTel() + ")");
+			} else {
+				map.put("label", corpsDesc.getCname());
+			}
+			list.add(map);
+		}
+		return R.data(list);
+	}
+
+}

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.SqlParser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
+import org.springblade.client.dto.CorpsDescDto;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.vo.CorpsDescVO;
 import org.springblade.core.datascope.annotation.DataAuth;
@@ -90,4 +91,19 @@ public interface CorpsDescMapper extends BaseMapper<CorpsDesc> {
 	 * @return
 	 */
 	List<CorpsDesc> selectByCorpIds(@Param("ids") List<Long> ids);
+
+	/**
+	 *
+	 * @param page
+	 * @param corpsDescDto
+	 * @return
+	 */
+    List<CorpsDescDto> selectPartsCorpsDescPage(IPage<CorpsDescDto> page, @Param("CorpsDesc") CorpsDescDto corpsDescDto);
+
+	/**
+	 * 列表统计
+	 * @param corpsDescDto
+	 * @return
+	 */
+	List<CorpsDescDto> selectPartsCorpsStatistics(CorpsDescDto corpsDescDto);
 }

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

@@ -374,4 +374,104 @@
             #{id}
         </foreach>
     </select>
+    <select id="selectPartsCorpsDescPage" resultType="org.springblade.client.dto.CorpsDescDto">
+        select
+        id AS id,
+        cname AS cname,
+        short_name AS shortName,
+        tel AS tel,
+        status AS status,
+        corp_type AS corpType
+        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.corpType!=null and CorpsDesc.corpType != ''">
+            and corp_type like CONCAT(CONCAT('%', #{CorpsDesc.corpType}), '%')
+        </if>
+        <if test="CorpsDesc.cname!=null and CorpsDesc.cname != ''">
+            and cname like CONCAT(CONCAT('%', #{CorpsDesc.cname}), '%')
+        </if>
+        <if test="CorpsDesc.tel!=null and CorpsDesc.tel != ''">
+            and tel = #{CorpsDesc.tel}
+        </if>
+        <if test="CorpsDesc.tenantId!=null and CorpsDesc.tenantId != ''">
+            and tenant_id = #{CorpsDesc.tenantId}
+        </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>
+        ORDER BY cname ASC
+    </select>
+    <select id="selectPartsCorpsStatistics" resultType="org.springblade.client.dto.CorpsDescDto">
+        select
+        id AS id,
+        cname AS cname,
+        short_name AS shortName,
+        tel AS tel,
+        status AS status,
+        corp_type AS corpType
+        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.corpType!=null and CorpsDesc.corpType != ''">
+            and corp_type like CONCAT(CONCAT('%', #{CorpsDesc.corpType}), '%')
+        </if>
+        <if test="CorpsDesc.cname!=null and CorpsDesc.cname != ''">
+            and cname like CONCAT(CONCAT('%', #{CorpsDesc.cname}), '%')
+        </if>
+        <if test="CorpsDesc.tel!=null and CorpsDesc.tel != ''">
+            and tel = #{CorpsDesc.tel}
+        </if>
+        <if test="CorpsDesc.tenantId!=null and CorpsDesc.tenantId != ''">
+            and tenant_id = #{CorpsDesc.tenantId}
+        </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>
+        ORDER BY cname ASC
+    </select>
 </mapper>

+ 16 - 0
blade-service/blade-client/src/main/java/org/springblade/client/corps/service/ICorpsDescService.java

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.client.corps.excel.*;
+import org.springblade.client.dto.CorpsDescDto;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.vo.CorpsDescVO;
 import org.springblade.core.tool.api.R;
@@ -180,4 +181,19 @@ public interface ICorpsDescService extends IService<CorpsDesc> {
 	 * @return
 	 */
 	List<CorpsDesc> selectByCorpIds(String ids);
+
+	/**
+	 * 自定义分页 客户详情(配件系统)
+	 * @param page
+	 * @param corpsDescDto
+	 * @return
+	 */
+	IPage<CorpsDescDto> selectPartsCorpsDescPage(IPage<CorpsDescDto> page, CorpsDescDto corpsDescDto);
+
+	/**
+	 * 列表统计
+	 * @param corpsDescDto
+	 * @return
+	 */
+    List<CorpsDescDto> selectPartsCorpsStatistics(CorpsDescDto corpsDescDto);
 }

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

@@ -13,6 +13,7 @@ import org.springblade.client.corps.mapper.CorpsDescMapper;
 import org.springblade.client.corps.mapper.CorpsTypeDescMapper;
 import org.springblade.client.corps.mapper.CorpsTypeMapper;
 import org.springblade.client.corps.service.ICorpsDescService;
+import org.springblade.client.dto.CorpsDescDto;
 import org.springblade.client.entity.*;
 import org.springblade.client.vo.CorpsDescVO;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -632,6 +633,69 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
 		return baseMapper.selectByCorpIds(collect);
 	}
 
+	@Override
+	public IPage<CorpsDescDto> selectPartsCorpsDescPage(IPage<CorpsDescDto> page, CorpsDescDto corpsDescDto) {
+		//获取客户子类别
+		if (StringUtils.isNotBlank(corpsDescDto.getCorpsTypeId())) {
+			Long corpsTypeId = Long.parseLong(corpsDescDto.getCorpsTypeId());
+			List<Long> corpsTypeIdList = new ArrayList<>();
+			corpsTypeService.selectChildById(corpsTypeId, corpsTypeIdList);
+			corpsTypeIdList.add(corpsTypeId);
+			corpsDescDto.setTypeList(corpsTypeIdList);
+		}else if (StringUtils.isNotBlank(corpsDescDto.getCorpsTypeName())){
+			LambdaQueryWrapper<CorpsType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+			lambdaQueryWrapper.eq(CorpsType::getCname,corpsDescDto.getCorpsTypeName());
+			lambdaQueryWrapper.eq(CorpsType::getIsDeleted,0);
+			lambdaQueryWrapper.eq(CorpsType::getTenantId,SecureUtil.getTenantId());
+			List<CorpsType> corpsTypeList = corpsTypeMapper.selectList(lambdaQueryWrapper);
+			if (CollectionUtils.isNotEmpty(corpsTypeList)){
+				List<Long> corpsTypeIdList = new ArrayList<>();
+				corpsTypeList.stream().forEach(item ->{
+					corpsTypeService.selectChildById(item.getId(), corpsTypeIdList);
+					corpsTypeIdList.add(item.getId());
+				});
+				corpsDescDto.setTypeList(corpsTypeIdList);
+			}
+		}
+		corpsDescDto.setTenantId(AuthUtil.getTenantId());
+		corpsDescDto.setId(corpsDescDto.getIds());
+		return page.setRecords(baseMapper.selectPartsCorpsDescPage(page, corpsDescDto));
+	}
+
+	/**
+	 * 列表统计
+	 * @param corpsDescDto
+	 * @return
+	 */
+	@Override
+	public List<CorpsDescDto> selectPartsCorpsStatistics(CorpsDescDto corpsDescDto) {
+		//获取客户子类别
+		if (StringUtils.isNotBlank(corpsDescDto.getCorpsTypeId())) {
+			Long corpsTypeId = Long.parseLong(corpsDescDto.getCorpsTypeId());
+			List<Long> corpsTypeIdList = new ArrayList<>();
+			corpsTypeService.selectChildById(corpsTypeId, corpsTypeIdList);
+			corpsTypeIdList.add(corpsTypeId);
+			corpsDescDto.setTypeList(corpsTypeIdList);
+		}else if (StringUtils.isNotBlank(corpsDescDto.getCorpsTypeName())){
+			LambdaQueryWrapper<CorpsType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+			lambdaQueryWrapper.eq(CorpsType::getCname,corpsDescDto.getCorpsTypeName());
+			lambdaQueryWrapper.eq(CorpsType::getIsDeleted,0);
+			lambdaQueryWrapper.eq(CorpsType::getTenantId,SecureUtil.getTenantId());
+			List<CorpsType> corpsTypeList = corpsTypeMapper.selectList(lambdaQueryWrapper);
+			if (CollectionUtils.isNotEmpty(corpsTypeList)){
+				List<Long> corpsTypeIdList = new ArrayList<>();
+				corpsTypeList.stream().forEach(item ->{
+					corpsTypeService.selectChildById(item.getId(), corpsTypeIdList);
+					corpsTypeIdList.add(item.getId());
+				});
+				corpsDescDto.setTypeList(corpsTypeIdList);
+			}
+		}
+		corpsDescDto.setTenantId(AuthUtil.getTenantId());
+		corpsDescDto.setId(corpsDescDto.getIds());
+		return baseMapper.selectPartsCorpsStatistics(corpsDescDto);
+	}
+
 	/**
 	 * 保护客户联系人信息
 	 *

+ 2 - 5
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportEnquiryController.java

@@ -152,16 +152,14 @@ public class ExportEnquiryController extends BladeController {
 						if (ObjectUtils.isNotNull(corpsDesc)){
 							item.setCorpsName(corpsDesc.getCname());
 						}
-//						item.setCorpsName(corpList.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().get().getCname());
 					}
 				}
 				if (item.getBelongToCorpId() != null) {
 					if (ObjectUtil.isNotEmpty(belongToCorpList)) {
 						CorpsDesc corpsDesc = belongToCorpList.stream().filter(d -> d.getId().equals(item.getBelongToCorpId())).findFirst().orElse(null);
 						if (ObjectUtils.isNotNull(corpsDesc)){
-							item.setCorpsName(corpsDesc.getCname());
+							item.setBelongToCorpName(corpsDesc.getCname());
 						}
-//						item.setBelongToCorpName(belongToCorpList.stream().filter(e -> e.getId().equals(item.getBelongToCorpId())).findFirst().get().getCname());
 					}
 				}
 				//制单人名字
@@ -169,9 +167,8 @@ public class ExportEnquiryController extends BladeController {
 					if (ObjectUtil.isNotEmpty(createUserList)) {
 						User user = createUserList.stream().filter(d -> d.getId().equals(item.getCreateUser())).findFirst().orElse(null);
 						if (ObjectUtils.isNotNull(user)){
-							item.setCorpsName(user.getRealName());
+							item.setCreateUserName(user.getRealName());
 						}
-//						item.setCreateUserName(createUserList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().get().getRealName());
 					}
 				}
 				//获取订单明细

+ 13 - 3
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java

@@ -5,6 +5,7 @@ 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 com.trade.purchase.financing.entity.Financing;
@@ -160,18 +161,27 @@ public class ExportOrderController extends BladeController {
 			page.getRecords().stream().forEach(item -> {
 				if (item.getCorpId() != null) {
 					if (ObjectUtil.isNotEmpty(corpList)) {
-						item.setCorpsName(corpList.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().get().getCname());
+						CorpsDesc corpsDesc = corpList.stream().filter(d -> d.getId().equals(item.getCorpId())).findFirst().orElse(null);
+						if (ObjectUtils.isNotNull(corpsDesc)){
+							item.setCorpsName(corpsDesc.getCname());
+						}
 					}
 				}
 				if (item.getBelongToCorpId() != null) {
 					if (ObjectUtil.isNotEmpty(belongToCorpList)) {
-						item.setBelongToCorpName(belongToCorpList.stream().filter(e -> e.getId().equals(item.getBelongToCorpId())).findFirst().get().getCname());
+						CorpsDesc corpsDesc = belongToCorpList.stream().filter(d -> d.getId().equals(item.getBelongToCorpId())).findFirst().orElse(null);
+						if (ObjectUtils.isNotNull(corpsDesc)){
+							item.setBelongToCorpName(corpsDesc.getCname());
+						}
 					}
 				}
 				//制单人名字
 				if (item.getCreateUser() != null) {
 					if (ObjectUtil.isNotEmpty(createUserList)) {
-						item.setCreateUserName(createUserList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().get().getRealName());
+						User user = createUserList.stream().filter(d -> d.getId().equals(item.getCreateUser())).findFirst().orElse(null);
+						if (ObjectUtils.isNotNull(user)){
+							item.setCreateUserName(user.getRealName());
+						}
 					}
 				}
 				//获取订单明细

+ 4 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderDescClient.java

@@ -152,7 +152,10 @@ public class OrderDescClient implements IOrderDescClient {
 		LambdaQueryWrapper<Order> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
 		orderLambdaQueryWrapper.eq(Order::getTenantId, AuthUtil.getTenantId());
 		orderLambdaQueryWrapper.eq(Order::getIsDeleted, 0);
-		orderLambdaQueryWrapper.like(Order::getBillNo, order.getBillNo());
+		orderLambdaQueryWrapper.like(ObjectUtils.isNotNull(order.getBillNo()),Order::getBillNo, order.getBillNo());
+		orderLambdaQueryWrapper.eq(ObjectUtils.isNotNull(order.getCorpId()),Order::getCorpId, order.getCorpId());
+		orderLambdaQueryWrapper.ge(ObjectUtils.isNotNull(order.getStartTime()),Order::getCreateTime, order.getStartTime());
+		orderLambdaQueryWrapper.le(ObjectUtils.isNotNull(order.getEndTime()),Order::getCreateTime, order.getEndTime());
 		orderLambdaQueryWrapper.eq(Order::getBillType, order.getBillType());
 		orderLambdaQueryWrapper.eq(Order::getTradeType, order.getTradeType());
 		return iOrderService.list(orderLambdaQueryWrapper);

+ 14 - 14
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -1720,21 +1720,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				}
 			}
 		}
-		if (order.getDomesticAbroad().equals("1") && order.getCurrency().equals("CNY")) {
-			amount = amount;
-		} else if (order.getDomesticAbroad().equals("1") && order.getCurrency().equals("USD")) {
-			amount = amount.divide(order.getExchangeRate(), MathContext.DECIMAL32);
-		} else if (order.getDomesticAbroad().equals("2") && order.getCurrency().equals("CNY")) {
-			amount = amount.multiply(order.getExchangeRate(), MathContext.DECIMAL32);
-		} else if (order.getDomesticAbroad().equals("2") && order.getCurrency().equals("USD")) {
-			amount = amount;
-		}
 		//分摊费用额 = 总费用/总货值
-		amountF = amount.divide(order.getTotalValue(), MathContext.DECIMAL32);
-		amountF = amountF.setScale(10, BigDecimal.ROUND_HALF_UP);
-		amount = amount.setScale(10, BigDecimal.ROUND_HALF_UP);
-
-
+		if(!amount.equals(new BigDecimal(0))){
+			if (order.getDomesticAbroad().equals("1") && order.getCurrency().equals("CNY")) {
+				amount = amount;
+			} else if (order.getDomesticAbroad().equals("1") && order.getCurrency().equals("USD")) {
+				amount = amount.divide(order.getExchangeRate(), MathContext.DECIMAL32);
+			} else if (order.getDomesticAbroad().equals("2") && order.getCurrency().equals("CNY")) {
+				amount = amount.multiply(order.getExchangeRate(), MathContext.DECIMAL32);
+			} else if (order.getDomesticAbroad().equals("2") && order.getCurrency().equals("USD")) {
+				amount = amount;
+			}
+			amountF = amount.divide(order.getTotalValue(), MathContext.DECIMAL32);
+			amountF = amountF.setScale(8, BigDecimal.ROUND_HALF_UP);
+			amount = amount.setScale(8, BigDecimal.ROUND_HALF_UP);
+		}
 		map.put("amount", amount.toString());
 		map.put("amountF", amountF.toString());
 		map.put("fees", mapList);