huangfuli 2 年之前
父节点
当前提交
9313aeefba
共有 15 个文件被更改,包括 569 次插入154 次删除
  1. 5 3
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/constant/StatusEnum.java
  2. 39 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CoalPaymentInfoController.java
  3. 11 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ExpenseInfoController.java
  4. 69 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CoalPaymentInfo.java
  5. 8 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseInfo.java
  6. 4 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehousingOrder.java
  7. 34 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CoalPaymentInfoMapper.java
  8. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/ExpenseInfoMapper.java
  9. 24 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICoalPaymentInfoService.java
  10. 8 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IExpenseInfoService.java
  11. 50 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CoalPaymentInfoServiceImpl.java
  12. 59 2
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java
  13. 170 149
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java
  14. 37 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CoalPaymentInfoMapper.xml
  15. 35 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ExpenseInfoMapper.xml

+ 5 - 3
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/constant/StatusEnum.java

@@ -144,18 +144,20 @@ public enum StatusEnum {
     GRAIN_REVIEWED("5", "待审核", "grain_reviewed"),
     GRAIN_REVIEWED("5", "待审核", "grain_reviewed"),
     GRAIN_REJECT("7", "已驳回", "grain_reject"),
     GRAIN_REJECT("7", "已驳回", "grain_reject"),
     GRAIN_ADOPT("9", "已通过", "grain_adopt"),
     GRAIN_ADOPT("9", "已通过", "grain_adopt"),
+
     //合同费用状态
     //合同费用状态
     RECEIVED("1", "已收款", "received"),
     RECEIVED("1", "已收款", "received"),
     PENDING_PAYMENT("3", "待付款", "pending_payment"),
     PENDING_PAYMENT("3", "待付款", "pending_payment"),
     PAID("5", "已付款", "paid"),
     PAID("5", "已付款", "paid"),
+
     //费用管理状态
     //费用管理状态
     TO_BE_CONFIRMED("1", "待确认", "to_be_confirmed"),
     TO_BE_CONFIRMED("1", "待确认", "to_be_confirmed"),
-    REJECTED("3", "已驳回", "rejected"),
-    COST_RECEIVED("5", "已收款", "cost_received"),
-    COMPLETED("7", "已完成", "completed"),
     COST_PAYMENT("2", "待付款", "cost_payment"),
     COST_PAYMENT("2", "待付款", "cost_payment"),
+    REJECTED("3", "已驳回", "rejected"),
     COST_PAID("4", "已付款", "cost_paid"),
     COST_PAID("4", "已付款", "cost_paid"),
+    COST_RECEIVED("5", "已收款", "cost_received"),
     COST_ADOPTED("6", "已通过", "cost_adopted"),
     COST_ADOPTED("6", "已通过", "cost_adopted"),
+    COMPLETED("7", "已完成", "completed"),
 
 
     //补卡状态
     //补卡状态
     SUPP_REVIEWED("1", "审核中", "supp_reviewed"),
     SUPP_REVIEWED("1", "审核中", "supp_reviewed"),

+ 39 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CoalPaymentInfoController.java

@@ -0,0 +1,39 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.CoalPaymentInfo;
+import com.yh.saas.plugin.yiliangyiyun.service.ICoalPaymentInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 记录煤款信息 前端控制器
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-02-01
+ */
+@RestController
+@RequestMapping("/coalPaymentInfo")
+public class CoalPaymentInfoController {
+
+    @Autowired
+    private ICoalPaymentInfoService coalPaymentInfoService;
+
+    /**
+     * 煤款列表查询
+     *
+     * @param coalPaymentInfo
+     * @return
+     */
+    @GetMapping("/selectCoalInfo")
+    public Page<CoalPaymentInfo> selectCoalInfo(CoalPaymentInfo coalPaymentInfo) {
+        return coalPaymentInfoService.selectCoalInfo(coalPaymentInfo);
+    }
+}
+

+ 11 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ExpenseInfoController.java

@@ -184,6 +184,17 @@ public class ExpenseInfoController {
         return expenseInfoService.selectBondInfo(expenseInfo);
         return expenseInfoService.selectBondInfo(expenseInfo);
     }
     }
 
 
+    /**
+     * 煤款列表请款记录列表
+     *
+     * @param expenseInfo
+     * @return
+     */
+    @GetMapping("/selectRequestRecordInfo")
+    public Page<ExpenseInfo> selectRequestRecordInfo(ExpenseInfo expenseInfo) {
+        return expenseInfoService.selectRequestRecordInfo(expenseInfo);
+    }
+
     /**
     /**
      * 抵粮款
      * 抵粮款
      */
      */

+ 69 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CoalPaymentInfo.java

@@ -0,0 +1,69 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
+import com.baomidou.mybatisplus.enums.IdType;
+import com.yh.saas.common.support.entity.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 记录煤款信息
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-02-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("coal_payment_info")
+public class CoalPaymentInfo extends BaseModel<CoalPaymentInfo> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+    /**
+     * 公司id
+     */
+    private String compId;
+    /**
+     * 仓库id
+     */
+    private String warehouseId;
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+    /**
+     * 可分配金额(元)
+     */
+    private Double distributableAmount;
+    /**
+     * 当前平均分配成本(元/吨)
+     */
+    private Double currentAverageAllocatedCost;
+
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private String searchKeyWord;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseInfo.java

@@ -135,6 +135,14 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      * 费用用途(1合同费用3库点费用5经营性费用)
      * 费用用途(1合同费用3库点费用5经营性费用)
      */
      */
     private String expensesPurpose;
     private String expensesPurpose;
+    /**
+     * 是否自动分配(1不自动分配3仓储费自动分配5煤款自动分配)
+     */
+    private String autoAssign;
+    /**
+     * 煤单价(元/吨)
+     */
+    private Double coalPrice;
     /**
     /**
      * 费用类型(1粮款3非粮款5保证金)
      * 费用类型(1粮款3非粮款5保证金)
      */
      */

+ 4 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehousingOrder.java

