Просмотр исходного кода

Merge branch 'master' of http://47.100.3.209:3000/gdc/yiliangyiyun

ccj 3 лет назад
Родитель
Сommit
b98f768ef8
44 измененных файлов с 2426 добавлено и 264 удалено
  1. 0 100
      src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/LeaveInfo.java
  2. 0 16
      src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/LeaveInfoMapper.java
  3. 0 16
      src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ILeaveInfoService.java
  4. 0 20
      src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/LeaveInfoServiceImpl.java
  5. 1 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/GeneratorCodeByTables.java
  6. 7 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ContractManagementInfoController.java
  7. 11 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ExpenseInfoController.java
  8. 21 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/FillingDetailInfoController.java
  9. 4 4
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/FuelFillingInfoController.java
  10. 7 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/WarehouseBaseInfoController.java
  11. 23 2
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/WarehousingOrderController.java
  12. 4 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ContractExpensesInfo.java
  13. 14 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ContractManagementInfo.java
  14. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseInfo.java
  15. 70 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FillingDetailInfo.java
  16. 171 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FuelFillingInfo.java
  17. 6 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/SourceRelationInfo.java
  18. 4 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehouseBaseInfo.java
  19. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehousingOrder.java
  20. 15 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/ContractManagementInfoMapper.java
  21. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/FillingDetailInfoMapper.java
  22. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/FuelFillingInfoMapper.java
  23. 7 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/WarehouseBaseInfoMapper.java
  24. 6 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IContractManagementInfoService.java
  25. 8 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IExpenseInfoService.java
  26. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IFillingDetailInfoService.java
  27. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IFuelFillingInfoService.java
  28. 6 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IWarehouseBaseInfoService.java
  29. 17 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IWarehousingOrderService.java
  30. 5 10
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractExpensesInfoServiceImpl.java
  31. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractManagementInfoServiceImpl.java
  32. 653 14
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java
  33. 20 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/FillingDetailInfoServiceImpl.java
  34. 20 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/FuelFillingInfoServiceImpl.java
  35. 14 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java
  36. 745 21
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java
  37. 29 19
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/WarehousingOrderListener.java
  38. 27 33
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ContractExpensesInfoMapper.xml
  39. 341 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ContractManagementInfoMapper.xml
  40. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ExpenseInfoMapper.xml
  41. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/FillingDetailInfoMapper.xml
  42. 1 1
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/FuelFillingInfoMapper.xml
  43. 45 4
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehouseBaseInfoMapper.xml
  44. 13 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehousingOrderMapper.xml

+ 0 - 100
src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/LeaveInfo.java

@@ -1,100 +0,0 @@
-package com.yh.saas.plugin.yiliangyiyun.entity;
-
-import java.util.Date;
-import com.baomidou.mybatisplus.activerecord.Model;
-import BaseModel;
-import java.io.Serializable;
-
-import com.baomidou.mybatisplus.annotations.Version;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-/**
- * <p>
- * 记录请假信息
- * </p>
- *
- * @author Gdc
- * @since 2022-06-22
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@Accessors(chain = true)
-public class LeaveInfo extends BaseModel<LeaveInfo> {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键id
-     */
-    private String id;
-    /**
-     * 公司id
-     */
-    private String compId;
-    /**
-     * 打卡id
-     */
-    private String clockId;
-    /**
-     * 用户id
-     */
-    private String commonId;
-    /**
-     * 请假编号
-     */
-    private String leaveNo;
-    /**
-     * 员工姓名
-     */
-    private String empName;
-    /**
-     * 请假事由
-     */
-    private String reasonForLeave;
-    /**
-     * 请假开始时间
-     */
-    private Date startDate;
-    /**
-     * 请假结束时间
-     */
-    private Date endDate;
-    /**
-     * 请假类型
-     */
-    private String leaveType;
-    /**
-     * 请假类型key(1事假3病假)
-     */
-    private String leaveTypeKey;
-    /**
-     * 请假时长
-     */
-    private String leaveDuration;
-    /**
-     * 状态
-     */
-    private String status;
-    /**
-     * 状态标识
-     */
-    private String statusFlag;
-    /**
-     * 审核状态
-     */
-    private String approveStatus;
-    /**
-     * 工作流ID
-     */
-    private String workflowId;
-
-
-    @Override
-    protected Serializable pkVal() {
-        return this.id;
-    }
-
-}

+ 0 - 16
src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/LeaveInfoMapper.java

@@ -1,16 +0,0 @@
-package com.yh.saas.plugin.yiliangyiyun.mapper;
-
-import com.yh.saas.plugin.yiliangyiyun.entity.LeaveInfo;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-
-/**
- * <p>
- * 记录请假信息 Mapper 接口
- * </p>
- *
- * @author Gdc
- * @since 2022-06-22
- */
-public interface LeaveInfoMapper extends BaseMapper<LeaveInfo> {
-
-}

+ 0 - 16
src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ILeaveInfoService.java

@@ -1,16 +0,0 @@
-package com.yh.saas.plugin.yiliangyiyun.service;
-
-import com.yh.saas.plugin.yiliangyiyun.entity.LeaveInfo;
-import com.baomidou.mybatisplus.service.IService;
-
-/**
- * <p>
- * 记录请假信息 服务类
- * </p>
- *
- * @author Gdc
- * @since 2022-06-22
- */
-public interface ILeaveInfoService extends IService<LeaveInfo> {
-
-}

+ 0 - 20
src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/LeaveInfoServiceImpl.java

@@ -1,20 +0,0 @@
-package com.yh.saas.plugin.yiliangyiyun.service.impl;
-
-import com.yh.saas.plugin.yiliangyiyun.entity.LeaveInfo;
-import com.yh.saas.plugin.yiliangyiyun.mapper.LeaveInfoMapper;
-import com.yh.saas.plugin.yiliangyiyun.service.ILeaveInfoService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 记录请假信息 服务实现类
- * </p>
- *
- * @author Gdc
- * @since 2022-06-22
- */
-@Service
-public class LeaveInfoServiceImpl extends ServiceImpl<LeaveInfoMapper, LeaveInfo> implements ILeaveInfoService {
-
-}

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/GeneratorCodeByTables.java

@@ -53,7 +53,7 @@ public class GeneratorCodeByTables {
     }
 
     public static void main(String[] args) throws IOException {
-        generateByTables("Gdc", "com.yh.saas.plugin.yiliangyiyun","leave_info");
+        generateByTables("Gdc", "com.yh.saas.plugin.yiliangyiyun","filling_detail_info");
     }
 
     /**

+ 7 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ContractManagementInfoController.java

@@ -135,6 +135,12 @@ public class ContractManagementInfoController {
     public Page<ContractManagementInfo> selectContractInfo(ContractManagementInfo contractManagementInfo) {
         return contractManagementInfoService.selectContractInfo(contractManagementInfo);
     }
-
+    /**
+     * 合同利润图表
+     */
+    @GetMapping("/selectContractChart")
+    public ContractManagementInfo selectContractChart(ContractManagementInfo contractManagementInfo) {
+        return contractManagementInfoService.selectContractChart(contractManagementInfo);
+    }
     }
 

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

@@ -9,6 +9,7 @@ import com.yh.saas.plugin.yiliangyiyun.service.IExpenseInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.util.Date;
 import java.util.List;