@@ -154,6 +154,10 @@ public class WarehousingOrder extends BaseModel<WarehousingOrder> {
      * 利息
      * 利息
      */
      */
     private Double interest;
     private Double interest;
+    /**
+     * 烘干费
+     */
+    private Double dryingFee;
     /**
     /**
      * 出单时间
      * 出单时间
      */
      */

+ 34 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CoalPaymentInfoMapper.java

@@ -0,0 +1,34 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.CoalPaymentInfo;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 记录煤款信息 Mapper 接口
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-02-01
+ */
+public interface CoalPaymentInfoMapper extends BaseMapper<CoalPaymentInfo> {
+
+    /**
+     * 根据条件查询煤款总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getCountByCondition(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询煤款列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<CoalPaymentInfo> getListByCondition(Map<String, Object> pageView);
+}

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/ExpenseInfoMapper.java

@@ -62,6 +62,22 @@ public interface ExpenseInfoMapper extends BaseMapper<ExpenseInfo> {
      */
      */
     List<ExpenseInfo> getBondListByCondition(Map<String, Object> pageView);
     List<ExpenseInfo> getBondListByCondition(Map<String, Object> pageView);
 
 
+    /**
+     * 根据条件查询请款记录总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getRequestRecordCountByCondition(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询请款记录列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<ExpenseInfo> getRequestRecordListByCondition(Map<String, Object> pageView);
+
     /**
     /**
      * 查询收支核算/月
      * 查询收支核算/月
      *
      *

+ 24 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICoalPaymentInfoService.java

@@ -0,0 +1,24 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.CoalPaymentInfo;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ * 记录煤款信息 服务类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-02-01
+ */
+public interface ICoalPaymentInfoService extends IService<CoalPaymentInfo> {
+
+    /**
+     * 煤款列表查询
+     *
+     * @param coalPaymentInfo
+     * @return
+     */
+    Page<CoalPaymentInfo> selectCoalInfo(CoalPaymentInfo coalPaymentInfo);
+}

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IExpenseInfoService.java

@@ -134,6 +134,14 @@ public interface IExpenseInfoService extends IService<ExpenseInfo> {
      */
      */
     Page<ExpenseInfo> selectBondInfo(ExpenseInfo expenseInfo);
     Page<ExpenseInfo> selectBondInfo(ExpenseInfo expenseInfo);
 
 
+    /**
+     * 煤款列表请款记录列表
+     *
+     * @param expenseInfo
+     * @return
+     */
+    Page<ExpenseInfo> selectRequestRecordInfo(ExpenseInfo expenseInfo);
+
     /**
     /**
      * 抵粮款
      * 抵粮款
      *
      *

+ 50 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CoalPaymentInfoServiceImpl.java

@@ -0,0 +1,50 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
+import com.yh.saas.plugin.yiliangyiyun.entity.CoalPaymentInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
+import com.yh.saas.plugin.yiliangyiyun.mapper.CoalPaymentInfoMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.ICoalPaymentInfoService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 记录煤款信息 服务实现类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-02-01
+ */
+@Service
+public class CoalPaymentInfoServiceImpl extends ServiceImpl<CoalPaymentInfoMapper, CoalPaymentInfo> implements ICoalPaymentInfoService {
+
+    /**
+     * 煤款列表查询
+     * @param coalPaymentInfo
+     * @return
+     */
+    @Override
+    public Page<CoalPaymentInfo> selectCoalInfo(CoalPaymentInfo coalPaymentInfo){
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (coalPaymentInfo.getCurrentPage() - 1)
+                * coalPaymentInfo.getPageSize());
+        pageView.put("searchKeyWord", coalPaymentInfo.getSearchKeyWord());
+        pageView.put("pageSize", coalPaymentInfo.getPageSize());
+        pageView.put("currentPage", coalPaymentInfo.getCurrentPage());
+        // 查询总数
+        Integer dataCount = baseMapper.getCountByCondition(pageView);
+        List<CoalPaymentInfo> dataList = baseMapper.getListByCondition(pageView);
+        Page<CoalPaymentInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(coalPaymentInfo.getCurrentPage());
+        page.setSize(coalPaymentInfo.getPageSize());
+        return page;
+    }
+}

+ 59 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java

@@ -99,6 +99,8 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
     @Autowired
     @Autowired
     private IWarehouseBaseInfoService warehouseBaseInfoService;
     private IWarehouseBaseInfoService warehouseBaseInfoService;
     @Autowired
     @Autowired
+    private ICoalPaymentInfoService coalPaymentInfoService;
+    @Autowired
     private INoticeService noticeService;
     private INoticeService noticeService;
     @Autowired
     @Autowired
     private INoticeTaskService noticeTaskService;
     private INoticeTaskService noticeTaskService;
@@ -438,8 +440,8 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         else {
         else {
             expenseInfo.setStatusFlag(StatusEnum.COST_PAYMENT.getFlag());
             expenseInfo.setStatusFlag(StatusEnum.COST_PAYMENT.getFlag());
             expenseInfo.setStatus(StatusEnum.COST_PAYMENT.getName());
             expenseInfo.setStatus(StatusEnum.COST_PAYMENT.getName());
-            //合同非粮款和库点费用未分配金额默认等于费用金额
-            if (("3".equals(expenseInfo.getCostType()) && "1".equals(expenseInfo.getExpensesPurpose())) || "3".equals(expenseInfo.getExpensesPurpose())) {
+            //合同非粮款和库点费用自动分配的情况,未分配金额默认等于费用金额
+            if (("3".equals(expenseInfo.getCostType()) && "1".equals(expenseInfo.getExpensesPurpose())) || ("3".equals(expenseInfo.getExpensesPurpose()) && !"1".equals(expenseInfo.getAutoAssign()))) {
                 expenseInfo.setUnallocatedAmount(expenseInfo.getAmountMoney());
                 expenseInfo.setUnallocatedAmount(expenseInfo.getAmountMoney());
             }
             }
             //合同粮款校验
             //合同粮款校验
@@ -1068,6 +1070,37 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
                 }
                 }
             }
             }
         }
         }
+        //库点费用-煤款
+        else if ("3".equals(expenseInfo1.getExpensesPurpose()) && "5".equals(expenseInfo1.getAutoAssign())) {
+            //查询该仓库是否有煤款信息
+            CoalPaymentInfo coalPaymentInfo = coalPaymentInfoService.selectOne(new EntityWrapper<CoalPaymentInfo>()
+            .eq("warehouse_name",expenseInfo1.getWarehouseName()));
+            if (coalPaymentInfo == null){
+                //为空,新增
+                CoalPaymentInfo coalPaymentInfo1 = new CoalPaymentInfo();
+                coalPaymentInfo1.setId(IdGenerator.generateUUID());
+                coalPaymentInfo1.setCompId(expenseInfo1.getCompId());
+                coalPaymentInfo1.setWarehouseId(expenseInfo1.getWarehouseId());
+                coalPaymentInfo1.setWarehouseName(expenseInfo1.getWarehouseName());
+                coalPaymentInfo1.setDistributableAmount(expenseInfo1.getAmountMoney());
+                coalPaymentInfo1.setCurrentAverageAllocatedCost(expenseInfo1.getCoalPrice());
+                coalPaymentInfoService.insert(coalPaymentInfo1);
+            }else {
+                //不为空, 编辑
+                //当前合计可分配金额
+                Double nowDisAmount = coalPaymentInfo.getDistributableAmount();
+                //当前平均分配单价
+                Double nowCurCost = coalPaymentInfo.getCurrentAverageAllocatedCost();
+                coalPaymentInfo.setDistributableAmount(nowDisAmount + expenseInfo1.getAmountMoney());
+                coalPaymentInfo.setCurrentAverageAllocatedCost((nowCurCost*13/550*nowDisAmount +
+                        expenseInfo1.getCoalPrice()*13/550*expenseInfo1.getAmountMoney()) / (nowDisAmount + expenseInfo1.getAmountMoney()));
+                coalPaymentInfoService.updateById(coalPaymentInfo);
+            }
+            //付款之后费用状态变成已完成
+            expenseInfo1.setStatusFlag(StatusEnum.COMPLETED.getFlag());
+            expenseInfo1.setStatus(StatusEnum.COMPLETED.getName());
+            this.updateById(expenseInfo1);
+        }
         // 插入操作历史
         // 插入操作历史
         String staffName = this.billOperateHisService.getStaffAndName();
         String staffName = this.billOperateHisService.getStaffAndName();
         // 插入操作历史
         // 插入操作历史
@@ -1555,6 +1588,30 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         return page;
         return page;
     }
     }
 
 
+    /**
+     * 煤款列表请款记录列表
+     * @param expenseInfo
+     * @return
+     */
+    @Override
+    public Page<ExpenseInfo> selectRequestRecordInfo(ExpenseInfo expenseInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (expenseInfo.getCurrentPage() - 1)
+                * expenseInfo.getPageSize());
+        pageView.put("warehouseId", expenseInfo.getWarehouseId());
+        pageView.put("pageSize", expenseInfo.getPageSize());
+        pageView.put("currentPage", expenseInfo.getCurrentPage());
+        // 查询总数
+        Integer dataCount = baseMapper.getRequestRecordCountByCondition(pageView);
+        List<ExpenseInfo> dataList = baseMapper.getRequestRecordListByCondition(pageView);
+        Page<ExpenseInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(expenseInfo.getCurrentPage());
+        page.setSize(expenseInfo.getPageSize());
+        return page;
+    }
+
     @Override
     @Override
     public String foodAllowance(ExpenseInfo expenseInfo) {
     public String foodAllowance(ExpenseInfo expenseInfo) {
         String relationId = IdGenerator.generateUUID();
         String relationId = IdGenerator.generateUUID();

+ 170 - 149
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java

@@ -144,7 +144,8 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
     private IEnabledInfoService enabledInfoService;
     private IEnabledInfoService enabledInfoService;
     @Autowired
     @Autowired
     private IWarehousingOrderRecordService warehousingOrderRecordService;
     private IWarehousingOrderRecordService warehousingOrderRecordService;
-
+    @Autowired
+    private ICoalPaymentInfoService coalPaymentInfoService;
     @Autowired
     @Autowired
     private IWarehouseBaseInfoService warehouseBaseInfoService;
     private IWarehouseBaseInfoService warehouseBaseInfoService;
     @Value("${com.yiliangyiyun.env}")
     @Value("${com.yiliangyiyun.env}")
@@ -209,6 +210,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
 
 
     /**
     /**
      * 入库单列表
      * 入库单列表
+     *
      * @param warehousingOrder
      * @param warehousingOrder
      * @return
      * @return
      */
      */
@@ -259,7 +261,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 if ("2".equals(warehousingOrder.getSearchType())) {
                 if ("2".equals(warehousingOrder.getSearchType())) {
                     warehousingOrderWrapper.eq("batch_id", warehousingOrder1.getBatchId());
                     warehousingOrderWrapper.eq("batch_id", warehousingOrder1.getBatchId());
                 }
                 }
-                if("1".equals(warehousingOrder.getWeightGreater())){
+                if ("1".equals(warehousingOrder.getWeightGreater())) {
                     warehousingOrderWrapper.gt("surplus_weight", 0);
                     warehousingOrderWrapper.gt("surplus_weight", 0);
                 }
                 }
                 if (!StringUtils.isEmpty(warehousingOrder.getFlag())) {
                 if (!StringUtils.isEmpty(warehousingOrder.getFlag())) {
@@ -272,7 +274,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 List<WarehousingOrder> warehousingOrderList = this.selectList(warehousingOrderWrapper);
                 List<WarehousingOrder> warehousingOrderList = this.selectList(warehousingOrderWrapper);
                 List<WarehousingOrder> warehousingOrderListNew = new ArrayList<>();
                 List<WarehousingOrder> warehousingOrderListNew = new ArrayList<>();
                 for (WarehousingOrder warehousingOrder2 : warehousingOrderList) {
                 for (WarehousingOrder warehousingOrder2 : warehousingOrderList) {
-                    if (warehousingOrder2.getInWarehouseWeight() < 1){
+                    if (warehousingOrder2.getInWarehouseWeight() < 1) {
                         warehousingOrderListNew.add(warehousingOrder2);
                         warehousingOrderListNew.add(warehousingOrder2);
                     }
                     }
                     if (warehousingOrder2.getContractNo() != null) {
                     if (warehousingOrder2.getContractNo() != null) {
@@ -281,7 +283,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                                 .eq("comp_id", warehousingOrder2.getCompId()));
                                 .eq("comp_id", warehousingOrder2.getCompId()));
                         if (contractManagementInfo != null) {
                         if (contractManagementInfo != null) {
                             //已完成的合同分配时不能被选到
                             //已完成的合同分配时不能被选到
-                            if ("已完成".equals(contractManagementInfo.getStatus())||"已结算".equals(contractManagementInfo.getStatus())){
+                            if ("已完成".equals(contractManagementInfo.getStatus()) || "已结算".equals(contractManagementInfo.getStatus())) {
                                 warehousingOrderListNew.add(warehousingOrder2);
                                 warehousingOrderListNew.add(warehousingOrder2);
                             }
                             }
                             warehousingOrder2.setBuyer(contractManagementInfo.getBuyer());
                             warehousingOrder2.setBuyer(contractManagementInfo.getBuyer());
@@ -314,8 +316,8 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
 //                                    warehousingOrder2.setBankDepositBranch(identityAuthenticationInfo.getBankDepositBranch());
 //                                    warehousingOrder2.setBankDepositBranch(identityAuthenticationInfo.getBankDepositBranch());
 //                                }
 //                                }
                                 PaymentManagement paymentManagement = paymentManagementService.selectOne(new EntityWrapper<PaymentManagement>()
                                 PaymentManagement paymentManagement = paymentManagementService.selectOne(new EntityWrapper<PaymentManagement>()
-                                        .eq("order_id",warehousingOrder2.getId())
-                                        .eq("delete_flag",0));
+                                        .eq("order_id", warehousingOrder2.getId())
+                                        .eq("delete_flag", 0));
                                 if (paymentManagement != null) {
                                 if (paymentManagement != null) {
                                     if (StringUtils.isEmpty(paymentManagement.getBankCard()) || StringUtils.isEmpty(paymentManagement.getBankDeposit())
                                     if (StringUtils.isEmpty(paymentManagement.getBankCard()) || StringUtils.isEmpty(paymentManagement.getBankDeposit())
                                             || StringUtils.isEmpty(paymentManagement.getBankDepositBranch())) {
                                             || StringUtils.isEmpty(paymentManagement.getBankDepositBranch())) {
@@ -332,8 +334,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                                             warehousingOrder2.setBankDeposit(identityAuthenticationInfo.getBankDeposit());
                                             warehousingOrder2.setBankDeposit(identityAuthenticationInfo.getBankDeposit());
                                             warehousingOrder2.setBankDepositBranch(identityAuthenticationInfo.getBankDepositBranch());
                                             warehousingOrder2.setBankDepositBranch(identityAuthenticationInfo.getBankDepositBranch());
                                         }
                                         }
-                                    }
-                                    else {
+                                    } else {
                                         warehousingOrder2.setCustomerName(paymentManagement.getCustomerName());
                                         warehousingOrder2.setCustomerName(paymentManagement.getCustomerName());
                                         warehousingOrder2.setBankCard(paymentManagement.getBankCard());
                                         warehousingOrder2.setBankCard(paymentManagement.getBankCard());
                                         warehousingOrder2.setBankDeposit(paymentManagement.getBankDeposit());
                                         warehousingOrder2.setBankDeposit(paymentManagement.getBankDeposit());
@@ -345,11 +346,11 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     }
                     }
                     List<ExpenseAllocationInfo> expenseAllocationInfos = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
                     List<ExpenseAllocationInfo> expenseAllocationInfos = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
                             .eq("order_id", warehousingOrder2.getId())
                             .eq("order_id", warehousingOrder2.getId())
-                            .ne("status","已驳回"));
+                            .ne("status", "已驳回"));
                     if (!CollectionUtils.isEmpty(expenseAllocationInfos)) {
                     if (!CollectionUtils.isEmpty(expenseAllocationInfos)) {
                         for (ExpenseAllocationInfo expenseAllocationInfo : expenseAllocationInfos) {
                         for (ExpenseAllocationInfo expenseAllocationInfo : expenseAllocationInfos) {
                             ExpenseInfo expenseInfo = expenseInfoService.selectById(expenseAllocationInfo.getInfoId());
                             ExpenseInfo expenseInfo = expenseInfoService.selectById(expenseAllocationInfo.getInfoId());
-                            if(expenseInfo == null){
+                            if (expenseInfo == null) {
                                 continue;
                                 continue;
                             }
                             }
                             expenseAllocationInfo.setCostNo(expenseInfo.getCostNo());
                             expenseAllocationInfo.setCostNo(expenseInfo.getCostNo());
@@ -357,7 +358,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                         }
                         }
                         warehousingOrder2.setExpenseAllocationInfoList(expenseAllocationInfos);
                         warehousingOrder2.setExpenseAllocationInfoList(expenseAllocationInfos);
                         //总费用
                         //总费用
-                        warehousingOrder2.setAmountMoney(expenseAllocationInfos.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum()+warehousingOrder2.getInterest()+warehousingOrder2.getStorageFee());
+                        warehousingOrder2.setAmountMoney(expenseAllocationInfos.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum() + warehousingOrder2.getInterest() + warehousingOrder2.getStorageFee());
                     }
                     }
                     String taskId = "";
                     String taskId = "";
                     // 只有待审核状态才有taskId
                     // 只有待审核状态才有taskId
@@ -367,7 +368,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                         warehousingOrder2.setTaskId(taskId);
                         warehousingOrder2.setTaskId(taskId);
                     }
                     }
                 }
                 }
-                if (warehousingOrder.getConfirmFlag()!=null){
+                if (warehousingOrder.getConfirmFlag() != null) {
                     warehousingOrderList.removeAll(warehousingOrderListNew);
                     warehousingOrderList.removeAll(warehousingOrderListNew);
                 }
                 }
                 warehousingOrder1.setWarehousingOrderList(warehousingOrderList);
                 warehousingOrder1.setWarehousingOrderList(warehousingOrderList);
@@ -431,12 +432,12 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .ge("settlement_date", beforeDay));
                             .ge("settlement_date", beforeDay));
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     warehousingOrder.setId(IdGenerator.generateUUID());
                     warehousingOrder.setId(IdGenerator.generateUUID());
-                    Double totalMoisture=0d;
+                    Double totalMoisture = 0d;
                     for (PaymentManagement paymentManagement : paymentManagementList) {
                     for (PaymentManagement paymentManagement : paymentManagementList) {
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                        .eq("relation_id",paymentManagement.getRelationId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("relation_id", paymentManagement.getRelationId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                         * Double.valueOf(String.valueOf(paymentManagement.getNetWeight() / 1000));
                                         * Double.valueOf(String.valueOf(paymentManagement.getNetWeight() / 1000));
                             }
                             }
@@ -454,7 +455,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setInType("收购入库");
                     warehousingOrder.setInType("收购入库");
                     double weight = (paymentManagementList.stream().mapToDouble(PaymentManagement::getNetWeight).sum()) / 1000;
                     double weight = (paymentManagementList.stream().mapToDouble(PaymentManagement::getNetWeight).sum()) / 1000;
-                    if (totalMoisture!=0) {
+                    if (totalMoisture != 0) {
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                     }
                     }
                     warehousingOrder.setInWarehouseWeight(weight);
                     warehousingOrder.setInWarehouseWeight(weight);
@@ -529,19 +530,18 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .ge("in_out_date", beforeDay));
                             .ge("in_out_date", beforeDay));
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     warehousingOrder.setId(IdGenerator.generateUUID());
                     warehousingOrder.setId(IdGenerator.generateUUID());