@@ -115,6 +116,16 @@ public class ExpenseInfoController {
     public List<ExpenseInfo> expenseList(String compId, String startDate, String endDate){
         return expenseInfoService.expenseList(compId,startDate,endDate);
     }
+    /**
+     * 手机审核文件下载
+     *
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/exportPhone")
+    public String exportPhone(@RequestBody ExpenseInfo example, HttpServletResponse response) throws Exception {
+        return expenseInfoService.exportPhone(example,response);
+    }
 
 }
 

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

@@ -0,0 +1,21 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 记录加油明细 前端控制器
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+@RestController
+@RequestMapping("/fillingDetailInfo")
+public class FillingDetailInfoController {
+
+}
+

+ 4 - 4
src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/LeaveInfoController.java → winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/FuelFillingInfoController.java

@@ -7,15 +7,15 @@ import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
- * 记录请假信息 前端控制器
+ * 记录加油信息 前端控制器
  * </p>
  *
  * @author Gdc
- * @since 2022-06-22
+ * @since 2022-06-24
  */
 @RestController
-@RequestMapping("/leaveInfo")
-public class LeaveInfoController {
+@RequestMapping("/fuelFillingInfo")
+public class FuelFillingInfoController {
 
 }
 

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

@@ -241,5 +241,12 @@ public class WarehouseBaseInfoController {
     public Page<WarehouseBaseInfo> selectBaseInfo(WarehouseBaseInfo warehouseBaseInfo) {
         return warehouseBaseInfoService.selectBaseInfo(warehouseBaseInfo);
     }
+    /**
+     * 库点利润图表
+     */
+    @GetMapping("/selectWarehouseChart")
+    public WarehouseBaseInfo selectWarehouseChart(WarehouseBaseInfo warehouseBaseInfo) {
+        return warehouseBaseInfoService.selectWarehouseChart(warehouseBaseInfo);
+    }
 }
 

+ 23 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/WarehousingOrderController.java

@@ -2,9 +2,8 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
 import com.yh.saas.plugin.yiliangyiyun.entity.SourceRelationInfo;
-import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseInOutInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehousingOrder;
-import com.yh.saas.plugin.yiliangyiyun.service.IWarehouseInOutInfoService;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.PaymentView;
 import com.yh.saas.plugin.yiliangyiyun.service.IWarehousingOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import com.baomidou.mybatisplus.plugins.Page;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
 import java.util.List;
@@ -67,6 +67,27 @@ public class WarehousingOrderController {
     public String payMoney(@RequestBody WarehousingOrder warehousingOrder){
         return warehousingOrderService.payMoney(warehousingOrder);
     }
+    /**
+     * 手机审核文件下载
+     *
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/exportPhone")
+    public String exportPhone(@RequestBody WarehousingOrder example, HttpServletResponse response) throws Exception {
+        return warehousingOrderService.exportPhone(example,response);
+    }
+
+    /**
+     * 手机审核数据
+     *
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/exportPhoneData")
+    public WarehousingOrder exportPhoneData(@RequestBody WarehousingOrder warehousingOrder) {
+        return warehousingOrderService.exportPhoneData(warehousingOrder);
+    }
 
 }
 

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

@@ -60,6 +60,10 @@ public class ContractExpensesInfo extends BaseModel<ContractExpensesInfo> {
      * 类型(1收入2支出)
      */
     private String expensesType;
+    /**
+     * 费用类型(1粮款3非粮款5保证金)
+     */
+    private String grainType;
     /**
      * 费用名称
      */

+ 14 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ContractManagementInfo.java

@@ -555,7 +555,20 @@ public class ContractManagementInfo extends BaseModel<ContractManagementInfo> {
      */
     @TableField(exist = false)
     private String searchContractType;
-
+    /**
+     * 图表类型
+     */
+    @TableField(exist = false)
+    private String type;
+    /**
+     * 图表合同利润
+     */
+    @TableField(exist = false)
+    private Double contractProfit;
+    @TableField(exist = false)
+    private List<ContractManagementInfo> chartList;
+    @TableField(exist = false)
+    private List<ContractManagementInfo> formList;
 
     @Override
     protected Serializable pkVal() {

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

@@ -277,6 +277,11 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      */
     @TableField(exist = false)
     private List<ExpenseAllocationInfo> expenseAllocationInfoList;
+    /**
+     * 分配详情(驳回)
+     */
+    @TableField(exist = false)
+    private List<ExpenseAllocationInfo> expenseAllocationInfoListBH;
 
     @Override
     protected Serializable pkVal() {

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

@@ -0,0 +1,70 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import java.io.Serializable;
+
+
+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 2022-06-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("filling_detail_info")
+public class FillingDetailInfo extends BaseModel<FillingDetailInfo> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+    /**
+     * 公司id
+     */
+    private String compId;
+    /**
+     * 用户id
+     */
+    private String commonId;
+    /**
+     * 加油id
+     */
+    private String fillingId;
+    /**
+     * 油耗(L)
+     */
+    private Double oilConsumption;
+    /**
+     * 当前油价(元/升)
+     */
+    private Double currentOilPrice;
+    /**
+     * 本次消费(元)
+     */
+    private Double currentConsumption;
+    /**
+     * 加油凭证
+     */
+    private String addressUrl;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

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

@@ -0,0 +1,171 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import java.util.Date;
+import java.io.Serializable;
+
+
+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 2022-06-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("fuel_filling_info")
+public class FuelFillingInfo extends BaseModel<FuelFillingInfo> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+    /**
+     * 公司id
+     */
+    private String compId;
+    /**
+     * 用户id
+     */
+    private String commonId;
+    /**
+     * 申请编号
+     */
+    private String fillingNo;
+    /**
+     * 行程类型(1长途3短途)
+     */
+    private String strokeType;
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+    /**
+     * 发货库
+     */
+    private String sendWarehouse;
+    /**
+     * 收货库
+     */
+    private String receiveWarehouse;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 司机姓名
+     */
+    private String dirverName;
+    /**
+     * 车牌号
+     */
+    private String carNo;
+    /**
+     * 里程(公里)
+     */
+    private Double mileage;
+    /**
+     * 总里程(公里)
+     */
+    private Double totalMileage;
+    /**
+     * 请款金额(元)
+     */
+    private Double amountRequested;
+    /**
+     * 始发地省
+     */
+    private String originProvince;
+    /**
+     * 始发地市
+     */
+    private String originCity;
+    /**
+     * 始发地区
+     */
+    private String originArea;
+    /**
+     * 始发地详细地址
+     */
+    private String originAddress;
+    /**
+     * 始发地经度
+     */
+    private String originLongitude;
+    /**
+     * 始发地纬度
+     */
+    private String originLatitude;
+    /**
+     * 终到地省
+     */
+    private String destinationProvince;
+    /**
+     * 终到地市
+     */
+    private String destinationCity;
+    /**
+     * 终到地区
+     */
+    private String destinationArea;
+    /**
+     * 终到地详细地址
+     */
+    private String destinationAddress;
+    /**
+     * 终到地经度
+     */
+    private String destinationLongitude;
+    /**
+     * 终到地纬度
+     */
+    private String destinationLatitude;
+    /**
+     * 请款日期
+     */
+    private Date amountDeadline;
+    /**
+     * 总金额
+     */
+    private Double totalCost;
+    /**
+     * 总油耗(L)
+     */
+    private Double tfc;
+    /**
+     * 状态
+     */
+    private String status;
+    /**
+     * 状态标识
+     */
+    private String statusFlag;
+    /**
+     * 审核状态
+     */
+    private String approveStatus;
+    /**
+     * 工作流ID
+     */
+    private String workflowId;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

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

@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.entity;
 
 import java.util.Date;
 import java.io.Serializable;
+import java.util.List;
 
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
@@ -95,6 +96,11 @@ public class SourceRelationInfo extends BaseModel<SourceRelationInfo> {
      */
     @TableField(exist = false)
     private String returnTickFlag;
+    /**
+     * 货源关联列表
+     */
+    @TableField(exist = false)
+    private List<SourceRelationInfo> sourceRelationInfoList;
 
     @Override
     protected Serializable pkVal() {

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

@@ -243,6 +243,10 @@ public class WarehouseBaseInfo extends BaseModel<WarehouseBaseInfo> {
      */
     @TableField(exist = false)
     private Double saleWeight;
+    @TableField(exist = false)
+    private List<WarehouseBaseInfo> chartList;
+    @TableField(exist = false)
+    private List<WarehouseBaseInfo> formList;
 
 
 

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

@@ -253,6 +253,11 @@ public class WarehousingOrder extends BaseModel<WarehousingOrder> {
      */
     @TableField(exist = false)
     private Float inWarehouseWeightTotal;
+    /**
+     *車數
+     */
+    @TableField(exist = false)
+    private Integer count;
 
     @Override
     protected Serializable pkVal() {

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

@@ -50,4 +50,19 @@ public interface ContractManagementInfoMapper extends BaseMapper<ContractManagem
      * @return
      */
     List<ContractManagementInfo> getContractListByCondition(Map<String, Object> pageView);
+
+    /**
+     * 合同利润图
+     *
+     * @param pageView
+     * @return
+     */
+    List<ContractManagementInfo> getContractChartByCondition(Map<String, Object> pageView);
+    /**
+     * 合同利润表
+     *
+     * @param pageView
+     * @return
+     */
+    List<ContractManagementInfo> getContractFormByCondition(Map<String, Object> pageView);
 }

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

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.FillingDetailInfo;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 记录加油明细 Mapper 接口
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+public interface FillingDetailInfoMapper extends BaseMapper<FillingDetailInfo> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 记录加油信息 Mapper 接口
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+public interface FuelFillingInfoMapper extends BaseMapper<FuelFillingInfo> {
+
+}

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

@@ -94,4 +94,11 @@ public interface WarehouseBaseInfoMapper extends BaseMapper<WarehouseBaseInfo> {
      * @return
      */
     List<WarehouseBaseInfo> getBaseListByCondition(Map<String, Object> pageView);
+    /**
+     * 库点利润图
+     *
+     * @param pageView
+     * @return
+     */
+    List<WarehouseBaseInfo> getWarehouseChartByCondition(Map<String, Object> pageView);
 }

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

@@ -97,4 +97,10 @@ public interface IContractManagementInfoService extends IService<ContractManagem
      * @return
      */
     Page<ContractManagementInfo> selectContractInfo(ContractManagementInfo contractManagementInfo);
+    /**
+     * 合同利润图表
+     *
+     * @param contractManagementInfo
+     */
+    ContractManagementInfo selectContractChart(ContractManagementInfo contractManagementInfo);
 }

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

@@ -5,7 +5,7 @@ import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
 import com.baomidou.mybatisplus.service.IService;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehousingOrder;
 
-import java.util.Date;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -76,4 +76,11 @@ public interface IExpenseInfoService extends IService<ExpenseInfo> {
      * @return
      */
     List<ExpenseInfo> expenseList(String compId,String startDate,String endDate);
+    /**
+     * 手机审核文件下载
+     * @param expenseInfo
+     * @param response
+     * @throws Exception
+     */
+    String exportPhone(ExpenseInfo expenseInfo, HttpServletResponse response) throws Exception;
 }

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

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.FillingDetailInfo;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ * 记录加油明细 服务类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+public interface IFillingDetailInfoService extends IService<FillingDetailInfo> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ * 记录加油信息 服务类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+public interface IFuelFillingInfoService extends IService<FuelFillingInfo> {
+
+}

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

@@ -151,4 +151,10 @@ public interface IWarehouseBaseInfoService extends IService<WarehouseBaseInfo> {
      * @return
      */
     Page<WarehouseBaseInfo> selectBaseInfo(WarehouseBaseInfo warehouseBaseInfo);
+    /**
+     * 库点利润图表
+     *
+     * @param warehouseBaseInfo
+     */
+    WarehouseBaseInfo selectWarehouseChart(WarehouseBaseInfo warehouseBaseInfo);
 }

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

@@ -1,11 +1,14 @@
 package com.yh.saas.plugin.yiliangyiyun.service;
 
 import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.PaymentManagement;
 import com.yh.saas.plugin.yiliangyiyun.entity.SourceRelationInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseInOutInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehousingOrder;
 import com.baomidou.mybatisplus.service.IService;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.PaymentView;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -43,5 +46,19 @@ public interface IWarehousingOrderService extends IService<WarehousingOrder> {
      * @param warehousingOrder
      */
     String payMoney(WarehousingOrder warehousingOrder);
+    /**
+     * 手机审核文件下载
+     * @param warehousingOrder
+     * @param response
+     * @throws Exception
+     */
+    String exportPhone(WarehousingOrder warehousingOrder, HttpServletResponse response) throws Exception;
+    /**
+     * 手机审核数据
+     * @param warehousingOrder
+     * @param
+     * @throws Exception
+     */
+    WarehousingOrder exportPhoneData(WarehousingOrder warehousingOrder);
 
 }

+ 5 - 10
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractExpensesInfoServiceImpl.java

@@ -36,16 +36,11 @@ public class ContractExpensesInfoServiceImpl extends ServiceImpl<ContractExpense
                 * contractExpensesInfo.getPageSize());
         //  公司ID
         pageView.put("compId", AuthSecurityUtils.getCurrentUserInfo().getCompId());
-        //合同费用
-        if("1".equals(contractExpensesInfo.getCostType())){
-            pageView.put("contractNo", contractExpensesInfo.getContractNo());
-        }
-        //库点费用
-        else{
-            pageView.put("warehouseName",contractExpensesInfo.getWarehouseName());
-            pageView.put("startDate", contractExpensesInfo.getStartDate());
-            pageView.put("endDate", contractExpensesInfo.getEndDate());
-        }
+        pageView.put("contractNo", contractExpensesInfo.getContractNo());
+        pageView.put("costType",contractExpensesInfo.getCostType());
+        pageView.put("warehouseName",contractExpensesInfo.getWarehouseName());
+        pageView.put("startDate", contractExpensesInfo.getStartDate());
+        pageView.put("endDate", contractExpensesInfo.getEndDate());
         pageView.put("pageSize", contractExpensesInfo.getPageSize());
         pageView.put("currentPage", contractExpensesInfo.getCurrentPage());
         // 查询服务商总数

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

@@ -2292,4 +2292,20 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
         return page;
     }
 
+    @Override
+    public ContractManagementInfo selectContractChart(ContractManagementInfo contractManagementInfo) {
+        ContractManagementInfo  contractManagementInfo1=new ContractManagementInfo();
+        Map<String, Object> pageView = new HashMap<>();
+        //  公司ID
+        pageView.put("compId", AuthSecurityUtils.getCurrentUserInfo().getCompId());
+        pageView.put("startDate", contractManagementInfo.getStartDate());
+        pageView.put("endDate", contractManagementInfo.getEndDate());
+        List<ContractManagementInfo> dataList = baseMapper.getContractChartByCondition(pageView);
+        List<ContractManagementInfo> dataList1 = baseMapper.getContractFormByCondition(pageView);
+        contractManagementInfo1.setChartList(dataList);
+        contractManagementInfo1.setFormList(dataList1);
+
+        return contractManagementInfo1;
+    }
+
 }

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

@@ -2,36 +2,58 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alipay.sofa.runtime.api.annotation.SofaReference;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.ObjectMetadata;
+import com.aliyun.oss.model.PutObjectRequest;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.google.common.collect.Lists;
 import com.winsea.svc.base.base.entity.CommonRoleResource;
+import com.winsea.svc.base.base.entity.CommonStaff;
 import com.winsea.svc.base.base.service.ICommonRoleResourceService;
+import com.winsea.svc.base.base.service.ICommonStaffService;
+import com.winsea.svc.base.base.util.DateUtils;
 import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.winsea.svc.base.workflow.entity.Workflow;
+import com.winsea.svc.notice.entity.NoticeTaskInfo;
+import com.winsea.svc.notice.entity.base.BaseNotice;
+import com.winsea.svc.notice.service.INoticeService;
+import com.winsea.svc.notice.service.INoticeTaskService;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
 import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
-import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseAllocationInfo;
-import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
-import com.yh.saas.plugin.yiliangyiyun.entity.WarehousingOrder;
+import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
 import com.yh.saas.plugin.yiliangyiyun.exception.YException;
 import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.ExpenseInfoMapper;
-import com.yh.saas.plugin.yiliangyiyun.service.IExpenseAllocationInfoService;
-import com.yh.saas.plugin.yiliangyiyun.service.IExpenseInfoService;
+import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.yh.saas.plugin.yiliangyiyun.service.INewWorkflowService;
-import com.yh.saas.plugin.yiliangyiyun.service.IWarehousingOrderService;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.httpclient.util.DateUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.http.entity.ContentType;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -45,6 +67,7 @@ import java.util.stream.Collectors;
  * @since 2022-05-29
  */
 @Service
+@Slf4j
 public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, ExpenseInfo> implements IExpenseInfoService {
     @Autowired
     private INewWorkflowService workflowService;
@@ -56,6 +79,21 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
     private ICommonBillOperateHisService billOperateHisService;
     @Autowired
     private IWarehousingOrderService warehousingOrderService;
+    @Autowired
+    private IContractExpensesInfoService contractExpensesInfoService;
+    @Autowired
+    private IContractManagementInfoService contractManagementInfoService;
+    @Autowired
+    private IWarehouseBaseInfoService warehouseBaseInfoService;
+    @Value("${file-root-path}")
+    private String localPath;
+    @Autowired
+    private OSSClient ossClient;
+    @Value("${oss.endpoint.internal:}")
+    private String baseUrl;
+    @Getter
+    @Value("${oss.bucket.name:}")
+    private String bucket;
 
     @Override
     public Page<ExpenseInfo> selectInfo(ExpenseInfo expenseInfo) {
@@ -64,7 +102,7 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
                 * expenseInfo.getPageSize());
         List<String> businessKeys = null;
         if ("2".equals(expenseInfo.getSearchType())) {
-            businessKeys = workflowService.getTaskBusinessKeysByCode("COLLECTION-WAREHOUSING-RECORD");
+            businessKeys = workflowService.getTaskBusinessKeysByCode("FEIYONGGUANLI-APPROVE");
         }
         List<String> statusSet = new ArrayList<>();
         List<String> resourceIdList = this.getResourceIdList();
@@ -93,6 +131,19 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
                     taskId = jsonObject.getString("taskId");
                     expenseInfo1.setTaskId(taskId);
                 }
+                List<ExpenseAllocationInfo> expenseAllocationInfos=expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+                        .eq("info_id",expenseInfo1.getId())
+                        .eq("status","待确认"));
+                if (expenseAllocationInfos.size()>0){
+                    expenseInfo1.setDistributionStatus(StatusEnum.TO_BE_CONFIRMED.getName());
+                    expenseInfo1.setExpenseAllocationInfoList(expenseAllocationInfos);
+                }
+                List<ExpenseAllocationInfo> expenseAllocationInfoList=expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+                        .eq("info_id",expenseInfo1.getId())
+                        .eq("status","已驳回"));
+                if (expenseAllocationInfoList.size()>0){
+                    expenseInfo1.setExpenseAllocationInfoListBH(expenseAllocationInfoList);
+                }
             });
 
         }
@@ -134,11 +185,19 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String addInfo(ExpenseInfo expenseInfo) {
         expenseInfo.setId(IdGenerator.generateUUID());
         //收入
         if ("1".equals(expenseInfo.getExpensesType())){
+            expenseInfo.setStatusFlag(StatusEnum.TO_BE_CONFIRMED.getFlag());
+            expenseInfo.setStatus(StatusEnum.TO_BE_CONFIRMED.getName());
             this.insert(expenseInfo);
+            // 插入操作历史
+            String staffName = this.billOperateHisService.getStaffAndName();
+            // 插入操作历史
+            this.billOperateHisService.saveBillOperateHis(expenseInfo.getId(), NumberConstant.EXPENSE_MANAGEMENT, staffName, null,
+                    "收款"+"("+expenseInfo.getAmountMoney()+")", null, expenseInfo.getRemark());
         }
         //支出
         else
@@ -167,7 +226,7 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
             // 不是退回的单子
             if (isStartWorkflow) {
                 Workflow workflow = workflowService
-                        .findLatestWorkflowByBusinessCodeByApp(expenseInfo.getCompId(), "FEE_DETAILS_MANG");
+                        .findLatestWorkflowByBusinessCodeByApp(expenseInfo.getCompId(), "FEIYONGGUANLI-APPROVE");
                 // 没配置审核流程,直接结束并处理信息
                 if (workflow == null) {
                     throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
@@ -190,11 +249,46 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String editInfo(ExpenseInfo expenseInfo) {
+        ExpenseInfo expenseInfo1=this.selectById(expenseInfo.getId());
         //确认收款
         if ("0".equals(expenseInfo.getFlag())) {
             expenseInfo.setStatusFlag(StatusEnum.COST_RECEIVED.getFlag());
             expenseInfo.setStatus(StatusEnum.COST_RECEIVED.getName());
+            ContractExpensesInfo contractExpensesInfo=new ContractExpensesInfo();
+            contractExpensesInfo.setCompId(expenseInfo1.getCompId());
+            contractExpensesInfo.setExpensesType("1");
+            contractExpensesInfo.setExpensesName(expenseInfo1.getExpenseName());
+            contractExpensesInfo.setPersonName(expenseInfo1.getAgent());
+            contractExpensesInfo.setPayDeadline(new Date());
+            contractExpensesInfo.setExpensesId(expenseInfo1.getId());
+            contractExpensesInfo.setExpensesPrice(expenseInfo1.getAmountMoney());
+            //保证金也属于粮款
+            if ("5".equals(expenseInfo1.getCostType())){
+                contractExpensesInfo.setGrainType("1");
+            }
+            else {
+                contractExpensesInfo.setGrainType(expenseInfo1.getCostType());
+            }
+            //合同费用
+            if ("1".equals(expenseInfo1.getExpensesPurpose())){
+                contractExpensesInfo.setContractId(expenseInfo1.getContractId());
+                contractExpensesInfo.setContractNo(expenseInfo1.getContractNo());
+                contractExpensesInfo.setCostType("1");
+            }
+            //库点费用
+            else if ("3".equals(expenseInfo1.getExpensesPurpose())){
+                contractExpensesInfo.setWarehouseId(expenseInfo1.getWarehouseId());
+                contractExpensesInfo.setWarehouseName(expenseInfo1.getWarehouseName());
+                contractExpensesInfo.setCostType("3");
+            }
+            contractExpensesInfoService.insert(contractExpensesInfo);
+            // 插入操作历史
+            String staffName = this.billOperateHisService.getStaffAndName();
+            // 插入操作历史
+            this.billOperateHisService.saveBillOperateHis(expenseInfo.getId(), NumberConstant.EXPENSE_MANAGEMENT, staffName, null,
+                    "确认"+"("+expenseInfo.getAmountMoney()+")", null, expenseInfo.getRemark());
         }
         //完成收款
         else if ("1".equals(expenseInfo.getFlag())){
@@ -203,16 +297,56 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         }
         //确认分配
         else if ("2".equals(expenseInfo.getFlag())){
-            expenseInfo.setDistributionStatusFlag(StatusEnum.COMPLETED.getFlag());
-            expenseInfo.setDistributionStatus(StatusEnum.COMPLETED.getName());
+            expenseInfo.setDistributionStatusFlag("");
+            expenseInfo.setDistributionStatus("");
             List<ExpenseAllocationInfo> expenseAllocationInfos=expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
-            .eq("info_id",expenseInfo.getId())
-            .eq("status","待确认"));
+                    .eq("info_id",expenseInfo.getId())
+                    .eq("status","待确认"));
             if (!CollectionUtils.isEmpty(expenseAllocationInfos)){
                 for (ExpenseAllocationInfo expenseAllocationInfo:expenseAllocationInfos){
                     expenseAllocationInfo.setStatusFlag(StatusEnum.COST_ADOPTED.getFlag());
                     expenseAllocationInfo.setStatus(StatusEnum.COST_ADOPTED.getName());
                     expenseAllocationInfoService.updateById(expenseAllocationInfo);
+                    //库点费用
+                    if ("3".equals(expenseInfo1.getExpensesPurpose())) {
+                        ContractExpensesInfo contractExpensesInfo = new ContractExpensesInfo();
+                        contractExpensesInfo.setCompId(expenseInfo1.getCompId());
+                        contractExpensesInfo.setExpensesType("2");
+                        contractExpensesInfo.setExpensesName(expenseInfo1.getExpenseName());
+                        contractExpensesInfo.setPersonName(expenseInfo1.getAgent());
+                        contractExpensesInfo.setPayDeadline(new Date());
+                        contractExpensesInfo.setExpensesId(expenseInfo1.getId());
+                        contractExpensesInfo.setExpensesPrice(expenseAllocationInfo.getDistributionMoney());
+                        //保证金也属于粮款
+                        if ("5".equals(expenseInfo1.getCostType())) {
+                            contractExpensesInfo.setGrainType("1");
+                        } else {
+                            contractExpensesInfo.setGrainType(expenseInfo1.getCostType());
+                        }
+                        WarehousingOrder warehousingOrder=warehousingOrderService.selectById(expenseAllocationInfo.getOrderId());
+                        if (warehousingOrder!=null&&"采购入库".equals(warehousingOrder.getInType())){
+                            ContractManagementInfo contractManagementInfo=contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                                    .eq("contract_no",warehousingOrder.getContractNo())
+                                    .eq("comp_id",warehousingOrder.getCompId()));
+                            if (contractManagementInfo!=null){
+                                contractExpensesInfo.setContractId(contractManagementInfo.getId());
+                                contractExpensesInfo.setContractNo(contractManagementInfo.getContractNo());
+                                contractExpensesInfo.setCostType("1");
+                            }
+                            else {
+                                WarehouseBaseInfo warehouseBaseInfo=warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
+                                        .eq("warehouse_name",warehousingOrder.getWarehouseName())
+                                        .eq("comp_id",warehousingOrder.getCompId()));
+                                if (warehouseBaseInfo!=null) {
+                                    contractExpensesInfo.setWarehouseId(warehouseBaseInfo.getId());
+                                    contractExpensesInfo.setWarehouseName(warehouseBaseInfo.getWarehouseName());
+                                    contractExpensesInfo.setCostType("3");
+                                }
+                            }
+                        }
+                        contractExpensesInfoService.insert(contractExpensesInfo);
+                    }
+
                 }
             }
         }
@@ -221,11 +355,45 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
             List<ExpenseAllocationInfo> expenseAllocationInfoList = expenseInfo.getExpenseAllocationInfoList();
             if (!CollectionUtils.isEmpty(expenseAllocationInfoList)) {
                 for (ExpenseAllocationInfo expenseAllocationInfo : expenseAllocationInfoList) {
-                    expenseAllocationInfoService.updateById(expenseAllocationInfo);
+                    //有id的编辑
+                    if (expenseAllocationInfo.getId()!=null) {
+                        expenseAllocationInfoService.updateById(expenseAllocationInfo);
+                    }
+                    else{
+                        expenseAllocationInfo.setId(IdGenerator.generateUUID());
+                        expenseAllocationInfo.setInfoId(expenseInfo.getId());
+                        expenseAllocationInfo.setStatusFlag(StatusEnum.TO_BE_CONFIRMED.getFlag());
+                        expenseAllocationInfo.setStatus(StatusEnum.TO_BE_CONFIRMED.getName());
+                        expenseAllocationInfoService.insert(expenseAllocationInfo);
+                    }
                 }
             }
         }
         //主表编辑 flag==4