-                    Double totalMoisture=0d;
-                    for (WarehouseInOutInfo warehouseInOutInfo:warehouseInOutInfoList){
+                    Double totalMoisture = 0d;
+                    for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
                         warehouseInOutInfo.setOrderId(warehousingOrder.getId());
                         warehouseInOutInfo.setOrderId(warehousingOrder.getId());
                         warehouseInOutInfoService.updateById(warehouseInOutInfo);
                         warehouseInOutInfoService.updateById(warehouseInOutInfo);
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                        .eq("warehouse_in_out_id",warehouseInOutInfo.getId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("warehouse_in_out_id", warehouseInOutInfo.getId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                         * warehouseInOutInfo.getNetWeight();
                                         * warehouseInOutInfo.getNetWeight();
-                            }
-                            else {
-                                totalMoisture=0d;
+                            } else {
+                                totalMoisture = 0d;
                                 break;
                                 break;
                             }
                             }
                         }
                         }
@@ -555,7 +555,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setContractNo(warehousingOrder1.getContractNo());
                     warehousingOrder.setContractNo(warehousingOrder1.getContractNo());
                     double weight = warehouseInOutInfoList.stream().mapToDouble(WarehouseInOutInfo::getNetWeight).sum();
                     double weight = warehouseInOutInfoList.stream().mapToDouble(WarehouseInOutInfo::getNetWeight).sum();
-                    if (totalMoisture!=0) {
+                    if (totalMoisture != 0) {
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                     }
                     }
                     warehousingOrder.setInWarehouseWeight(weight);
                     warehousingOrder.setInWarehouseWeight(weight);
@@ -606,12 +606,12 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_type", "移库入库")
                             .eq("in_out_type", "移库入库")
                             .ge("in_out_date", beforeDay));
                             .ge("in_out_date", beforeDay));
-                    Double totalMoisture=0d;
-                    for (WarehouseInOutInfo warehouseInOutInfo:warehouseInOutInfoList){
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                                .eq("warehouse_in_out_id",warehouseInOutInfo.getId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                    Double totalMoisture = 0d;
+                    for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("warehouse_in_out_id", warehouseInOutInfo.getId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                             }
                             }
                         }
                         }
@@ -622,9 +622,9 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .eq("task_id", warehousingOrder1.getSendTaskId())
                             .eq("task_id", warehousingOrder1.getSendTaskId())
                             .eq("delete_flag", "0"));
                             .eq("delete_flag", "0"));
                     if (!CollectionUtils.isEmpty(sourceRelationInfoList)) {
                     if (!CollectionUtils.isEmpty(sourceRelationInfoList)) {
-                        Double weightTotal=0d;
-                        for (int i=0;i<sourceRelationInfoList.size();i++){
-                            SourceRelationInfo sourceRelationInfo=sourceRelationInfoList.get(i);
+                        Double weightTotal = 0d;
+                        for (int i = 0; i < sourceRelationInfoList.size(); i++) {
+                            SourceRelationInfo sourceRelationInfo = sourceRelationInfoList.get(i);
                             //查货源关联的入库单
                             //查货源关联的入库单
                             WarehousingOrder warehousingOrder2 = this.selectById(sourceRelationInfo.getSourceId());
                             WarehousingOrder warehousingOrder2 = this.selectById(sourceRelationInfo.getSourceId());
                             WarehousingOrder warehousingOrder = new WarehousingOrder();
                             WarehousingOrder warehousingOrder = new WarehousingOrder();
@@ -640,19 +640,18 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             //最后一次循环
                             //最后一次循环
-                            if (i==sourceRelationInfoList.size()-1){
-                                warehousingOrder.setInWarehouseWeight(weight-weightTotal);
-                            }
-                            else {
-                                Double weightNew=weight * sourceRelationInfo.getProportion();
-                                weightNew= new BigDecimal(weightNew).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
+                            if (i == sourceRelationInfoList.size() - 1) {
+                                warehousingOrder.setInWarehouseWeight(weight - weightTotal);
+                            } else {
+                                Double weightNew = weight * sourceRelationInfo.getProportion();
+                                weightNew = new BigDecimal(weightNew).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
                                 warehousingOrder.setInWarehouseWeight(weightNew);
                                 warehousingOrder.setInWarehouseWeight(weightNew);
-                                weightTotal=weightTotal+weightNew;
+                                weightTotal = weightTotal + weightNew;
                             }
                             }
-                            if (warehousingOrder.getInWarehouseWeight()==0){
+                            if (warehousingOrder.getInWarehouseWeight() == 0) {
                                 continue;
                                 continue;
                             }
                             }
-                            if (totalMoisture!=0) {
+                            if (totalMoisture != 0) {
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                             }
                             }
                             warehousingOrder.setSurplusWeight(warehousingOrder.getInWarehouseWeight());
                             warehousingOrder.setSurplusWeight(warehousingOrder.getInWarehouseWeight());
@@ -725,8 +724,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                                 }
                                 }
                             } else if ("移库入库".equals(warehousingOrder2.getInType())) {
                             } else if ("移库入库".equals(warehousingOrder2.getInType())) {
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
-                            }
-                            else if ("折干".equals(warehousingOrder2.getInType())) {
+                            } else if ("折干".equals(warehousingOrder2.getInType())) {
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
                             }
                             }
                             this.insert(warehousingOrder);
                             this.insert(warehousingOrder);
@@ -743,12 +741,12 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_type", "退库")
                             .eq("in_out_type", "退库")
                             .ge("in_out_date", beforeDay));
                             .ge("in_out_date", beforeDay));
-                    Double totalMoisture=0d;
-                    for (WarehouseInOutInfo warehouseInOutInfo:warehouseInOutInfoList){
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                                .eq("warehouse_in_out_id",warehouseInOutInfo.getId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                    Double totalMoisture = 0d;
+                    for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("warehouse_in_out_id", warehouseInOutInfo.getId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                             }
                             }
                         }
                         }
@@ -772,10 +770,10 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             warehousingOrder.setInWarehouseWeight(weight * sourceRelationInfo.getProportion());
                             warehousingOrder.setInWarehouseWeight(weight * sourceRelationInfo.getProportion());
-                            if (warehousingOrder.getInWarehouseWeight()==0){
+                            if (warehousingOrder.getInWarehouseWeight() == 0) {
                                 continue;
                                 continue;
                             }
                             }
-                            if (totalMoisture!=0) {
+                            if (totalMoisture != 0) {
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                             }
                             }
                             warehousingOrder.setSurplusWeight(weight * sourceRelationInfo.getProportion());
                             warehousingOrder.setSurplusWeight(weight * sourceRelationInfo.getProportion());
@@ -825,7 +823,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     //查剩余重量>0的入库单
                     //查剩余重量>0的入库单
                     List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
                     List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
                             .eq("comp_id", enabledInfo.getCompId())
                             .eq("comp_id", enabledInfo.getCompId())
-                            .ne("temporary_flag","1")
+                            .ne("temporary_flag", "1")
                             .gt("surplus_weight", 0));
                             .gt("surplus_weight", 0));
                     if (!CollectionUtils.isEmpty(warehousingOrderList)) {
                     if (!CollectionUtils.isEmpty(warehousingOrderList)) {
                         for (WarehousingOrder warehousingOrder : warehousingOrderList) {
                         for (WarehousingOrder warehousingOrder : warehousingOrderList) {
@@ -836,13 +834,13 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
                             if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
                                 distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
                                 distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
                             }
                             }
-                            distributionMoney=distributionMoney+warehousingOrder.getInterest()+warehousingOrder.getStorageFee();
+                            distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
                             if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
                             if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
                                 if (warehousingOrder.getSurplusWeight() > 1) {
                                 if (warehousingOrder.getSurplusWeight() > 1) {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest()+(warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30)*warehousingOrder.getSurplusWeight());
+                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30) * warehousingOrder.getSurplusWeight());
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
                                 } else {
                                 } else {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest()+(warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30)*warehousingOrder.getSurplusWeight());
+                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
                                 }
                                 }
                             }
                             }
@@ -904,12 +902,12 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .ge("settlement_date", beforeDay));
                             .ge("settlement_date", beforeDay));
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     warehousingOrder.setId(IdGenerator.generateUUID());
                     warehousingOrder.setId(IdGenerator.generateUUID());
-                    Double totalMoisture=0d;
+                    Double totalMoisture = 0d;
                     for (PaymentManagement paymentManagement : paymentManagementList) {
                     for (PaymentManagement paymentManagement : paymentManagementList) {
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                                .eq("relation_id",paymentManagement.getRelationId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("relation_id", paymentManagement.getRelationId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                         * Double.valueOf(String.valueOf(paymentManagement.getNetWeight() / 1000));
                                         * Double.valueOf(String.valueOf(paymentManagement.getNetWeight() / 1000));
                             }
                             }
@@ -927,7 +925,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setInType("收购入库");
                     warehousingOrder.setInType("收购入库");
                     double weight = (paymentManagementList.stream().mapToDouble(PaymentManagement::getNetWeight).sum()) / 1000;
                     double weight = (paymentManagementList.stream().mapToDouble(PaymentManagement::getNetWeight).sum()) / 1000;
-                    if (totalMoisture!=0) {
+                    if (totalMoisture != 0) {
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                     }
                     }
                     warehousingOrder.setInWarehouseWeight(weight);
                     warehousingOrder.setInWarehouseWeight(weight);
@@ -1002,19 +1000,18 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .ge("in_out_date", beforeDay));
                             .ge("in_out_date", beforeDay));
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     WarehousingOrder warehousingOrder = new WarehousingOrder();
                     warehousingOrder.setId(IdGenerator.generateUUID());
                     warehousingOrder.setId(IdGenerator.generateUUID());
-                    Double totalMoisture=0d;
-                    for (WarehouseInOutInfo warehouseInOutInfo:warehouseInOutInfoList){
+                    Double totalMoisture = 0d;
+                    for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
                         warehouseInOutInfo.setOrderId(warehousingOrder.getId());
                         warehouseInOutInfo.setOrderId(warehousingOrder.getId());
                         warehouseInOutInfoService.updateById(warehouseInOutInfo);
                         warehouseInOutInfoService.updateById(warehouseInOutInfo);
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                                .eq("warehouse_in_out_id",warehouseInOutInfo.getId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("warehouse_in_out_id", warehouseInOutInfo.getId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                 totalMoisture = totalMoisture + Double.valueOf(qualityInspectionManagement.getWaterContent())
                                         * warehouseInOutInfo.getNetWeight();
                                         * warehouseInOutInfo.getNetWeight();
-                            }
-                            else {
-                                totalMoisture=0d;
+                            } else {
+                                totalMoisture = 0d;
                                 break;
                                 break;
                             }
                             }
                         }
                         }
@@ -1028,7 +1025,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                     warehousingOrder.setContractNo(warehousingOrder1.getContractNo());
                     warehousingOrder.setContractNo(warehousingOrder1.getContractNo());
                     double weight = warehouseInOutInfoList.stream().mapToDouble(WarehouseInOutInfo::getNetWeight).sum();
                     double weight = warehouseInOutInfoList.stream().mapToDouble(WarehouseInOutInfo::getNetWeight).sum();
-                    if (totalMoisture!=0) {
+                    if (totalMoisture != 0) {
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                         warehousingOrder.setWeightedMoisture(totalMoisture / weight);
                     }
                     }
                     warehousingOrder.setInWarehouseWeight(weight);
                     warehousingOrder.setInWarehouseWeight(weight);
@@ -1079,12 +1076,12 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_type", "移库入库")
                             .eq("in_out_type", "移库入库")
                             .ge("in_out_date", beforeDay));
                             .ge("in_out_date", beforeDay));
-                    Double totalMoisture=0d;
-                    for (WarehouseInOutInfo warehouseInOutInfo:warehouseInOutInfoList){
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                                .eq("warehouse_in_out_id",warehouseInOutInfo.getId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                    Double totalMoisture = 0d;
+                    for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("warehouse_in_out_id", warehouseInOutInfo.getId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                             }
                             }
                         }
                         }
@@ -1095,9 +1092,9 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .eq("task_id", warehousingOrder1.getSendTaskId())
                             .eq("task_id", warehousingOrder1.getSendTaskId())
                             .eq("delete_flag", "0"));
                             .eq("delete_flag", "0"));
                     if (!CollectionUtils.isEmpty(sourceRelationInfoList)) {
                     if (!CollectionUtils.isEmpty(sourceRelationInfoList)) {
-                        Double weightTotal=0d;
-                        for (int i=0;i<sourceRelationInfoList.size();i++){
-                            SourceRelationInfo sourceRelationInfo=sourceRelationInfoList.get(i);
+                        Double weightTotal = 0d;
+                        for (int i = 0; i < sourceRelationInfoList.size(); i++) {
+                            SourceRelationInfo sourceRelationInfo = sourceRelationInfoList.get(i);
                             //查货源关联的入库单
                             //查货源关联的入库单
                             WarehousingOrder warehousingOrder2 = this.selectById(sourceRelationInfo.getSourceId());
                             WarehousingOrder warehousingOrder2 = this.selectById(sourceRelationInfo.getSourceId());
                             WarehousingOrder warehousingOrder = new WarehousingOrder();
                             WarehousingOrder warehousingOrder = new WarehousingOrder();
@@ -1113,19 +1110,18 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             //最后一次循环
                             //最后一次循环
-                            if (i==sourceRelationInfoList.size()-1){
-                                warehousingOrder.setInWarehouseWeight(weight-weightTotal);
-                            }
-                            else {
-                                Double weightNew=weight * sourceRelationInfo.getProportion();
-                                weightNew= new BigDecimal(weightNew).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
+                            if (i == sourceRelationInfoList.size() - 1) {
+                                warehousingOrder.setInWarehouseWeight(weight - weightTotal);
+                            } else {
+                                Double weightNew = weight * sourceRelationInfo.getProportion();
+                                weightNew = new BigDecimal(weightNew).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
                                 warehousingOrder.setInWarehouseWeight(weightNew);
                                 warehousingOrder.setInWarehouseWeight(weightNew);
-                                weightTotal=weightTotal+weightNew;
+                                weightTotal = weightTotal + weightNew;
                             }
                             }
-                            if (warehousingOrder.getInWarehouseWeight()==0){
+                            if (warehousingOrder.getInWarehouseWeight() == 0) {
                                 continue;
                                 continue;
                             }
                             }
-                            if (totalMoisture!=0) {
+                            if (totalMoisture != 0) {
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                             }
                             }
                             warehousingOrder.setSurplusWeight(warehousingOrder.getInWarehouseWeight());
                             warehousingOrder.setSurplusWeight(warehousingOrder.getInWarehouseWeight());
@@ -1198,8 +1194,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                                 }
                                 }
                             } else if ("移库入库".equals(warehousingOrder2.getInType())) {
                             } else if ("移库入库".equals(warehousingOrder2.getInType())) {
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
-                            }
-                            else if ("折干".equals(warehousingOrder2.getInType())) {
+                            } else if ("折干".equals(warehousingOrder2.getInType())) {
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
                                 warehousingOrder.setGoodsSource(warehousingOrder2.getGoodsSource());
                             }
                             }
                             this.insert(warehousingOrder);
                             this.insert(warehousingOrder);
@@ -1216,12 +1211,12 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_task_no", warehousingOrder1.getInOutTaskNo())
                             .eq("in_out_type", "退库")
                             .eq("in_out_type", "退库")
                             .ge("in_out_date", beforeDay));
                             .ge("in_out_date", beforeDay));
-                    Double totalMoisture=0d;
-                    for (WarehouseInOutInfo warehouseInOutInfo:warehouseInOutInfoList){
-                        QualityInspectionManagement qualityInspectionManagement=qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                                .eq("warehouse_in_out_id",warehouseInOutInfo.getId()));
-                        if (qualityInspectionManagement!=null) {
-                            if (qualityInspectionManagement.getWaterContent()!=null) {
+                    Double totalMoisture = 0d;
+                    for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
+                        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                                .eq("warehouse_in_out_id", warehouseInOutInfo.getId()));
+                        if (qualityInspectionManagement != null) {
+                            if (qualityInspectionManagement.getWaterContent() != null) {
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                                 totalMoisture = Double.valueOf(qualityInspectionManagement.getWaterContent());
                             }
                             }
                         }
                         }
@@ -1245,10 +1240,10 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setCompId(warehousingOrder1.getCompId());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             warehousingOrder.setGoodsName(warehousingOrder1.getGoodsName());
                             warehousingOrder.setInWarehouseWeight(weight * sourceRelationInfo.getProportion());
                             warehousingOrder.setInWarehouseWeight(weight * sourceRelationInfo.getProportion());
-                            if (warehousingOrder.getInWarehouseWeight()==0){
+                            if (warehousingOrder.getInWarehouseWeight() == 0) {
                                 continue;
                                 continue;
                             }
                             }