+        else if ("4".equals(expenseInfo.getFlag())){
+            boolean isStartWorkflow = StringUtils.isBlank(expenseInfo.getWorkflowId());
+            // 不是退回的单子
+            if (isStartWorkflow) {
+                Workflow workflow = workflowService
+                        .findLatestWorkflowByBusinessCodeByApp(expenseInfo.getCompId(), "FEIYONGGUANLI-APPROVE");
+                // 没配置审核流程,直接结束并处理信息
+                if (workflow == null) {
+                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                }
+                // 开启审核流
+                else {
+                    // 设置状态 已提交审核
+                    expenseInfo.setWorkflowId(workflow.getId());
+                    this.updateById(expenseInfo);
+                    workflowService.startInstance(workflow.getId(), expenseInfo.getId());
+                }
+            }
+            // 退回的单子 再启用
+            else {
+                this.updateById(expenseInfo);
+                workflowService.activateInstance(expenseInfo.getWorkflowId(), expenseInfo.getId());
+            }
+        }
         //驳回分配
         else if ("5".equals(expenseInfo.getFlag())){
             expenseInfo.setDistributionStatusFlag(StatusEnum.REJECTED.getFlag());
@@ -262,10 +430,33 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
      * @return
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String payment(ExpenseInfo expenseInfo) {
         expenseInfo.setStatusFlag(StatusEnum.COST_PAID.getFlag());
         expenseInfo.setStatus(StatusEnum.COST_PAID.getName());
         this.updateById(expenseInfo);
+        ExpenseInfo expenseInfo1=this.selectById(expenseInfo.getId());
+        //合同费用
+        if ("1".equals(expenseInfo1.getExpensesPurpose())) {
+            ContractExpensesInfo contractExpensesInfo = new ContractExpensesInfo();
+            contractExpensesInfo.setCompId(expenseInfo1.getCompId());
+            contractExpensesInfo.setExpensesType("2");
+            contractExpensesInfo.setExpensesName(expenseInfo1.getExpenseName());
+            contractExpensesInfo.setPersonName(expenseInfo1.getAgent());
+            contractExpensesInfo.setPayDeadline(new Date());
+            contractExpensesInfo.setExpensesId(expenseInfo1.getId());
+            contractExpensesInfo.setExpensesPrice(expenseInfo1.getAmountMoney());
+            //保证金也属于粮款
+            if ("5".equals(expenseInfo1.getCostType())) {
+                contractExpensesInfo.setGrainType("1");
+            } else {
+                contractExpensesInfo.setGrainType(expenseInfo1.getCostType());
+            }
+            contractExpensesInfo.setContractId(expenseInfo1.getContractId());
+            contractExpensesInfo.setContractNo(expenseInfo1.getContractNo());
+            contractExpensesInfo.setCostType("1");
+            contractExpensesInfoService.insert(contractExpensesInfo);
+        }
         // 插入操作历史
         String staffName = this.billOperateHisService.getStaffAndName();
         // 插入操作历史
@@ -302,6 +493,7 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         if (receiptDocDate!=null){
             warehousingOrderWrapper.like("issuing_time", receiptDocDate);
         }
+        warehousingOrderWrapper.ne("in_type","退库");
         warehousingOrderWrapper.orderBy("update_date");
         List<WarehousingOrder> warehousingOrderList = warehousingOrderService.selectList(warehousingOrderWrapper);
         return warehousingOrderList;
@@ -352,6 +544,453 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         return dataList;
     }
 
+    @Override
+    public String exportPhone(ExpenseInfo expenseInfo, HttpServletResponse response) throws Exception {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+
+        // 1.Excel的头部信息
+        String headerTitle = "";
+
+        // 2.创建一个webbook 对应一个Excel文件
+        HSSFWorkbook wb = new HSSFWorkbook();
+
+        // 3.在webbook中添加一个sheet,对应Excel文件中的sheet
+        HSSFSheet sheet;
+
+        sheet = wb.createSheet("费用分配信息");
+        headerTitle = "费用分配信息";
+
+        // 4.设置打印参数
+        sheet.setMargin(HSSFSheet.TopMargin, (short) 1);// 页边距(上)
+        sheet.setMargin(HSSFSheet.BottomMargin, (short) 1);// 页边距(下)
+        sheet.setMargin(HSSFSheet.LeftMargin, (short) 1);// 页边距(左)
+        sheet.setMargin(HSSFSheet.RightMargin, (short) 1);// 页边距(右)
+
+        // 不显示网格
+        sheet.setDisplayGridlines(false);
+        // 设置水平居中
+        sheet.setHorizontallyCenter(true);
+
+        /**************** 数据行样式 start ****************/
+        HSSFFont fontTitle = wb.createFont();
+        fontTitle.setFontName("宋体");
+        fontTitle.setFontHeightInPoints((short) 14);
+        // 设置字体加粗
+        fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+
+        HSSFFont fontComp = wb.createFont();
+        fontComp.setFontName("宋体");
+        fontComp.setFontHeightInPoints((short) 16);
+        // 设置字体加粗
+        fontComp.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+
+        HSSFFont fontDetail = wb.createFont();
+        fontDetail.setFontName("宋体");
+        fontDetail.setFontHeightInPoints((short) 12);
+
+        HSSFFont fontDetail1 = wb.createFont();
+        fontDetail1.setFontName("宋体");
+        fontDetail1.setFontHeightInPoints((short) 12);
+        fontDetail1.setColor(HSSFColor.RED.index);
+
+        // title
+        HSSFCellStyle styleTitle = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleTitle.setWrapText(true);
+        // 设置单元格字体
+        styleTitle.setFont(fontTitle);
+        // 右边框
+        styleTitle.setBorderRight(HSSFCellStyle.BORDER_NONE);
+        // 左边框
+        styleTitle.setBorderLeft(HSSFCellStyle.BORDER_NONE);
+        // 上边框
+        styleTitle.setBorderTop(HSSFCellStyle.BORDER_NONE);
+        // 下边框
+        styleTitle.setBorderBottom(HSSFCellStyle.BORDER_NONE);
+
+        // title
+        HSSFCellStyle styleComp = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleComp.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleComp.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleComp.setWrapText(true);
+        // 设置单元格字体
+        styleComp.setFont(fontComp);
+        // 右边框
+        styleComp.setBorderRight(HSSFCellStyle.BORDER_NONE);
+        // 左边框
+        styleComp.setBorderLeft(HSSFCellStyle.BORDER_NONE);
+        // 上边框
+        styleComp.setBorderTop(HSSFCellStyle.BORDER_NONE);
+        // 下边框
+        styleComp.setBorderBottom(HSSFCellStyle.BORDER_NONE);
+
+        HSSFCellStyle styleInfo = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleInfo.setAlignment(HSSFCellStyle.ALIGN_LEFT);
+        // 指定单元格垂直居中对齐
+        styleInfo.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleInfo.setWrapText(true);
+        // 设置单元格字体
+        styleInfo.setFont(fontDetail);
+        // 右边框
+        styleInfo.setBorderRight(HSSFCellStyle.BORDER_NONE);
+        // 左边框
+        styleInfo.setBorderLeft(HSSFCellStyle.BORDER_NONE);
+        // 上边框
+        styleInfo.setBorderTop(HSSFCellStyle.BORDER_NONE);
+        // 下边框
+        styleInfo.setBorderBottom(HSSFCellStyle.BORDER_NONE);
+
+        HSSFCellStyle styleDetail = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetail.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetail.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetail.setWrapText(true);
+        // 设置单元格字体
+        styleDetail.setFont(fontDetail);
+        // 右边框
+        styleDetail.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetail.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetail.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetail.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle styleDetail1 = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetail1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetail1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetail1.setWrapText(true);
+        // 设置单元格字体
+        styleDetail1.setFont(fontDetail1);
+        // 右边框
+        styleDetail1.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetail1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetail1.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetail1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle contextstyle = wb.createCellStyle();
+        // 指定单元格居中对齐
+        contextstyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        contextstyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        contextstyle.setWrapText(true);
+        // 设置单元格字体
+        contextstyle.setFont(fontDetail);
+        // 右边框
+        contextstyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        contextstyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        contextstyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        contextstyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle contextstyle1 = wb.createCellStyle();
+        // 指定单元格居中对齐
+        contextstyle1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        contextstyle1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        contextstyle1.setWrapText(true);
+        // 设置单元格字体
+        contextstyle1.setFont(fontDetail1);
+        // 右边框
+        contextstyle1.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        contextstyle1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        contextstyle1.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        contextstyle1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle styleDetailYellow = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetailYellow.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetailYellow.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetailYellow.setWrapText(true);
+        // 设置单元格字体
+        styleDetailYellow.setFont(fontDetail);
+        // 右边框
+        styleDetailYellow.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetailYellow.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetailYellow.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetailYellow.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+        styleDetailYellow.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
+        styleDetailYellow.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+
+
+        HSSFCellStyle styleDetailLeft = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetailLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT);
+        // 指定单元格垂直居中对齐
+        styleDetailLeft.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetailLeft.setWrapText(true);
+        // 设置单元格字体
+        styleDetailLeft.setFont(fontDetail);
+        // 右边框
+        styleDetailLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetailLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetailLeft.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetailLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+        /**************** 数据行样式 end ****************/
+
+        // 设置列宽
+        sheet.setColumnWidth(0, 1 * 256 + 184);
+        sheet.setColumnWidth(1, "仓库名称".getBytes().length*3*256);
+        sheet.setColumnWidth(2, "日期".getBytes().length*2*256);
+        sheet.setColumnWidth(3, 12 * 256 + 184);
+        sheet.setColumnWidth(4, 12 * 256 + 184);
+        sheet.setColumnWidth(5, 1 * 256 + 184);
+
+        // 创建单元格对象
+        HSSFCell cell = null;
+
+        // 创建打印设置对象
+        HSSFPrintSetup ps = sheet.getPrintSetup();
+        // 打印方向,true:横向,false:纵向(默认)
+        ps.setLandscape(false);
+        // // 打印质量
+        // ps.setVResolution((short) 700)
+        // 设置缩放比例
+        ps.setScale((short) 80);
+        // 纸张类型
+        ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
+
+
+        int rownum = 1;
+        HSSFRow row0 = sheet.createRow((int) rownum);
+        row0.setHeightInPoints(25);
+        cell = row0.createCell(1);
+        cell.setCellStyle(styleTitle);
+        cell.setCellValue("费用分配信息");
+        sheet.addMergedRegion(new CellRangeAddress(rownum, rownum, (short) 1, (short) 4));
+        cell = row0.createCell(2);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(3);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(4);
+        cell.setCellStyle(styleTitle);
+        rownum++;
+
+
+        // 费用分配总数
+        List<ExpenseAllocationInfo> expenseAllocationInfos=expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+                .eq("info_id",expenseInfo.getId())
+                .ne("status","已通过"));
+
+        HSSFRow rowp = sheet.createRow((int)(rownum));
+        rowp.setHeightInPoints(20);
+        cell = rowp.createCell(1);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(2);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(3);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(4);
+        cell.setCellStyle(styleDetail);
+        rownum++;
+
+        HSSFRow row1 = sheet.createRow((int) rownum);
+        row1.setHeightInPoints(30);
+        cell = row1.createCell(1);
+        cell.setCellValue("仓库名称");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(2);
+        cell.setCellValue("日期");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(3);
+        cell.setCellValue("入库量(吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(4);
+        cell.setCellValue("分配金额(元)");
+        cell.setCellStyle(styleDetail);
+        rownum++;
+
+        // 详情信息
+        if (!CollectionUtils.isEmpty(expenseAllocationInfos)) {
+            for (int i = 0; i < expenseAllocationInfos.size(); i++) {
+                ExpenseAllocationInfo expenseAllocationInfo = expenseAllocationInfos.get(i);
+
+                HSSFRow rowx = sheet.createRow((int) rownum);
+                rowx.setHeightInPoints(20);
+                cell = rowx.createCell(1);
+                cell.setCellValue(editString(expenseAllocationInfo.getWarehouseName()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(2);
+                String date = addDateOneDay(expenseAllocationInfo.getReceiptDocDate());
+                cell.setCellValue(date);
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(3);
+                cell.setCellValue(editFloat(expenseAllocationInfo.getInWarehouseWeight()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(4);
+                cell.setCellValue(editDouble(expenseAllocationInfo.getDistributionMoney()));
+                cell.setCellStyle(styleDetail);
+                rownum++;
+            }
+
+        }
+
+
+        String path = null;
+        String tempPath = null;
+        String excelPath = null;
+
+        try {
+
+            // 取得绝对路径
+            tempPath = URLDecoder.decode((localPath), "utf-8");
+
+            // EXCEL路径
+            excelPath = "/web/temp/pay/" + DateUtil.formatDate(new Date(), DateUtils.DATE_FMT_YYYYMMDD_NS) + '/'
+                    + UUID.randomUUID().toString().replaceAll("-", "");
+
+            path = tempPath + excelPath + '/' + "费用分配信息"
+                    + ".xlsx";
+
+        } catch (Exception e) {
+            log.debug(e.getMessage());
+        }
+
+        return downloadPhone(path, response, wb);
+    }
+    private String addDateOneDay(Date date) {
+        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
+        return sdf.format(date);
+    }
+    /**
+     * 判断字符串
+     *
+     * @param example
+     * @return
+     */
+    private String editString(String example) {
+        String exampleOne = example != null ? example : "";
+        return exampleOne;
+    }
+    /**
+     * 判断浮点数
+     *
+     * @param example
+     * @return
+     */
+    private Float editFloat(Float example) {
+        Float exampleOne = example != null ? example : 0f;
+        return exampleOne;
+    }
+    /**
+     * 判断浮点数
+     *
+     * @param example
+     * @return
+     */
+    private Double editDouble(Double example) {
+        Double exampleOne = example != null ? example : 0d;
+        return exampleOne;
+    }
+
+    /**
+     * 下载
+     *
+     * @param path
+     * @param response
+     */
+    private String downloadPhone(String path, HttpServletResponse response, Workbook wb) {
+
+        try {
+            // 取得文件名。
+            String fileName = "excel";
+            // 给文件名编码
+            fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
+
+            response.setContentType("application/vnd.ms-excel");
+            response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+
+            // 定义byte输出流
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+            // 写导出文件
+            wb.write(out);
+
+            // 取得模板文件中的数据
+            byte[] result = out.toByteArray();
+
+            // 设置输出数据类型
+            response.setContentType("application/vnd.ms-excel");
+            // 设置输出数据长度
+            response.setContentLength(result.length);
+
+            // 设置文件名称
+            response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+            // 将文件流输出到画面
+//            response.getOutputStream().write(result);
+
+            out.flush();
+            out.close();
+            //生成的新文件路径
+            String outputFile = "templates" + File.separator + fileName + ".xlsx";
+            File file1 = new File(new String(outputFile.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
+            try (FileOutputStream fos = new FileOutputStream(file1)) {
+                wb.write(fos);
+            }
+
+            FileInputStream fileInputStream = new FileInputStream(file1.getAbsoluteFile());
+
+            MultipartFile multipartFile = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
+            String result1 = upload(multipartFile, fileName);
+            file1.delete();
+            return result1;
+        } catch (IOException ex) {
+            log.debug(ex.getMessage());
+        }
+        return "ng";
+    }
+    /**
+     * 后台通过服务器间接传文件
+     *
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public String upload(MultipartFile file, String name) throws IOException {
+        ObjectMetadata objectMetadata = new ObjectMetadata();
+        objectMetadata.setContentLength(file.getSize());
+        objectMetadata.setContentType(file.getContentType());
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, "pcfiles/" + name + ".xlsx", file.getInputStream(), objectMetadata);
+        ossClient.putObject(putObjectRequest);
+        return baseUrl + "pcfiles/" + name + ".xlsx";
+    }
+
+
     private List<String> getResourceIdList() {
         User currentUser = AuthSecurityUtils.getCurrentUserInfo();
         // 当前登录人主要角色

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

@@ -0,0 +1,20 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.FillingDetailInfo;
+import com.yh.saas.plugin.yiliangyiyun.mapper.FillingDetailInfoMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.IFillingDetailInfoService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 记录加油明细 服务实现类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+@Service
+public class FillingDetailInfoServiceImpl extends ServiceImpl<FillingDetailInfoMapper, FillingDetailInfo> implements IFillingDetailInfoService {
+
+}

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

@@ -0,0 +1,20 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo;
+import com.yh.saas.plugin.yiliangyiyun.mapper.FuelFillingInfoMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.IFuelFillingInfoService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 记录加油信息 服务实现类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2022-06-24
+ */
+@Service
+public class FuelFillingInfoServiceImpl extends ServiceImpl<FuelFillingInfoMapper, FuelFillingInfo> implements IFuelFillingInfoService {
+
+}

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

@@ -5547,4 +5547,18 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         return page;
     }
 
+    @Override
+    public WarehouseBaseInfo selectWarehouseChart(WarehouseBaseInfo warehouseBaseInfo) {
+        WarehouseBaseInfo warehouseBaseInfo1=new WarehouseBaseInfo();
+        Map<String, Object> pageView = new HashMap<>();
+        //  公司ID
+        pageView.put("compId", AuthSecurityUtils.getCurrentUserInfo().getCompId());
+        pageView.put("startDate", warehouseBaseInfo.getStartDate());
+        pageView.put("endDate", warehouseBaseInfo.getEndDate());
+        List<WarehouseBaseInfo> dataList = baseMapper.getWarehouseChartByCondition(pageView);
+        warehouseBaseInfo1.setChartList(dataList);
+
+        return warehouseBaseInfo1;
+    }
+
 }

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

@@ -1,12 +1,18 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.alipay.sofa.runtime.api.annotation.SofaService;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.ObjectMetadata;
+import com.aliyun.oss.model.PutObjectRequest;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.winsea.svc.base.base.util.DateUtils;
 import com.winsea.svc.base.workflow.entity.Workflow;
 import com.yh.saas.plugin.yiliangyiyun.entity.InOutWarehouseTask;
 import com.yh.saas.plugin.yiliangyiyun.entity.PaymentManagement;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseInOutInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehousingOrder;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.PaymentView;
 import com.yh.saas.plugin.yiliangyiyun.exception.YException;
 import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.WarehousingOrderMapper;
@@ -28,13 +34,31 @@ import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.service.*;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.httpclient.util.DateUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.http.entity.ContentType;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.math.RoundingMode;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.text.SimpleDateFormat;
@@ -50,6 +74,7 @@ import java.util.stream.Collectors;
  * @since 2022-05-17
  */
 @Service
+@Slf4j
 public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMapper, WarehousingOrder> implements IWarehousingOrderService {
     @Autowired
     private IInOutWarehouseTaskService inOutWarehouseTaskService;
@@ -63,6 +88,15 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
     private IPaymentManagementService paymentManagementService;
     @Autowired
     private IWarehouseBaseInfoService warehouseBaseInfoService;
+    @Value("${file-root-path}")
+    private String localPath;
+    @Autowired
+    private OSSClient ossClient;
+    @Value("${oss.endpoint.internal:}")
+    private String baseUrl;
+    @Getter
+    @Value("${oss.bucket.name:}")
+    private String bucket;
     @Autowired
     private IIdentityAuthenticationInfoService identityAuthenticationInfoService;
     @Autowired
@@ -106,10 +140,8 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     List<SourceRelationInfo> sourceRelationInfoList1 = sourceRelationInfoService.selectList(new EntityWrapper<SourceRelationInfo>()
                             .eq("task_id", inOutWarehouseTask.getId())
                             .eq("delete_flag", "0"));
-                    if (!CollectionUtils.isEmpty(sourceRelationInfoList)){
-                        for (SourceRelationInfo sourceRelationInfo1:sourceRelationInfoList1){
-                            goodsSource=goodsSource+","+sourceRelationInfo1.getGoodsSource();
-                        }
+                    if (!CollectionUtils.isEmpty(sourceRelationInfoList1)){
+                        sourceRelationInfo.setSourceRelationInfoList(sourceRelationInfoList1);
                     }
                 }
                 sourceRelationInfo.setGoodsSource(goodsSource);
@@ -160,7 +192,7 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 String taskId = "";
                 // 只有待审核状态才有taskId
                 if (StringUtils.isNotBlank(warehousingOrder1.getWorkflowId())) {
-                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(warehousingOrder1.getWorkflowId()), warehousingOrder1.getId());
+                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(warehousingOrder1.getWorkflowId()), warehousingOrder1.getBatchId());
                     taskId = jsonObject.getString("taskId");
                     warehousingOrder1.setTaskId(taskId);
                 }
@@ -226,7 +258,6 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 this.insert(warehousingOrder);
             }
         }
-        String compId = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId();
         //采购入库
         List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
                 .eq("status", "已提交")
@@ -354,17 +385,106 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
      * @return
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String editInfo(WarehousingOrder warehousingOrder) {
         // 插入操作历史
         String staffName = this.billOperateHisService.getStaffAndName();
         if ("0".equals(warehousingOrder.getFlag())) {
+            warehousingOrder.setInventoryStatus(StatusEnum.GRAIN_REVIEWED.getName());
+            warehousingOrder.setOperationFlag("盘盈");
             // 插入操作历史
             this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
-                    "盘盈" + "(" + warehousingOrder.getProfitAndLoss() + ")", null, "审核中");
+                    "盘盈" + "(" + warehousingOrder.getPlValue() + ")", null, "审核中");
+//            boolean isStartWorkflow = StringUtils.isBlank(warehousingOrder.getWorkflowId());
+//                // 不是退回的单子
+//                if (isStartWorkflow) {
+//                    Workflow workflow = workflowService
+//                            .findLatestWorkflowByBusinessCodeByApp(warehousingOrder.getCompId(), "WAREHOUSING-DEBIT-APPROVE");
+//                    // 没配置审核流程,直接结束并处理信息
+//                    if (workflow == null) {
+//                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+//                    }
+//                    // 开启审核流
+//                    else {
+//
+//                        // 设置状态 已提交审核
+//                        warehousingOrder.setWorkflowId(workflow.getId());
+//                        this.updateById(warehousingOrder);
+//                        workflowService.startInstance(workflow.getId(), warehousingOrder.getId());
+//                    }
+//                }
+//                // 退回的单子 再启用
+//                else {
+//
+//                    this.updateById(warehousingOrder);
+//                    workflowService.activateInstance(warehousingOrder.getWorkflowId(), warehousingOrder.getId());
+//                }
         }
         else if ("1".equals(warehousingOrder.getFlag())){
+            warehousingOrder.setInventoryStatus(StatusEnum.GRAIN_REVIEWED.getName());
+            warehousingOrder.setOperationFlag("盘亏");
             this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
-                    "盘亏" + "(" + warehousingOrder.getProfitAndLoss() + ")", null, "审核中");
+                    "盘亏" + "(" + warehousingOrder.getPlValue() + ")", null, "审核中");
+//            boolean isStartWorkflow = StringUtils.isBlank(warehousingOrder.getWorkflowId());
+//                // 不是退回的单子
+//                if (isStartWorkflow) {
+//                    Workflow workflow = workflowService
+//                            .findLatestWorkflowByBusinessCodeByApp(warehousingOrder.getCompId(), "WAREHOUSING-DEBIT-APPROVE");
+//                    // 没配置审核流程,直接结束并处理信息
+//                    if (workflow == null) {
+//                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+//                    }
+//                    // 开启审核流
+//                    else {
+//
+//                        // 设置状态 已提交审核
+//                        warehousingOrder.setWorkflowId(workflow.getId());
+//                        this.updateById(warehousingOrder);
+//                        workflowService.startInstance(workflow.getId(), warehousingOrder.getId());
+//                    }
+//                }
+//                // 退回的单子 再启用
+//                else {
+//
+//                    this.updateById(warehousingOrder);
+//                    workflowService.activateInstance(warehousingOrder.getWorkflowId(), warehousingOrder.getId());
+//                }
+        }
+        //盘盈通过
+        else if ("2".equals(warehousingOrder.getFlag())){
+            warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss()+warehousingOrder.getPlValue());
+            warehousingOrder.setPlValue(0f);
+            warehousingOrder.setOperationFlag("");
+            warehousingOrder.setInventoryStatus(StatusEnum.GRAIN_ADOPT.getName());
+            this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
+                    "盘盈" + "(" + warehousingOrder.getPlValue() + ")", null, "已通过");
+        }
+        //盘亏通过
+        else if ("3".equals(warehousingOrder.getFlag())){
+            warehousingOrder.setInventoryStatus(StatusEnum.GRAIN_ADOPT.getName());
+            warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss()+warehousingOrder.getPlValue());
+            warehousingOrder.setOperationFlag("");
+            warehousingOrder.setPlValue(0f);
+            warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss()+warehousingOrder.getPlValue());
+            this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
+                    "盘亏" + "(" + warehousingOrder.getPlValue() + ")", null, "已通过");
+        }
+        //盘盈驳回
+        else if ("4".equals(warehousingOrder.getFlag())){
+            warehousingOrder.setPlValue(0f);
+            warehousingOrder.setInventoryStatus(StatusEnum.GRAIN_REJECT.getName());
+            warehousingOrder.setOperationFlag("");
+            this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
+                    "盘盈" + "(" + warehousingOrder.getPlValue() + ")", null, "已驳回");
+        }
+        //盘亏驳回
+        else if ("5".equals(warehousingOrder.getFlag())){
+            warehousingOrder.setInventoryStatus(StatusEnum.GRAIN_REJECT.getName());
+            warehousingOrder.setOperationFlag("");
+            warehousingOrder.setPlValue(0f);
+            warehousingOrder.setProfitAndLoss(warehousingOrder.getProfitAndLoss()+warehousingOrder.getPlValue());
+            this.billOperateHisService.saveBillOperateHis(warehousingOrder.getId(), NumberConstant.INVENTORY_CHECK, staffName, null,
+                    "盘亏" + "(" + warehousingOrder.getPlValue() + ")", null, "已驳回 ");
         }
         // 主表信息编辑
         boolean one = this.updateById(warehousingOrder);