-                            if (totalMoisture!=0) {
+                            if (totalMoisture != 0) {
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                                 warehousingOrder.setWeightedMoisture(totalMoisture);
                             }
                             }
                             warehousingOrder.setSurplusWeight(weight * sourceRelationInfo.getProportion());
                             warehousingOrder.setSurplusWeight(weight * sourceRelationInfo.getProportion());
@@ -1309,13 +1304,13 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                             if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
                             if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
                                 distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
                                 distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
                             }
                             }
-                            distributionMoney=distributionMoney+warehousingOrder.getInterest()+warehousingOrder.getStorageFee();
+                            distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
                             if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
                             if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
                                 if (warehousingOrder.getSurplusWeight() > 1) {
                                 if (warehousingOrder.getSurplusWeight() > 1) {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest()+(warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30)*warehousingOrder.getSurplusWeight());
+                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30) * warehousingOrder.getSurplusWeight());
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
                                 } else {
                                 } else {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest()+(warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30)*warehousingOrder.getSurplusWeight());
+                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
                                     warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
                                 }
                                 }
                             }
                             }
@@ -1351,7 +1346,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehousingOrder.getPlValue());
                 warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehousingOrder.getPlValue());
                 warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
                 warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
             }
             }
-            warehousingOrder.setSurplusWeight(warehousingOrder.getSurplusWeight()+warehousingOrder.getPlValue());
+            warehousingOrder.setSurplusWeight(warehousingOrder.getSurplusWeight() + warehousingOrder.getPlValue());
             warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss() + warehousingOrder.getPlValue());
             warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss() + warehousingOrder.getPlValue());
             warehousingOrder.setPlValue(0d);
             warehousingOrder.setPlValue(0d);
             // 插入操作历史
             // 插入操作历史
@@ -1381,19 +1376,17 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
 //                    this.updateById(warehousingOrder);
 //                    this.updateById(warehousingOrder);
 //                    workflowService.activateInstance(warehousingOrder.getWorkflowId(), warehousingOrder.getId());
 //                    workflowService.activateInstance(warehousingOrder.getWorkflowId(), warehousingOrder.getId());
 //                }
 //                }
-        }
-        else if ("1".equals(warehousingOrder.getFlag())) {
+        } else if ("1".equals(warehousingOrder.getFlag())) {
             WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
             WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
                     .eq("position_id", warehousingOrder.getPositionId())
                     .eq("position_id", warehousingOrder.getPositionId())
                     .eq("goods_name", warehousingOrder.getGoodsName())
                     .eq("goods_name", warehousingOrder.getGoodsName())
                     .eq("delete_flag", "0"));
                     .eq("delete_flag", "0"));
             // 判断是否有货
             // 判断是否有货
             if (warehousePositionStorageInfo != null) {
             if (warehousePositionStorageInfo != null) {
-                Double plvalue=Math.abs(warehousingOrder.getPlValue());
-                if (plvalue>warehousePositionStorageInfo.getStorage()){
+                Double plvalue = Math.abs(warehousingOrder.getPlValue());
+                if (plvalue > warehousePositionStorageInfo.getStorage()) {
                     throw new YException(YExceptionEnum.CONVERSION_NO_ERROR);
                     throw new YException(YExceptionEnum.CONVERSION_NO_ERROR);
-                }
-                else{
+                } else {
                     // 更新库存量
                     // 更新库存量
                     warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehousingOrder.getPlValue());
                     warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehousingOrder.getPlValue());
                     warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
                     warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
@@ -1403,7 +1396,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
             else {
             else {
                 throw new YException(YExceptionEnum.POSITIONSTORAGE_NO_ERROR);
                 throw new YException(YExceptionEnum.POSITIONSTORAGE_NO_ERROR);
             }
             }
-            warehousingOrder.setSurplusWeight(warehousingOrder.getSurplusWeight()+warehousingOrder.getPlValue());
+            warehousingOrder.setSurplusWeight(warehousingOrder.getSurplusWeight() + warehousingOrder.getPlValue());
             warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss() + warehousingOrder.getPlValue());
             warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss() + warehousingOrder.getPlValue());
             warehousingOrder.setPlValue(0d);
             warehousingOrder.setPlValue(0d);
 //            this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
 //            this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
@@ -1559,8 +1552,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                                 if (warehousingOrder1.getAmountNotPayable() == 0) {
                                 if (warehousingOrder1.getAmountNotPayable() == 0) {
                                     paymentManagement.setStatus("全部付款");
                                     paymentManagement.setStatus("全部付款");
                                     paymentManagement.setStatusFlag("5");
                                     paymentManagement.setStatusFlag("5");
-                                }
-                                else {
+                                } else {
                                     paymentManagement.setStatus("部分付款");
                                     paymentManagement.setStatus("部分付款");
                                     paymentManagement.setStatusFlag("4");
                                     paymentManagement.setStatusFlag("4");
                                 }
                                 }
@@ -1593,10 +1585,10 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 taskInfo.setBusinessType("WAREHOUSE");
                 taskInfo.setBusinessType("WAREHOUSE");
                 taskInfo.setMessageContent(taskContent);
                 taskInfo.setMessageContent(taskContent);
                 taskInfo.setBusinessCode("WAREHOUSING-ORDER-APPROVE");
                 taskInfo.setBusinessCode("WAREHOUSING-ORDER-APPROVE");