@@ -377,21 +497,24 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String payMoney(WarehousingOrder warehousingOrder) {
         List<WarehousingOrder> warehousingOrderList = warehousingOrder.getWarehousingOrderList();
         if (!CollectionUtils.isEmpty(warehousingOrderList)) {
             //付款多条
             if ("0".equals(warehousingOrder.getFlag())) {
                 for (WarehousingOrder warehousingOrder1 : warehousingOrderList) {
-                    warehousingOrder1.setAmountNotPayable(0d);
-                    warehousingOrder1.setAmountEdPayable(warehousingOrder1.getGrainFund());
+                    warehousingOrder1.setAmountNotPayable(warehousingOrder1.getAmountNotPayable()-warehousingOrder1.getRequestFunds());
+                    warehousingOrder1.setAmountEdPayable(warehousingOrder1.getAmountEdPayable()+warehousingOrder1.getRequestFunds());
+                    warehousingOrder1.setRequestFunds(0d);
                     this.updateById(warehousingOrder1);
                 }
             }
             //请款
             else {
-                String batchId = UUID.randomUUID().toString();
+                String batchId = IdGenerator.generateUUID();
                 String workflowId = "";
+
                 if(warehousingOrderList.size() > 0){
                     WarehousingOrder warehousingOrder1 = warehousingOrderList.get(0);
                     boolean isStartWorkflow = StringUtils.isBlank(warehousingOrder1.getWorkflowId());
@@ -406,30 +529,631 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                         // 开启审核流
                         else {
                             workflowId = workflow.getId();
+                            for (WarehousingOrder warehousingOrder2 : warehousingOrderList) {
+                                warehousingOrder2.setStatusFlag(StatusEnum.PENDING_PAYMENT.getFlag());
+                                warehousingOrder2.setStatus(StatusEnum.PENDING_PAYMENT.getName());
+                                warehousingOrder2.setWorkflowId(workflowId);
+                                warehousingOrder2.setBatchId(batchId);
+                                this.updateById(warehousingOrder2);
+                            }
                             // 设置状态 已提交审核
-                            warehousingOrder1.setWorkflowId(workflow.getId());
-                            this.updateById(warehousingOrder1);
                             workflowService.startInstance(workflow.getId(), batchId);
                         }
                     }
                     // 退回的单子 再启用
                     else {
-                        this.updateById(warehousingOrder1);
+                        batchId = warehousingOrder1.getBatchId();
+                        for (WarehousingOrder warehousingOrder2 : warehousingOrderList) {
+                            warehousingOrder2.setStatusFlag(StatusEnum.PENDING_PAYMENT.getFlag());
+                            warehousingOrder2.setStatus(StatusEnum.PENDING_PAYMENT.getName());
+                            warehousingOrder2.setWorkflowId(workflowId);
+                            warehousingOrder2.setBatchId(batchId);
+                            this.updateById(warehousingOrder2);
+                        }
                         workflowService.activateInstance(warehousingOrder1.getWorkflowId(), warehousingOrder1.getBatchId());
                     }
                 }
-
-                for (WarehousingOrder warehousingOrder1 : warehousingOrderList) {
-                    warehousingOrder1.setStatusFlag(StatusEnum.PENDING_PAYMENT.getFlag());
-                    warehousingOrder1.setStatus(StatusEnum.PENDING_PAYMENT.getName());
-                    warehousingOrder1.setWorkflowId(workflowId);
-                    this.updateById(warehousingOrder1);
-                }
             }
         }
         return "OK";
     }
 