-                CommonRole commonRole=commonRoleService.selectOne(new EntityWrapper<CommonRole>()
-                        .eq("comp_id",commitUserInfo.getCompId())
-                        .eq("role_name","总经理助理"));
-                if (commonRole!=null) {
+                CommonRole commonRole = commonRoleService.selectOne(new EntityWrapper<CommonRole>()
+                        .eq("comp_id", commitUserInfo.getCompId())
+                        .eq("role_name", "总经理助理"));
+                if (commonRole != null) {
                     //查询单证中心成员
                     //查询单证中心成员
                     List<CommonStaff> commonStaffList = staffService.selectList(new EntityWrapper<CommonStaff>()
                     List<CommonStaff> commonStaffList = staffService.selectList(new EntityWrapper<CommonStaff>()
                             .eq("dept_id", commonRole.getDeptId())
                             .eq("dept_id", commonRole.getDeptId())
@@ -1617,32 +1609,32 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 contractManagementInfo.setAllocatedMargin(contractManagementInfo.getAllocatedMargin() + warehousingOrder.getMoney());
                 contractManagementInfo.setAllocatedMargin(contractManagementInfo.getAllocatedMargin() + warehousingOrder.getMoney());
                 contractManagementInfoService.updateById(contractManagementInfo);
                 contractManagementInfoService.updateById(contractManagementInfo);
                 //生成保证金分配费用信息
                 //生成保证金分配费用信息
-                ExpenseInfo expenseInfo=new ExpenseInfo();
+                ExpenseInfo expenseInfo = new ExpenseInfo();
                 expenseInfo.setId(IdGenerator.generateUUID());
                 expenseInfo.setId(IdGenerator.generateUUID());
                 expenseInfo.setCompId(warehousingOrder1.getCompId());
                 expenseInfo.setCompId(warehousingOrder1.getCompId());
                 expenseInfo.setAmountMoney(warehousingOrder.getMoney());
                 expenseInfo.setAmountMoney(warehousingOrder.getMoney());
                 expenseInfo.setExpensesType("2");
                 expenseInfo.setExpensesType("2");
                 expenseInfo.setExpenseName("保证金分配");
                 expenseInfo.setExpenseName("保证金分配");
                 SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
                 SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
-                Integer num=expenseInfoService.expenseCount(expenseInfo)+1;
-                String newNo="";
+                Integer num = expenseInfoService.expenseCount(expenseInfo) + 1;
+                String newNo = "";
                 //一位数
                 //一位数
                 if (num < 10) {
                 if (num < 10) {
-                    newNo="000" + num;
+                    newNo = "000" + num;
                 }
                 }
                 //两位数
                 //两位数
                 else if (num < 100) {
                 else if (num < 100) {
-                    newNo="00" + num;
+                    newNo = "00" + num;
                 }
                 }
                 //三位数
                 //三位数
                 else if (num < 1000) {
                 else if (num < 1000) {
-                    newNo="0" + num;
+                    newNo = "0" + num;
                 }
                 }
                 //四位数
                 //四位数
                 else if (num < 10000) {
                 else if (num < 10000) {
-                    newNo=String.valueOf(num);
+                    newNo = String.valueOf(num);
                 }
                 }
-                String no = "HTF"+df.format(new Date())+newNo;
+                String no = "HTF" + df.format(new Date()) + newNo;
                 expenseInfo.setCostNo(no);
                 expenseInfo.setCostNo(no);
                 expenseInfo.setStatusFlag(StatusEnum.COMPLETED.getFlag());
                 expenseInfo.setStatusFlag(StatusEnum.COMPLETED.getFlag());
                 expenseInfo.setStatus(StatusEnum.COMPLETED.getName());
                 expenseInfo.setStatus(StatusEnum.COMPLETED.getName());
@@ -1665,10 +1657,10 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 taskInfo.setBusinessType("WAREHOUSE");
                 taskInfo.setBusinessType("WAREHOUSE");
                 taskInfo.setMessageContent(taskContent);
                 taskInfo.setMessageContent(taskContent);
                 taskInfo.setBusinessCode("WAREHOUSING-ORDER-APPROVE");
                 taskInfo.setBusinessCode("WAREHOUSING-ORDER-APPROVE");
-                CommonRole commonRole=commonRoleService.selectOne(new EntityWrapper<CommonRole>()
-                        .eq("comp_id",commitUserInfo.getCompId())
-                        .eq("role_name","总经理助理"));
-                if (commonRole!=null) {
+                CommonRole commonRole = commonRoleService.selectOne(new EntityWrapper<CommonRole>()
+                        .eq("comp_id", commitUserInfo.getCompId())
+                        .eq("role_name", "总经理助理"));
+                if (commonRole != null) {
                     //查询单证中心成员
                     //查询单证中心成员
                     List<CommonStaff> commonStaffList = staffService.selectList(new EntityWrapper<CommonStaff>()
                     List<CommonStaff> commonStaffList = staffService.selectList(new EntityWrapper<CommonStaff>()
                             .eq("dept_id", commonRole.getDeptId())
                             .eq("dept_id", commonRole.getDeptId())
@@ -1724,7 +1716,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     // 退回的单子 再启用
                     // 退回的单子 再启用
                     else {
                     else {
 
 
-                        if("发起人撤回".equals(warehousingOrder1.getApproveStatus())){
+                        if ("发起人撤回".equals(warehousingOrder1.getApproveStatus())) {
                             Workflow workflow = workflowService
                             Workflow workflow = workflowService
                                     .findLatestWorkflowByBusinessCodeByApp(warehousingOrder1.getCompId(), "WAREHOUSING-ORDER-APPROVE");
                                     .findLatestWorkflowByBusinessCodeByApp(warehousingOrder1.getCompId(), "WAREHOUSING-ORDER-APPROVE");
                             // 没配置审核流程,直接结束并处理信息
                             // 没配置审核流程,直接结束并处理信息
@@ -1754,10 +1746,9 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                                 // 设置状态 已提交审核
                                 // 设置状态 已提交审核
 //                                warehousingOrder1.setWorkflowId(workflow.getId());
 //                                warehousingOrder1.setWorkflowId(workflow.getId());
 //                                this.updateById(warehousingOrder1);
 //                                this.updateById(warehousingOrder1);
-                                workflowService.startInstance(workflow.getId(),batchId);
+                                workflowService.startInstance(workflow.getId(), batchId);
                             }
                             }
-                        }
-                        else {
+                        } else {
                             batchId = warehousingOrder1.getBatchId();
                             batchId = warehousingOrder1.getBatchId();
                             for (WarehousingOrder warehousingOrder2 : warehousingOrderList) {
                             for (WarehousingOrder warehousingOrder2 : warehousingOrderList) {
                                 warehousingOrder2.setStatusFlag(StatusEnum.PENDING_PAYMENT.getFlag());
                                 warehousingOrder2.setStatusFlag(StatusEnum.PENDING_PAYMENT.getFlag());
@@ -2427,7 +2418,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
             //查询收购方
             //查询收购方
             if (dataList.get(0).getContractNo() != null) {
             if (dataList.get(0).getContractNo() != null) {
                 ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                 ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                .eq("contract_no",dataList.get(0).getContractNo()).eq("comp_id",dataList.get(0).getCompId()).eq("delete_flag","0"));
+                        .eq("contract_no", dataList.get(0).getContractNo()).eq("comp_id", dataList.get(0).getCompId()).eq("delete_flag", "0"));
                 warehousingOrder1.setPurchaser(contractManagementInfo.getBuyer());
                 warehousingOrder1.setPurchaser(contractManagementInfo.getBuyer());
             }
             }
             warehousingOrder1.setWarehousingOrderList(dataList);
             warehousingOrder1.setWarehousingOrderList(dataList);
@@ -2487,8 +2478,8 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     } else {
                     } else {
                         warehousingOrder1.setPrice((dataList1.get(j).getTidalGrainPrice() - dataList1.get(j).getUnitDeduction()) * 1000);
                         warehousingOrder1.setPrice((dataList1.get(j).getTidalGrainPrice() - dataList1.get(j).getUnitDeduction()) * 1000);
                     }
                     }
-                    BigDecimal bd=new BigDecimal(warehousingOrder1.getPrice());
-                    Double priceNew=bd.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
+                    BigDecimal bd = new BigDecimal(warehousingOrder1.getPrice());
+                    Double priceNew = bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                     warehousingOrder1.setPrice(priceNew);
                     warehousingOrder1.setPrice(priceNew);
                 }
                 }
             }
             }
@@ -2516,7 +2507,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
             //查询收购方
             //查询收购方
             if (dataList.get(0).getContractNo() != null) {
             if (dataList.get(0).getContractNo() != null) {
                 ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                 ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                        .eq("contract_no",dataList.get(0).getContractNo()).eq("comp_id",dataList.get(0).getCompId()).eq("delete_flag","0"));
+                        .eq("contract_no", dataList.get(0).getContractNo()).eq("comp_id", dataList.get(0).getCompId()).eq("delete_flag", "0"));
                 warehousingOrder1.setPurchaser(contractManagementInfo.getBuyer());
                 warehousingOrder1.setPurchaser(contractManagementInfo.getBuyer());
             }
             }
             warehousingOrder1.setWarehousingOrderList(dataList);
             warehousingOrder1.setWarehousingOrderList(dataList);
@@ -2600,7 +2591,34 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     warehousingOrder2.setInWarehouseWeight(warehousingOrder1.getAfterWeight());
                     warehousingOrder2.setInWarehouseWeight(warehousingOrder1.getAfterWeight());
                     warehousingOrder2.setSurplusWeight(warehousingOrder1.getAfterWeight());
                     warehousingOrder2.setSurplusWeight(warehousingOrder1.getAfterWeight());
                     warehousingOrder2.setIssuingTime(new Date());
                     warehousingOrder2.setIssuingTime(new Date());
-                    warehousingOrder2.setAvgCost(afterCost);
+                    //查询仓库的煤款可分配金额
+                    CoalPaymentInfo coalPaymentInfo = coalPaymentInfoService.selectOne(new EntityWrapper<CoalPaymentInfo>()
+                            .eq("warehouse_id", warehousingOrder1.getBaseId()));
+                    if (coalPaymentInfo != null) {
+                        //该仓库之前的可分配金额
+                        Double beforeCoalMoney = coalPaymentInfo.getDistributableAmount();
+                        if (beforeCoalMoney > 0) {
+                            if (warehousingOrder1.getAfterWeight() >= 1 && coalPaymentInfo.getDistributableAmount() >
+                                    (warehousingOrder1.getAfterWeight() * coalPaymentInfo.getCurrentAverageAllocatedCost())) {
+                                warehousingOrder2.setAvgCost(afterCost + coalPaymentInfo.getCurrentAverageAllocatedCost());
+                                warehousingOrder2.setDryingFee(warehousingOrder1.getAfterWeight() * coalPaymentInfo.getCurrentAverageAllocatedCost());
+                                coalPaymentInfo.setDistributableAmount(beforeCoalMoney - warehousingOrder2.getDryingFee());
+                            } else if (warehousingOrder1.getAfterWeight() < 1 && coalPaymentInfo.getDistributableAmount() >
+                                    (warehousingOrder1.getAfterWeight() * coalPaymentInfo.getCurrentAverageAllocatedCost())) {
+                                warehousingOrder2.setAvgCost(afterCost + warehousingOrder1.getAfterWeight() * coalPaymentInfo.getCurrentAverageAllocatedCost());
+                                warehousingOrder2.setDryingFee(warehousingOrder1.getAfterWeight() * coalPaymentInfo.getCurrentAverageAllocatedCost());
+                                coalPaymentInfo.setDistributableAmount(beforeCoalMoney - warehousingOrder2.getDryingFee());
+                            } else if (coalPaymentInfo.getDistributableAmount() < warehousingOrder1.getAfterWeight() * coalPaymentInfo.getCurrentAverageAllocatedCost()) {
+                                warehousingOrder2.setAvgCost(afterCost + coalPaymentInfo.getDistributableAmount() / warehousingOrder1.getAfterWeight());
+                                warehousingOrder2.setDryingFee(coalPaymentInfo.getDistributableAmount());
+                                coalPaymentInfo.setDistributableAmount(beforeCoalMoney - warehousingOrder2.getDryingFee());
+                            }
+                            warehousingOrder2.setAmountMoney(warehousingOrder2.getDryingFee());
+                            coalPaymentInfoService.updateById(coalPaymentInfo);
+                        }
+                    } else {
+                        warehousingOrder2.setAvgCost(afterCost);
+                    }
                     this.insert(warehousingOrder2);
                     this.insert(warehousingOrder2);
                 }
                 }
 
 
@@ -2683,6 +2701,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
         return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
         return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
                 .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
                 .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
     }
     }
+
     /**
     /**
      * 修改入库单平均成本
      * 修改入库单平均成本
      *
      *
@@ -2726,14 +2745,14 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 EnabledInfo enabledInfo = enabledInfoService.selectOne(new EntityWrapper<EnabledInfo>()
                 EnabledInfo enabledInfo = enabledInfoService.selectOne(new EntityWrapper<EnabledInfo>()
                         .eq("comp_id", warehousingOrder1.getCompId())
                         .eq("comp_id", warehousingOrder1.getCompId())
                         .eq("function_type", "3")
                         .eq("function_type", "3")
-                        .eq("delete_flag","0"));
+                        .eq("delete_flag", "0"));
                 //查询入库单
                 //查询入库单
                 List<WarehousingOrder> warehousingOrderList = selectList(new EntityWrapper<WarehousingOrder>()
                 List<WarehousingOrder> warehousingOrderList = selectList(new EntityWrapper<WarehousingOrder>()
                         .eq("base_id", warehousingOrder1.getBaseId())
                         .eq("base_id", warehousingOrder1.getBaseId())
                         .eq("delete_flag", "0")
                         .eq("delete_flag", "0")
                         .eq("comp_id", warehousingOrder1.getCompId())
                         .eq("comp_id", warehousingOrder1.getCompId())
                         .gt("surplus_weight", 0d)
                         .gt("surplus_weight", 0d)
-                        .ne("status","待付款"));
+                        .ne("status", "待付款"));
                 if (!CollectionUtils.isEmpty(warehousingOrderList)) {
                 if (!CollectionUtils.isEmpty(warehousingOrderList)) {
                     for (int i = 0; i < warehousingOrderList.size(); i++) {
                     for (int i = 0; i < warehousingOrderList.size(); i++) {
                         totalSurplusWeight += warehousingOrderList.get(i).getSurplusWeight();
                         totalSurplusWeight += warehousingOrderList.get(i).getSurplusWeight();
@@ -2746,7 +2765,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
                 if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
                     distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
                     distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
                 }
                 }
-                distributionMoney=distributionMoney+warehousingOrder1.getInterest()+warehousingOrder1.getStorageFee();
+                distributionMoney = distributionMoney + warehousingOrder1.getInterest() + warehousingOrder1.getStorageFee();
                 if (distributionMoney / warehousingOrder1.getInWarehouseWeight() < 100) {
                 if (distributionMoney / warehousingOrder1.getInWarehouseWeight() < 100) {
                     //计算当天分摊仓储费总和
                     //计算当天分摊仓储费总和
                     inTarDayTotal = totalSurplusWeight * enabledInfo.getValue();
                     inTarDayTotal = totalSurplusWeight * enabledInfo.getValue();
@@ -2789,6 +2808,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
 
 
     /**
     /**
      * 入库单导出
      * 入库单导出
+     *
      * @param warehousingOrder
      * @param warehousingOrder
      * @param response
      * @param response
      * @throws Exception
      * @throws Exception
@@ -3147,7 +3167,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                     ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                             .eq("contract_no", warehousingOrder1.getContractNo())
                             .eq("contract_no", warehousingOrder1.getContractNo())
                             .eq("comp_id", warehousingOrder1.getCompId())
                             .eq("comp_id", warehousingOrder1.getCompId())
-                            .eq("delete_flag","0"));
+                            .eq("delete_flag", "0"));
                     if (contractManagementInfo != null) {
                     if (contractManagementInfo != null) {
                         warehousingOrder1.setBuyer(contractManagementInfo.getBuyer());
                         warehousingOrder1.setBuyer(contractManagementInfo.getBuyer());
                     }
                     }
@@ -3177,13 +3197,13 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 cell.setCellValue(warehousingOrder1.getWeightedMoisture() != null ? warehousingOrder1.getWeightedMoisture() : 0d);
                 cell.setCellValue(warehousingOrder1.getWeightedMoisture() != null ? warehousingOrder1.getWeightedMoisture() : 0d);
                 cell.setCellStyle(styleDetail);
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(8);
                 cell = rowx.createCell(8);
-                cell.setCellValue(editDouble(warehousingOrder1.getAvgCost() != null?warehousingOrder1.getAvgCost():0d));
+                cell.setCellValue(editDouble(warehousingOrder1.getAvgCost() != null ? warehousingOrder1.getAvgCost() : 0d));
                 cell.setCellStyle(styleDetail);
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(9);
                 cell = rowx.createCell(9);
-                cell.setCellValue(editDouble(warehousingOrder1.getInWarehouseWeight() != null?warehousingOrder1.getInWarehouseWeight():0d));
+                cell.setCellValue(editDouble(warehousingOrder1.getInWarehouseWeight() != null ? warehousingOrder1.getInWarehouseWeight() : 0d));
                 cell.setCellStyle(styleDetail);
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(10);
                 cell = rowx.createCell(10);
-                cell.setCellValue(editDouble(warehousingOrder1.getGrainFund() != null?warehousingOrder1.getGrainFund():0d));
+                cell.setCellValue(editDouble(warehousingOrder1.getGrainFund() != null ? warehousingOrder1.getGrainFund() : 0d));
                 cell.setCellStyle(styleDetail);
                 cell.setCellStyle(styleDetail);
                 cell = rowx.createCell(11);
                 cell = rowx.createCell(11);
                 cell.setCellValue(editString(warehousingOrder1.getBusinessDescription()));
                 cell.setCellValue(editString(warehousingOrder1.getBusinessDescription()));
@@ -3214,6 +3234,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
         // 下载
         // 下载
         download(path, response, wb);
         download(path, response, wb);
     }
     }
+
     /**
     /**
      * 下载
      * 下载
      *
      *

+ 37 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CoalPaymentInfoMapper.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.CoalPaymentInfoMapper">
+
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(id)
+        FROM coal_payment_info
+        WHERE
+        delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(warehouse_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+    </select>
+    <select id="getListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.CoalPaymentInfo">
+        SELECT
+        id,
+        comp_id as compId,
+        warehouse_id as warehouseId,
+        warehouse_name as warehouseName,
+        distributable_amount as distributableAmount,
+        current_average_allocated_cost as currentAverageAllocatedCost,
+        create_date as createDate,
+        update_date as updateDate
+        FROM coal_payment_info
+        WHERE
+        delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(warehouse_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        ORDER BY update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
+</mapper>

+ 35 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ExpenseInfoMapper.xml

@@ -492,6 +492,41 @@
         </if>
         </if>
     </select>
     </select>
 
 
+    <select id="getRequestRecordCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(id)
+        FROM expense_info
+        WHERE
+        delete_flag = '0'
+        AND expenses_purpose ='3'
+        AND auto_assign ='5'
+        AND status_flag ='7'
+        <if test="warehouseId != null and warehouseId != ''">
+            AND warehouse_id = #{warehouseId}
+        </if>
+    </select>
+    <select id="getRequestRecordListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo">
+        SELECT
+        id,
+        amount_money as amountMoney,
+        coal_price as coalPrice,
+        payment_date as paymentDate,
+        create_date as createDate
+        FROM expense_info
+        WHERE
+        delete_flag = '0'
+        AND expenses_purpose ='3'
+        AND auto_assign ='5'
+        AND status_flag ='7'
+        <if test="warehouseId != null and warehouseId != ''">
+            AND warehouse_id = #{warehouseId}
+        </if>
+        ORDER BY update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 
 
     <!-- Bi统计(月) -->
     <!-- Bi统计(月) -->
     <select id="getBiMonthByCondition" parameterType="Map"
     <select id="getBiMonthByCondition" parameterType="Map"