+    @Override
+    public String exportPhone(WarehousingOrder warehousingOrder, HttpServletResponse response) throws Exception {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+
+        // 1.Excel的头部信息
+        String headerTitle = "";
+
+        // 2.创建一个webbook 对应一个Excel文件
+        HSSFWorkbook wb = new HSSFWorkbook();
+
+        // 3.在webbook中添加一个sheet,对应Excel文件中的sheet
+        HSSFSheet sheet;
+
+        sheet = wb.createSheet("入库单信息");
+        headerTitle = "入库单信息";
+
+        // 4.设置打印参数
+        sheet.setMargin(HSSFSheet.TopMargin, (short) 1);// 页边距(上)
+        sheet.setMargin(HSSFSheet.BottomMargin, (short) 1);// 页边距(下)
+        sheet.setMargin(HSSFSheet.LeftMargin, (short) 1);// 页边距(左)
+        sheet.setMargin(HSSFSheet.RightMargin, (short) 1);// 页边距(右)
+
+        // 不显示网格
+        sheet.setDisplayGridlines(false);
+        // 设置水平居中
+        sheet.setHorizontallyCenter(true);
+
+        /**************** 数据行样式 start ****************/
+        HSSFFont fontTitle = wb.createFont();
+        fontTitle.setFontName("宋体");
+        fontTitle.setFontHeightInPoints((short) 14);
+        // 设置字体加粗
+        fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+
+        HSSFFont fontComp = wb.createFont();
+        fontComp.setFontName("宋体");
+        fontComp.setFontHeightInPoints((short) 16);
+        // 设置字体加粗
+        fontComp.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+
+        HSSFFont fontDetail = wb.createFont();
+        fontDetail.setFontName("宋体");
+        fontDetail.setFontHeightInPoints((short) 12);
+
+        HSSFFont fontDetail1 = wb.createFont();
+        fontDetail1.setFontName("宋体");
+        fontDetail1.setFontHeightInPoints((short) 12);
+        fontDetail1.setColor(HSSFColor.RED.index);
+
+        // title
+        HSSFCellStyle styleTitle = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleTitle.setWrapText(true);
+        // 设置单元格字体
+        styleTitle.setFont(fontTitle);
+        // 右边框
+        styleTitle.setBorderRight(HSSFCellStyle.BORDER_NONE);
+        // 左边框
+        styleTitle.setBorderLeft(HSSFCellStyle.BORDER_NONE);
+        // 上边框
+        styleTitle.setBorderTop(HSSFCellStyle.BORDER_NONE);
+        // 下边框
+        styleTitle.setBorderBottom(HSSFCellStyle.BORDER_NONE);
+
+        // title
+        HSSFCellStyle styleComp = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleComp.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleComp.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleComp.setWrapText(true);
+        // 设置单元格字体
+        styleComp.setFont(fontComp);
+        // 右边框
+        styleComp.setBorderRight(HSSFCellStyle.BORDER_NONE);
+        // 左边框
+        styleComp.setBorderLeft(HSSFCellStyle.BORDER_NONE);
+        // 上边框
+        styleComp.setBorderTop(HSSFCellStyle.BORDER_NONE);
+        // 下边框
+        styleComp.setBorderBottom(HSSFCellStyle.BORDER_NONE);
+
+        HSSFCellStyle styleInfo = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleInfo.setAlignment(HSSFCellStyle.ALIGN_LEFT);
+        // 指定单元格垂直居中对齐
+        styleInfo.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleInfo.setWrapText(true);
+        // 设置单元格字体
+        styleInfo.setFont(fontDetail);
+        // 右边框
+        styleInfo.setBorderRight(HSSFCellStyle.BORDER_NONE);
+        // 左边框
+        styleInfo.setBorderLeft(HSSFCellStyle.BORDER_NONE);
+        // 上边框
+        styleInfo.setBorderTop(HSSFCellStyle.BORDER_NONE);
+        // 下边框
+        styleInfo.setBorderBottom(HSSFCellStyle.BORDER_NONE);
+
+        HSSFCellStyle styleDetail = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetail.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetail.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetail.setWrapText(true);
+        // 设置单元格字体
+        styleDetail.setFont(fontDetail);
+        // 右边框
+        styleDetail.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetail.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetail.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetail.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle styleDetail1 = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetail1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetail1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetail1.setWrapText(true);
+        // 设置单元格字体
+        styleDetail1.setFont(fontDetail1);
+        // 右边框
+        styleDetail1.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetail1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetail1.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetail1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle contextstyle = wb.createCellStyle();
+        // 指定单元格居中对齐
+        contextstyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        contextstyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        contextstyle.setWrapText(true);
+        // 设置单元格字体
+        contextstyle.setFont(fontDetail);
+        // 右边框
+        contextstyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        contextstyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        contextstyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        contextstyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle contextstyle1 = wb.createCellStyle();
+        // 指定单元格居中对齐
+        contextstyle1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        contextstyle1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        contextstyle1.setWrapText(true);
+        // 设置单元格字体
+        contextstyle1.setFont(fontDetail1);
+        // 右边框
+        contextstyle1.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        contextstyle1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        contextstyle1.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        contextstyle1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+
+        HSSFCellStyle styleDetailYellow = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetailYellow.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        // 指定单元格垂直居中对齐
+        styleDetailYellow.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetailYellow.setWrapText(true);
+        // 设置单元格字体
+        styleDetailYellow.setFont(fontDetail);
+        // 右边框
+        styleDetailYellow.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetailYellow.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetailYellow.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetailYellow.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+        styleDetailYellow.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
+        styleDetailYellow.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+
+
+        HSSFCellStyle styleDetailLeft = wb.createCellStyle();
+        // 指定单元格居中对齐
+        styleDetailLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT);
+        // 指定单元格垂直居中对齐
+        styleDetailLeft.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        // 指定单元格自动换行
+        styleDetailLeft.setWrapText(true);
+        // 设置单元格字体
+        styleDetailLeft.setFont(fontDetail);
+        // 右边框
+        styleDetailLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);
+        // 左边框
+        styleDetailLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+        // 上边框
+        styleDetailLeft.setBorderTop(HSSFCellStyle.BORDER_THIN);
+        // 下styleDetailTitle
+        styleDetailLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+        /**************** 数据行样式 end ****************/
+
+        // 设置列宽
+        sheet.setColumnWidth(0, 1 * 256 + 184);
+        sheet.setColumnWidth(1, "货源".getBytes().length*3*256);
+        sheet.setColumnWidth(2, "发货库".getBytes().length*25/10*256);
+        sheet.setColumnWidth(3, "货名".getBytes().length*3*256);
+        sheet.setColumnWidth(4, 12 * 256 + 184);
+        sheet.setColumnWidth(5, 12 * 256 + 184);
+        sheet.setColumnWidth(6, 12 * 256 + 184);
+        sheet.setColumnWidth(7, 12 * 256 + 184);
+        sheet.setColumnWidth(8, 12 * 256 + 184);
+        sheet.setColumnWidth(9, 12 * 256 + 184);
+        sheet.setColumnWidth(10, 12 * 256 + 184);
+        sheet.setColumnWidth(11, 12 * 256 + 184);
+        sheet.setColumnWidth(12, 12 * 256 + 184);
+        sheet.setColumnWidth(13, 12 * 256 + 184);
+        sheet.setColumnWidth(14, 1 * 256 + 184);
+
+        // 创建单元格对象
+        HSSFCell cell = null;
+
+        // 创建打印设置对象
+        HSSFPrintSetup ps = sheet.getPrintSetup();
+        // 打印方向,true:横向,false:纵向(默认)
+        ps.setLandscape(false);
+        // // 打印质量
+        // ps.setVResolution((short) 700)
+        // 设置缩放比例
+        ps.setScale((short) 80);
+        // 纸张类型
+        ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
+
+
+        int rownum = 1;
+        HSSFRow row0 = sheet.createRow((int) rownum);
+        row0.setHeightInPoints(25);
+        cell = row0.createCell(1);
+        cell.setCellStyle(styleTitle);
+        cell.setCellValue("入库单信息");
+        sheet.addMergedRegion(new CellRangeAddress(rownum, rownum, (short) 1, (short) 13));
+        cell = row0.createCell(2);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(3);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(4);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(5);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(6);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(7);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(8);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(9);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(10);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(11);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(12);
+        cell.setCellStyle(styleTitle);
+        cell = row0.createCell(13);
+        cell.setCellStyle(styleTitle);
+        rownum++;
+
+        List<String> businessKeys = null;
+        if ("1".equals(warehousingOrder.getSearchType())) {
+            businessKeys = workflowService.getTaskBusinessKeysByCode("WAREHOUSING-ORDER-APPROVE");
+        }
+
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("businessKeys", businessKeys);
+        pageView.put("batchId", warehousingOrder.getBatchId());
+        // 查询入库单总数
+        List<WarehousingOrder> dataList = baseMapper.getListByCondition(pageView);
+
+
+
+        Double requestFundsTotal = 0d;//请款合计
+        for (int i = 0; i < dataList.size(); i++) {
+            WarehousingOrder warehousingOrder1 = dataList.get(i);
+            //请款累计和
+            requestFundsTotal = requestFundsTotal + warehousingOrder1.getRequestFunds();
+        }
+
+        HSSFRow rowp = sheet.createRow((int)(rownum));
+        rowp.setHeightInPoints(20);
+        cell = rowp.createCell(1);
+        cell.setCellValue("合计");
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(2);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(3);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(4);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(5);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(6);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(7);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(8);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(9);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(10);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(11);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(12);
+        cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(13);
+        cell.setCellValue(requestFundsTotal);
+        cell.setCellStyle(styleDetail1);
+        rownum++;
+
+        HSSFRow row1 = sheet.createRow((int) rownum);
+        row1.setHeightInPoints(30);
+        cell = row1.createCell(1);
+        cell.setCellValue("货源");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(2);
+        cell.setCellValue("发货库");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(3);
+        cell.setCellValue("货名");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(4);
+        cell.setCellValue("入库重量(吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(5);
+        cell.setCellValue("出库重量(吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(6);
+        cell.setCellValue("盈亏(吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(7);
+        cell.setCellValue("剩余重量(吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(8);
+        cell.setCellValue("粮款(元)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(9);
+        cell.setCellValue("已付(元)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(10);
+        cell.setCellValue("未付(元)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(11);
+        cell.setCellValue("费用(元)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(12);
+        cell.setCellValue("平均成本(元/吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(13);
+        cell.setCellValue("请款(元)");
+        cell.setCellStyle(styleDetail);
+        rownum++;
+
+        // 详情信息
+        if (!CollectionUtils.isEmpty(dataList)) {
+            for (int i = 0; i < dataList.size(); i++) {
+                WarehousingOrder warehousingOrder1 = dataList.get(i);
+
+                HSSFRow rowx = sheet.createRow((int) rownum);
+                rowx.setHeightInPoints(20);
+                cell = rowx.createCell(1);
+                cell.setCellValue(editString(warehousingOrder1.getGoodsSource()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(2);
+                cell.setCellValue(editString(warehousingOrder1.getDeliveryWarehouse()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(3);
+                cell.setCellValue(editString(warehousingOrder1.getGoodsName()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(4);
+                cell.setCellValue(editFloat(warehousingOrder1.getInWarehouseWeight()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(5);
+                cell.setCellValue(editFloat(warehousingOrder1.getOutWarehouseWeight()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(6);
+                cell.setCellValue(editFloat(warehousingOrder1.getProfitAndLoss()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(7);
+                cell.setCellValue(editFloat(warehousingOrder1.getSurplusWeight()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(8);
+                cell.setCellValue(editDouble(warehousingOrder1.getGrainFund()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(9);
+                cell.setCellValue(editDouble(warehousingOrder1.getAmountEdPayable()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(10);
+                cell.setCellValue(editDouble(warehousingOrder1.getAmountNotPayable()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(11);
+                cell.setCellValue(editDouble(warehousingOrder1.getAmountMoney()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(12);
+                cell.setCellValue(editDouble(warehousingOrder1.getAvgCost()));
+                cell.setCellStyle(styleDetail);
+                cell = rowx.createCell(13);
+                cell.setCellValue(editDouble(warehousingOrder1.getRequestFunds()));
+                cell.setCellStyle(styleDetail);
+                rownum++;
+            }
+
+        }
+
+
+        String path = null;
+        String tempPath = null;
+        String excelPath = null;
+
+        try {
+
+            // 取得绝对路径
+            tempPath = URLDecoder.decode((localPath), "utf-8");
+
+            // EXCEL路径
+            excelPath = "/web/temp/pay/" + DateUtil.formatDate(new Date(), DateUtils.DATE_FMT_YYYYMMDD_NS) + '/'
+                    + UUID.randomUUID().toString().replaceAll("-", "");
+
+            path = tempPath + excelPath + '/' + "仓库信息"
+                    + ".xlsx";
+
+        } catch (Exception e) {
+            log.debug(e.getMessage());
+        }
+
+        return downloadPhone(path, response, wb);
+    }
+    /**
+     * 判断字符串
+     *
+     * @param example
+     * @return
+     */
+    private String editString(String example) {
+        String exampleOne = example != null ? example : "";
+        return exampleOne;
+    }
+    /**
+     * 判断浮点数
+     *
+     * @param example
+     * @return
+     */
+    private Float editFloat(Float example) {
+        Float exampleOne = example != null ? example : 0f;
+        return exampleOne;
+    }
+    /**
+     * 判断浮点数
+     *
+     * @param example
+     * @return
+     */
+    private Double editDouble(Double example) {
+        Double exampleOne = example != null ? example : 0d;
+        return exampleOne;
+    }
+
+    /**
+     * 下载
+     *
+     * @param path
+     * @param response
+     */
+    private String downloadPhone(String path, HttpServletResponse response, Workbook wb) {
+
+        try {
+            // 取得文件名。
+            String fileName = "excel";
+            // 给文件名编码
+            fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
+
+            response.setContentType("application/vnd.ms-excel");
+            response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+
+            // 定义byte输出流
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+            // 写导出文件
+            wb.write(out);
+
+            // 取得模板文件中的数据
+            byte[] result = out.toByteArray();
+
+            // 设置输出数据类型
+            response.setContentType("application/vnd.ms-excel");
+            // 设置输出数据长度
+            response.setContentLength(result.length);
+
+            // 设置文件名称
+            response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+            // 将文件流输出到画面
+//            response.getOutputStream().write(result);
+
+            out.flush();
+            out.close();
+            //生成的新文件路径
+            String outputFile = "templates" + File.separator + fileName + ".xlsx";
+            File file1 = new File(new String(outputFile.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
+            try (FileOutputStream fos = new FileOutputStream(file1)) {
+                wb.write(fos);
+            }
+
+            FileInputStream fileInputStream = new FileInputStream(file1.getAbsoluteFile());
+
+            MultipartFile multipartFile = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
+            String result1 = upload(multipartFile, fileName);
+            file1.delete();
+            return result1;
+        } catch (IOException ex) {
+            log.debug(ex.getMessage());
+        }
+        return "ng";
+    }
+    /**
+     * 后台通过服务器间接传文件
+     *
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public String upload(MultipartFile file, String name) throws IOException {
+        ObjectMetadata objectMetadata = new ObjectMetadata();
+        objectMetadata.setContentLength(file.getSize());
+        objectMetadata.setContentType(file.getContentType());
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, "pcfiles/" + name + ".xlsx", file.getInputStream(), objectMetadata);
+        ossClient.putObject(putObjectRequest);
+        return baseUrl + "pcfiles/" + name + ".xlsx";
+    }
+
+    @Override
+    public WarehousingOrder exportPhoneData(WarehousingOrder warehousingOrder) {
+        List<String> businessKeys = null;
+        if ("1".equals(warehousingOrder.getSearchType())) {
+            businessKeys = workflowService.getTaskBusinessKeysByCode("WAREHOUSING-ORDER-APPROVE");
+        }
+
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("businessKeys", businessKeys);
+        pageView.put("batchId", warehousingOrder.getBatchId());
+        // 查询入库单总数
+        List<WarehousingOrder> dataList = baseMapper.getListByCondition(pageView);
+
+        Double requestFundsTotal = 0d;//请款合计
+        Float inWarehouseWeightTotal = 0f;//重量合计
+        for (int i = 0; i < dataList.size(); i++) {
+            WarehousingOrder warehousingOrder1 = dataList.get(i);
+            //请款累计和
+            requestFundsTotal = requestFundsTotal + warehousingOrder1.getRequestFunds();
+            inWarehouseWeightTotal=inWarehouseWeightTotal+warehousingOrder1.getInWarehouseWeight();
+        }
+
+        // 返回数据
+        WarehousingOrder warehousingOrder1=new WarehousingOrder();
+        warehousingOrder1.setRequestFundsTotal(requestFundsTotal);
+        warehousingOrder1.setCount(dataList.size());
+        warehousingOrder1.setInWarehouseWeightTotal(inWarehouseWeightTotal);
+        if (dataList.size()>0) {
+            warehousingOrder1.setWarehouseName(dataList.get(0).getWarehouseName());
+            warehousingOrder1.setIssuingTime(dataList.get(0).getIssuingTime());
+            String taskId = "";
+            // 只有待审核状态才有taskId
+            if (StringUtils.isNotBlank(dataList.get(0).getWorkflowId())) {
+                JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(dataList.get(0).getWorkflowId()), dataList.get(0).getBatchId());
+                taskId = jsonObject.getString("taskId");
+                warehousingOrder1.setTaskId(taskId);
+            }
+        }
+        return warehousingOrder1;
+    }
+
     private List<String> getResourceIdList() {
         User currentUser = AuthSecurityUtils.getCurrentUserInfo();
         // 当前登录人主要角色

+ 29 - 19
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/WarehousingOrderListener.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.workflow;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.yh.saas.common.support.workflow.AbstractWorkflowTaskListener;
 import com.yh.saas.common.support.workflow.annotation.WorkflowTaskListener;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
@@ -8,6 +9,8 @@ import com.yh.saas.plugin.yiliangyiyun.service.IContractManagementInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IWarehousingOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 @WorkflowTaskListener(name = "仓库管理", group = "入库单")
 public class WarehousingOrderListener extends AbstractWorkflowTaskListener {
 
@@ -18,31 +21,38 @@ public class WarehousingOrderListener extends AbstractWorkflowTaskListener {
 
     @Override
     public void handleStatusChanged(String businessKey, String status, String statusEn, boolean processIsEnd) {
-        WarehousingOrder warehousingOrder = warehousingOrderService.selectById(businessKey);
-        if (warehousingOrder == null) {
-            return;
-        }
-        if (processIsEnd) {
-            warehousingOrder.setStatusFlag(StatusEnum.NOT_COLLECTION_PAY.getFlag());
-            warehousingOrder.setStatus(StatusEnum.NOT_COLLECTION_PAY.getName());
-            warehousingOrder.setWorkflowId(null);
-            warehousingOrder.setApproveStatus(null);
-        } else {
-            warehousingOrder.setApproveStatus(status);
+        List<WarehousingOrder> list = warehousingOrderService.selectList(new EntityWrapper<WarehousingOrder>().eq("batch_id",businessKey));
+        for(WarehousingOrder warehousingOrder : list){
+            if (warehousingOrder == null) {
+                return;
+            }
+            if (processIsEnd) {
+                warehousingOrder.setStatusFlag(StatusEnum.NOT_COLLECTION_PAY.getFlag());
+                warehousingOrder.setStatus(StatusEnum.NOT_COLLECTION_PAY.getName());
+                warehousingOrder.setWorkflowId(null);
+                warehousingOrder.setApproveStatus(null);
+            } else {
+                warehousingOrder.setApproveStatus(status);
+            }
+            warehousingOrderService.updateAllColumnById(warehousingOrder);
         }
-        warehousingOrderService.updateAllColumnById(warehousingOrder);
+
     }
 
     @Override
     public void handleRejectApplicationRepulsed(String workflowId, String businessKey, boolean needReapply) {
-        WarehousingOrder warehousingOrder = warehousingOrderService.selectById(businessKey);
-        if (warehousingOrder == null) {
-            return;
+        List<WarehousingOrder> list = warehousingOrderService.selectList(new EntityWrapper<WarehousingOrder>().eq("batch_id",businessKey));
+        for(WarehousingOrder warehousingOrder : list){
+            warehousingOrder = warehousingOrderService.selectById(businessKey);
+            if (warehousingOrder == null) {
+                return;
+            }
+            warehousingOrder.setStatusFlag(StatusEnum.TASK_RETURN.getFlag());
+            warehousingOrder.setStatus(StatusEnum.TASK_RETURN.getName());
+            warehousingOrder.setApproveStatus(null);
+            warehousingOrderService.updateAllColumnById(warehousingOrder);
         }
-        warehousingOrder.setStatusFlag(StatusEnum.TASK_RETURN.getFlag());
-        warehousingOrder.setStatus(StatusEnum.TASK_RETURN.getName());
-        warehousingOrder.setApproveStatus(null);
-        warehousingOrderService.updateAllColumnById(warehousingOrder);
+
 
     }
 

+ 27 - 33
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ContractExpensesInfoMapper.xml

@@ -10,23 +10,20 @@
         WHERE
         ce.comp_id = #{compId}
         AND ce.delete_flag = '0'
-        <if test="costType = '1'">
-            <if test="contractNo != null and contractNo != ''">
-                AND ce.contract_no = #{contractNo}
-            </if>
+        AND ce.cost_type = #{costType}
+        <if test="contractNo != null and contractNo != ''">
+            AND ce.contract_no = #{contractNo}
         </if>
-        <if test="costType = '3'">
-            <if test="warehouseName != null and warehouseName != ''">
-                AND ce.warehouse_name = #{warehouseName}
-            </if>
-            <if test="startDate != null">
-                AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &gt;=
-                DATE_FORMAT(#{startDate},"%Y%m%d"))
-            </if>
-            <if test="endDate != null">
-                AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &lt;=
-                DATE_FORMAT(#{endDate},"%Y%m%d"))
-            </if>
+        <if test="warehouseName != null and warehouseName != ''">
+            AND ce.warehouse_name = #{warehouseName}
+        </if>
+        <if test="startDate != null">
+            AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &gt;=
+            DATE_FORMAT(#{startDate},"%Y%m%d"))
+        </if>
+        <if test="endDate != null">
+            AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>
     </select>
     <!--合同费用列表查询-->
@@ -37,7 +34,7 @@
         ce.comp_id as compId,
         ce.contract_id as contractId,
         ce.contract_no as contractNo,
-        ce.warehouseName,
+        ce.warehouse_name as warehouseName,
         ce.warehouse_id as warehouseId,
         ce.expenses_type as expensesType,
         ce.expenses_name as expensesName,
@@ -58,23 +55,20 @@
         WHERE
         ce.comp_id = #{compId}
         AND ce.delete_flag = '0'
-        <if test="costType = '1'">
-            <if test="contractNo != null and contractNo != ''">
-                AND ce.contract_no = #{contractNo}
-            </if>
+        AND ce.cost_type = #{costType}
+        <if test="contractNo != null and contractNo != ''">
+            AND ce.contract_no = #{contractNo}
+        </if>
+        <if test="warehouseName != null and warehouseName != ''">
+            AND ce.warehouse_name = #{warehouseName}
+        </if>
+        <if test="startDate != null">
+            AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &gt;=
+            DATE_FORMAT(#{startDate},"%Y%m%d"))
         </if>
-        <if test="costType = '3'">
-            <if test="warehouseName != null and warehouseName != ''">
-                AND ce.warehouse_name = #{warehouseName}
-            </if>
-            <if test="startDate != null">
-                AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &gt;=
-                DATE_FORMAT(#{startDate},"%Y%m%d"))
-            </if>
-            <if test="endDate != null">
-                AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &lt;=
-                DATE_FORMAT(#{endDate},"%Y%m%d"))
-            </if>
+        <if test="endDate != null">
+            AND (DATE_FORMAT(ce.pay_deadline,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}

+ 341 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ContractManagementInfoMapper.xml

@@ -380,4 +380,345 @@
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+    <!--合同利润图查询-->
+    <select id="getContractChartByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo">
+        SELECT
+        '采购' AS type,
+        SUM( IFNULL( sri.proportion, 1 ) * IFNULL( ssrr.amount_ing_receivable, 0 ) ) + SUM( exi.amount_money )- SUM( exi2.amount_money ) AS contractProfit
+        FROM
+        contract_management_info cmi
+        LEFT JOIN expense_info exi ON exi.contract_id = cmi.id
+        AND exi.expenses_type = '1'
+        AND exi.expenses_purpose = '1'
+        AND exi.delete_flag = '0'
+        LEFT JOIN expense_info exi2 ON exi2.contract_id = cmi.id
+        AND exi2.expenses_type = '2'
+        AND exi2.expenses_purpose = '1'
+        AND exi2.delete_flag = '0'
+        LEFT JOIN warehousing_order war ON war.contract_no = cmi.contract_no
+        AND war.comp_id = cmi.comp_id
+        AND war.delete_flag = '0'
+        LEFT JOIN source_relation_info sri ON sri.source_id = war.id
+        AND sri.delete_flag = '0'
+        LEFT JOIN in_out_warehouse_task iowt ON iowt.id = sri.task_id
+        AND iowt.in_out_flag = 1
+        AND iowt.in_out_type_key = 1
+        AND iowt.delete_flag = '0'
+        LEFT JOIN warehouse_in_out_info wioi ON wioi.in_out_task_no = iowt.in_out_task_no
+        and wioi.car_no = sri.car_no
+        AND wioi.delete_flag = 0
+        AND wioi.status_flag = 3
+        LEFT JOIN stock_sale_receipt_report ssrr ON ssrr.contract_no = iowt.contract_no
+        AND ssrr.warehouse_record_id = wioi.id
+        and ssrr.delete_flag = 0
+        WHERE
+        cmi.comp_id =  #{compId}
+        AND cmi.delete_flag = '0'
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &lt;=
+        DATE_FORMAT(#{endDate},"%Y%m%d"))
+        AND cmi.contract_type = '2'
+        UNION ALL
+        SELECT
+        '销售' AS type,
+        SUM( exi.amount_money )- SUM(ssrr.settlement_weight* wo.avg_cost)- SUM( exi2.unallocated_amount ) AS contractProfit
+        FROM
+        contract_management_info cmi
+        LEFT JOIN expense_info exi ON exi.contract_id = cmi.id
+        AND exi.expenses_type = '1'
+        AND exi.expenses_purpose = '1'
+        AND exi.delete_flag = '0'
+        LEFT JOIN expense_info exi2 ON exi2.contract_id = cmi.id
+        AND exi2.expenses_type = '2'
+        AND exi2.expenses_purpose = '1'
+        AND exi2.delete_flag = '0'
+        LEFT JOIN stock_sale_receipt_report ssrr ON ssrr.contract_no = cmi.contract_no
+        and ssrr.delete_flag = 0
+        LEFT JOIN warehouse_in_out_info wioi ON wioi.id = ssrr.warehouse_record_id
+        AND wioi.delete_flag = '0'
+        LEFT JOIN in_out_warehouse_task iowt ON iowt.in_out_task_no=wioi.in_out_task_no and iowt.delete_flag='0'
+        LEFT JOIN source_relation_info sri on sri.task_id=iowt.id and sri.delete_flag='0'
+        LEFT JOIN warehousing_order wo on wo.id=sri.source_id and wo.delete_flag='0'
+        WHERE
+        cmi.comp_id =  #{compId}
+        AND cmi.delete_flag = '0'
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &lt;=
+        DATE_FORMAT(#{endDate},"%Y%m%d"))
+        AND cmi.contract_type = '1'
+        AND cmi.agreement_no != '代储合同'
+        UNION ALL
+        SELECT
+        '代收' AS type,
+        SUM( exi.amount_money )- SUM( exi2.unallocated_amount ) AS contractProfit
+        FROM
+        contract_management_info cmi
+        LEFT JOIN expense_info exi ON exi.contract_id = cmi.id
+        AND exi.expenses_type = '1'
+        AND exi.expenses_purpose = '1'
+        AND exi.delete_flag = '0'
+        LEFT JOIN expense_info exi2 ON exi2.contract_id = cmi.id
+        AND exi2.expenses_type = '2'
+        AND exi2.expenses_purpose = '1'
+        AND exi2.delete_flag = '0'
+        WHERE
+        cmi.comp_id =  #{compId}
+        AND cmi.delete_flag = '0'
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &lt;=
+        DATE_FORMAT(#{endDate},"%Y%m%d"))
+        AND cmi.contract_type = '3'
+        UNION ALL
+        SELECT
+        '代储' AS type,
+        SUM( exi.amount_money )- SUM( exi2.unallocated_amount ) AS contractProfit
+        FROM
+        contract_management_info cmi
+        LEFT JOIN expense_info exi ON exi.contract_id = cmi.id
+        AND exi.expenses_type = '1'
+        AND exi.expenses_purpose = '1'
+        AND exi.delete_flag = '0'
+        LEFT JOIN expense_info exi2 ON exi2.contract_id = cmi.id
+        AND exi2.expenses_type = '2'
+        AND exi2.expenses_purpose = '1'
+        AND exi2.delete_flag = '0'
+        WHERE
+        cmi.comp_id =  #{compId}
+        AND cmi.delete_flag = '0'
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+        AND (DATE_FORMAT(cmi.create_date,"%Y%m%d") &lt;=
+        DATE_FORMAT(#{endDate},"%Y%m%d"))
+        AND cmi.contract_type = '1'
+        AND cmi.agreement_no = '代储合同'
+    </select>
+    <!--合同利润表查询-->
+    <select id="getContractFormByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo">
+        SELECT
+            '采购重量' AS type,
+            SUM( wioi.net_weight )+ IFNULL( SUM( wioi4.net_weight ), 0 )+ IFNULL( SUM( wioi2.net_weight ), 0 )- IFNULL( SUM( wioi3.net_weight ), 0 ) AS profit
+        FROM
+            warehouse_base_info wbi
+                LEFT JOIN warehouse_in_out_info wioi ON wioi.base_id = wbi.id
+                AND wbi.warehouse_type = '1'
+                AND (DATE_FORMAT(wioi.in_out_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(wioi.in_out_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                AND wioi.status_flag = '3'
+                AND ( wioi.in_out_type = '采购入库' OR wioi.in_out_type = '收购入库' )
+                AND wioi.delete_flag = '0'
+                LEFT JOIN warehouse_in_out_info wioi2 ON wioi2.base_id = wbi.id
+                AND wbi.warehouse_type = '2'
+                AND wbi.create_type = '1'
+                AND (DATE_FORMAT(wioi2.in_out_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(wioi2.in_out_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                AND wioi2.status_flag = '3'
+                AND wioi2.in_out_type = '销售出库'
+                AND wioi2.delete_flag = '0'
+                LEFT JOIN warehouse_in_out_info wioi3 ON wioi3.base_id = wbi.id
+                AND wbi.warehouse_type = '2'
+                AND wbi.create_type = '1'
+                AND (DATE_FORMAT(wioi3.in_out_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(wioi3.in_out_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                AND wioi3.status_flag = '3'
+                AND wioi3.in_out_type = '退库'
+                AND wioi3.delete_flag = '0'
+                LEFT JOIN warehouse_in_out_info wioi4 ON wioi4.base_id = wbi.id
+                AND wbi.warehouse_type = '2'
+                AND wbi.create_type = '1'
+                AND (DATE_FORMAT(wioi4.in_out_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(wioi4.in_out_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                AND wioi4.status_flag = '3'
+                AND wioi4.in_out_type = '移库入库'
+                AND wioi4.delete_flag = '0'
+        WHERE
+            wbi.comp_id =  #{compId}
+          AND wbi.delete_flag = '0' UNION ALL
+        SELECT
+            '销售重量' AS type,
+            SUM( wioi1.net_weight )- IFNULL( SUM( wioi2.net_weight ), 0 ) AS profit
+        FROM
+            warehouse_base_info wbi
+                LEFT JOIN warehouse_in_out_info wioi1 ON wioi1.base_id = wbi.id
+                AND wioi1.in_out_type = '销售出库'
+                AND wioi1.delete_flag = '0'
+                AND (DATE_FORMAT(wioi1.in_out_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(wioi1.in_out_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                AND wioi1.status_flag = '3'
+                LEFT JOIN warehouse_in_out_info wioi2 ON wioi2.base_id = wbi.id
+                AND wbi.warehouse_type = '1'
+                AND (DATE_FORMAT(wioi2.in_out_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(wioi2.in_out_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                AND wioi2.status_flag = '3'
+                AND wioi2.in_out_type = '退库'
+                AND wioi2.delete_flag = '0'
+        WHERE
+            wbi.comp_id =  #{compId}
+          AND wbi.delete_flag = '0' UNION ALL
+        SELECT
+            '支付粮款' AS type,
+            IFNULL( sum( ei1.amount_money ), 0 ) - IFNULL( sum( ei2.amount_money ), 0 )+ IFNULL( sum( ei3.amount_money ), 0 ) - IFNULL( sum( ei4.amount_money ), 0 ) AS profit
+        FROM
+            contract_management_info cmi
+                LEFT JOIN expense_info ei1 ON ei1.contract_id = cmi.id
+                AND ei1.delete_flag = 0
+                AND ei1.cost_type = '1'
+                AND ei1.expenses_type = '2'
+                AND (DATE_FORMAT(ei1.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei1.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                LEFT JOIN expense_info ei2 ON ei2.contract_id = cmi.id
+                AND ei2.delete_flag = 0
+                AND ei2.cost_type = '1'
+                AND ei2.expenses_type = '1'
+                AND (DATE_FORMAT(ei2.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei2.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                LEFT JOIN expense_info ei3 ON ei3.contract_id = cmi.id
+                AND ei3.delete_flag = 0
+                AND ei3.cost_type = '5'
+                AND ei3.expenses_type = '1'
+                AND (DATE_FORMAT(ei3.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei3.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                LEFT JOIN expense_info ei4 ON ei4.contract_id = cmi.id
+                AND ei4.delete_flag = 0
+                AND ei4.cost_type = '5'
+                AND ei4.expenses_type = '1'
+                AND (DATE_FORMAT(ei4.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei4.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+        WHERE
+            cmi.delete_flag = 0
+          AND cmi.contract_type = '2'
+          AND cmi.comp_id =  #{compId} UNION ALL
+        SELECT
+            '收入粮款' AS type,
+            IFNULL( sum( ei1.amount_money ), 0 ) - IFNULL( sum( ei2.amount_money ), 0 )+ IFNULL( sum( ei3.amount_money ), 0 ) - IFNULL( sum( ei4.amount_money ), 0 ) AS profit
+        FROM
+            contract_management_info cmi
+                LEFT JOIN expense_info ei1 ON ei1.contract_id = cmi.id
+                AND ei1.delete_flag = 0
+                AND ei1.cost_type = '1'
+                AND ei1.expenses_type = '1'
+                AND (DATE_FORMAT(ei1.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei1.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                LEFT JOIN expense_info ei2 ON ei2.contract_id = cmi.id
+                AND ei2.delete_flag = 0
+                AND ei2.cost_type = '1'
+                AND ei2.expenses_type = '2'
+                AND (DATE_FORMAT(ei2.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei2.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                LEFT JOIN expense_info ei3 ON ei3.contract_id = cmi.id
+                AND ei3.delete_flag = 0
+                AND ei3.cost_type = '5'
+                AND ei3.expenses_type = '1'
+                AND (DATE_FORMAT(ei3.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei3.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+                LEFT JOIN expense_info ei4 ON ei4.contract_id = cmi.id
+                AND ei4.delete_flag = 0
+                AND ei4.cost_type = '5'
+                AND ei4.expenses_type = '1'
+                AND (DATE_FORMAT(ei4.create_date,"%Y%m%d") &gt;=
+                     DATE_FORMAT(#{startDate},"%Y%m%d"))
+                AND (DATE_FORMAT(ei4.create_date,"%Y%m%d") &lt;=
+                     DATE_FORMAT(#{endDate},"%Y%m%d"))
+        WHERE
+            cmi.delete_flag = 0
+          AND cmi.contract_type = '1'
+          AND cmi.comp_id =  #{compId} UNION ALL
+        SELECT
+            '其他支出' AS type,
+            SUM( ei.amount_money ) AS profit
+        FROM
+            expense_info ei
+        WHERE
+            ei.delete_flag = 0
+          AND ei.cost_type != '1'
+        AND ei.expenses_type = '2'
+        AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+          AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
+          AND ei.comp_id =  #{compId} UNION ALL
+        SELECT
+            '其他收入' AS type,
+            IFNULL( SUM( ei.amount_money ), 0 ) AS profit
+        FROM
+            expense_info ei
+        WHERE
+            ei.delete_flag = 0
+          AND ei.cost_type != '1'
+        AND ei.expenses_type = '1'
+        AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+          AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
+          AND ei.comp_id =  #{compId} UNION ALL
+        SELECT
+            '运费' AS type,
+            SUM( ei1.amount_money )- SUM( ei2.amount_money ) AS profit
+        FROM
+            expense_info ei
+                LEFT JOIN expense_info ei1 ON ei1.id = ei.id
+                AND ei1.delete_flag = 0
+                AND ei1.expenses_type = '1'
+                LEFT JOIN expense_info ei2 ON ei2.id = ei.id
+                AND ei2.delete_flag = 0
+                AND ei2.expenses_type = '2'
+        WHERE
+            ei.delete_flag = 0
+          AND ei.comp_id =  #{compId}
+          AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &gt;=
+               DATE_FORMAT(#{startDate},"%Y%m%d"))
+          AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &lt;=
+               DATE_FORMAT(#{endDate},"%Y%m%d"))
+          AND ei.cost_type = '1'
+        UNION ALL
+        SELECT
+            '总利润' AS type,
+            SUM( ei1.amount_money )- SUM( ei2.amount_money ) AS profit
+        FROM
+            expense_info ei
+                LEFT JOIN expense_info ei1 ON ei1.id = ei.id
+                AND ei1.delete_flag = 0
+                AND ei1.expenses_type = '1'
+                LEFT JOIN expense_info ei2 ON ei2.id = ei.id
+                AND ei2.delete_flag = 0
+                AND ei2.expenses_type = '2'
+        WHERE
+            ei.delete_flag = 0
+          AND ei.comp_id =  #{compId}
+          AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &gt;=
+               DATE_FORMAT(#{startDate},"%Y%m%d"))
+          AND (DATE_FORMAT(ei.create_date,"%Y%m%d") &lt;=
+               DATE_FORMAT(#{endDate},"%Y%m%d"))
+          AND ei.cost_type = '1'
+    </select>
 </mapper>

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

@@ -16,6 +16,13 @@
                 AND expenses_type = '2'
             </if>
         </if>
+        <if test="businessKeys != null and businessKeys.size > 0">
+            and(
+            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
+                a.id = #{businessValue}
+            </foreach>
+            )
+        </if>
         <if test="startDate != null">
             AND (DATE_FORMAT(create_date,"%Y%m%d") &gt;=
             DATE_FORMAT(#{startDate},"%Y%m%d"))
@@ -42,8 +49,10 @@
         unallocated_amount as unallocatedAmount,
         address_url as addressUrl,
         agent,
+        status,
         distribution_status as distributionStatus,
         approve_status as approveStatus,
+        workflow_id as workflowId,
         create_date as createDate
         FROM expense_info
         WHERE
@@ -56,6 +65,13 @@
                 AND expenses_type = '2'
             </if>
         </if>
+        <if test="businessKeys != null and businessKeys.size > 0">
+            and(
+            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
+                a.id = #{businessValue}
+            </foreach>
+            )
+        </if>
         <if test="searchKeyWord != null and searchKeyWord != ''">
             AND (lower(expense_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
         </if>

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/FillingDetailInfoMapper.xml

@@ -0,0 +1,5 @@
+<?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.FillingDetailInfoMapper">
+
+</mapper>

+ 1 - 1
src/main/resources/mapper/LeaveInfoMapper.xml → winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/FuelFillingInfoMapper.xml

@@ -1,5 +1,5 @@
 <?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.LeaveInfoMapper">
+<mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.FuelFillingInfoMapper">
 
 </mapper>

+ 45 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehouseBaseInfoMapper.xml

@@ -677,8 +677,8 @@
         SELECT
         COUNT(w.id)
         FROM warehouse_base_info w
-        LEFT JOIN contract_expenses_info c on w.id = c.base_id
-        LEFT JOIN cost_management_info cm on w.id = cm.base_id
+        LEFT JOIN contract_expenses_info c on w.id = c.warehouse_id
+        LEFT JOIN cost_management_info cm on w.id = cm.warehouse_id
         WHERE
         w.comp_id = #{compId}
         <if test="startDate != null">
@@ -703,8 +703,8 @@
         c.pay_deadline as payDeadline,
         cm.cost
         FROM warehouse_base_info w
-        LEFT JOIN contract_expenses_info c on w.id = c.base_id
-        LEFT JOIN cost_management_info cm on w.id = cm.base_id
+        LEFT JOIN contract_expenses_info c on w.id = c.warehouse_id
+        LEFT JOIN cost_management_info cm on w.id = cm.warehouse_id
         WHERE
         w.comp_id = #{compId}
         <if test="startDate != null">
@@ -722,4 +722,45 @@
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+    <!-- 库点利润图 -->
+    <select id="getWarehouseChartByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.WarehouseBaseInfo">
+        SELECT
+        wioi.goods_name AS goodsName,
+        SUM( IFNULL( sri.proportion, 1 ) * IFNULL( ssrr.amount_ing_receivable, 0 ) ) -sum( pm.amount_ing_payable ) AS profit
+        FROM
+        warehouse_in_out_info wioi
+        LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
+        AND wbi.delete_flag = 0
+        LEFT JOIN quality_inspection_management qim ON qim.warehouse_in_out_id = wioi.id
+        AND qim.delete_flag = 0
+        LEFT JOIN payment_management pm ON pm.relation_id = qim.relation_id
+        AND pm.delete_flag = 0
+        LEFT JOIN warehousing_order war ON war.warehouse_in_out_id = wioi.id
+        AND war.comp_id = wbi.comp_id
+        AND war.delete_flag = '0'
+        LEFT JOIN source_relation_info sri ON sri.source_id = war.id
+        AND sri.delete_flag = '0'
+        LEFT JOIN in_out_warehouse_task iowt ON iowt.id = sri.task_id
+        AND iowt.in_out_flag = 1
+        AND iowt.in_out_type_key = 1
+        AND iowt.delete_flag = '0'
+        LEFT JOIN warehouse_in_out_info wioi1 ON wioi1.in_out_task_no = iowt.in_out_task_no
+        AND wioi1.car_no = sri.car_no
+        AND wioi1.delete_flag = 0
+        AND wioi1.status_flag = 3
+        LEFT JOIN stock_sale_receipt_report ssrr ON ssrr.contract_no = iowt.contract_no
+        AND ssrr.warehouse_record_id = wioi1.id
+        AND ssrr.delete_flag = 0
+        WHERE
+        wioi.in_out_type = '收购入库'
+        AND wioi.status_flag = '3'
+        AND wbi.comp_id= #{compId}
+        AND (DATE_FORMAT(wioi.in_out_date,"%Y%m%d") &gt;=
+        DATE_FORMAT(#{startDate},"%Y%m%d"))
+        AND (DATE_FORMAT(wioi.in_out_date,"%Y%m%d") &lt;=
+        DATE_FORMAT(#{endDate},"%Y%m%d"))
+        GROUP BY
+        wioi.goods_name;
+    </select>
 </mapper>

+ 13 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehousingOrderMapper.xml

@@ -32,6 +32,9 @@
                 AND profit_and_loss &lt; 0
             </if>
         </if>
+        <if test="batchId != null and batchId != ''">
+            AND batch_id= #{batchId}
+        </if>
         <if test="searchKeyWord != null and searchKeyWord != ''">
             AND (lower(goods_source) like lower(CONCAT('%',#{searchKeyWord},'%')))
         </if>
@@ -42,14 +45,18 @@
         SELECT
         id,
         comp_id as compId,
+        batch_id as batchId,
         car_no as carNo,
         goods_source as goodsSource,
         warehouse_name as warehouseName,
         contract_no as contractNo,
+        inventory_status as inventoryStatus,
         goods_name as goodsName,
+        address_url as addressUrl,
         in_warehouse_weight as inWarehouseWeight,
         out_warehouse_weight as outWarehouseWeight,
         profit_and_loss as profitAndLoss,
+        pl_value as plValue,
         surplus_weight as surplusWeight,
         grain_fund as grainFund,
         amount_ed_payable as amountEdPayable,
@@ -58,6 +65,9 @@
         avg_cost as avgCost,
         in_type as inType,
         request_funds as requestFunds,
+        issuing_time as issuingTime,
+        workflow_id as workflowId,
+        status,
         approve_status as approveStatus,
         update_date as updateDate
         FROM warehousing_order
@@ -90,6 +100,9 @@
                 AND profit_and_loss &lt; 0
             </if>
         </if>
+        <if test="batchId != null and batchId != ''">
+            AND batch_id= #{batchId}
+        </if>
         ORDER BY base_id,update_date DESC
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}