|  | @@ -3,14 +3,18 @@ package com.ruoyi.warehouseBusiness.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.domain.*;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.mapper.TCorpsMapper;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.mapper.TFeesMapper;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.mapper.TGoodsMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.AjaxResult;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.core.domain.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.model.LoginUser;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.StringUtils;
 | 
	
		
			
				|  |  | -import com.ruoyi.warehouseBusiness.domain.BillnoDel;
 | 
	
		
			
				|  |  | -import com.ruoyi.warehouseBusiness.domain.TWarehouseAgreement;
 | 
	
		
			
				|  |  | -import com.ruoyi.warehouseBusiness.domain.TWarehouseAgreementitems;
 | 
	
		
			
				|  |  | -import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 | 
	
		
			
				|  |  | +import com.ruoyi.reportManagement.domain.TWhgenleg;
 | 
	
		
			
				|  |  | +import com.ruoyi.system.mapper.SysDeptMapper;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.domain.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.warehouseBusiness.mapper.BillnoDelMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.warehouseBusiness.mapper.TWarehouseAgreementMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.warehouseBusiness.mapper.TWarehouseAgreementitemsMapper;
 | 
	
	
		
			
				|  | @@ -18,9 +22,7 @@ import com.ruoyi.warehouseBusiness.service.ITWarehouseAgreementService;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.util.Date;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 仓储费Service业务层处理
 | 
	
	
		
			
				|  | @@ -42,6 +44,19 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private BillnoDelMapper billnoDelMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TCorpsMapper tCorpsMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TGoodsMapper tGoodsMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TFeesMapper tFeesMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysDeptMapper sysDeptMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询仓储费
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -53,6 +68,65 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |          return tWarehouseAgreementMapper.selectTWarehouseAgreementById(fId);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public Map<String, Object> selectTWarehouseAgreementById1(Long fId) {
 | 
	
		
			
				|  |  | +        Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +        // 查询协议主表数据
 | 
	
		
			
				|  |  | +        TWarehouseAgreement tWarehouseAgreement = tWarehouseAgreementMapper.selectTWarehouseAgreementById(fId);
 | 
	
		
			
				|  |  | +        // 客户表
 | 
	
		
			
				|  |  | +        List<Long> corpsId = new ArrayList<>();
 | 
	
		
			
				|  |  | +        // 用户表
 | 
	
		
			
				|  |  | +        List<SysUser> sysUserList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        // 商品
 | 
	
		
			
				|  |  | +        List<Long> goodsId = new ArrayList<>();
 | 
	
		
			
				|  |  | +        // 费用
 | 
	
		
			
				|  |  | +        List<Long> feesId = new ArrayList<>();
 | 
	
		
			
				|  |  | +        if (!StringUtils.isNull(tWarehouseAgreement)) {
 | 
	
		
			
				|  |  | +            corpsId.add(tWarehouseAgreement.getfCorpid());
 | 
	
		
			
				|  |  | +            map.put("tWarehouseAgreement", tWarehouseAgreement);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // 协议从表
 | 
	
		
			
				|  |  | +        TWarehouseAgreementitems tWarehouseAgreementitems = new TWarehouseAgreementitems();
 | 
	
		
			
				|  |  | +        tWarehouseAgreementitems.setfPid(fId);
 | 
	
		
			
				|  |  | +        List<TWarehouseAgreementitems> tWarehouseAgreementitemss = tWarehouseAgreementitemsMapper.selectTWarehouseAgreementitemsList(tWarehouseAgreementitems);
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotEmpty(tWarehouseAgreementitemss)) {
 | 
	
		
			
				|  |  | +            for (TWarehouseAgreementitems  fees : tWarehouseAgreementitemss) {
 | 
	
		
			
				|  |  | +                feesId.add(fees.getfFeeid());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<TCorps> corpsList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        List<Long> corpsIdList = StringUtils.integerDeduplication(corpsId);
 | 
	
		
			
				|  |  | +        for (Long corpId : corpsIdList) {
 | 
	
		
			
				|  |  | +            TCorps corps = tCorpsMapper.selectTCorpsById(corpId);
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotNull(corps)) {
 | 
	
		
			
				|  |  | +                corpsList.add(corps);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<TGoods> goodsList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        List<Long> goodsIdList = StringUtils.integerDeduplication(goodsId);
 | 
	
		
			
				|  |  | +        for (Long goods : goodsIdList) {
 | 
	
		
			
				|  |  | +            TGoods tGoods = tGoodsMapper.selectTGoodsById(goods);
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotNull(tGoods)) {
 | 
	
		
			
				|  |  | +                goodsList.add(tGoods);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<TFees> feesList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        List<Long> longList = StringUtils.integerDeduplication(feesId);
 | 
	
		
			
				|  |  | +        for (Long fees : longList) {
 | 
	
		
			
				|  |  | +            TFees tFees = tFeesMapper.selectTFeesById(fees);
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotNull(tFees)) {
 | 
	
		
			
				|  |  | +                feesList.add(tFees);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        map.put("corps", corpsList);
 | 
	
		
			
				|  |  | +        map.put("goodsList", goodsList);
 | 
	
		
			
				|  |  | +        map.put("feesList", feesList);
 | 
	
		
			
				|  |  | +        map.put("tWarehouseAgreementitems", tWarehouseAgreementitemss);
 | 
	
		
			
				|  |  | +        map.put("dept", sysDeptMapper.selectDeptById(tWarehouseAgreement.getfDeptid()));
 | 
	
		
			
				|  |  | +        return map;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询仓储费列表
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -94,6 +168,8 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |              // 业务编码
 | 
	
		
			
				|  |  |              String billNo = billnoSerialServiceImpl.getBillNo("WA", new Date());
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setfBillno(billNo);
 | 
	
		
			
				|  |  | +            tWarehouseAgreement.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  | +            tWarehouseAgreement.setfDeptid(loginUser.getUser().getDeptId());
 | 
	
		
			
				|  |  |              tWarehouseAgreementMapper.insertTWarehouseAgreement(tWarehouseAgreement);
 | 
	
		
			
				|  |  |              fPid = tWarehouseAgreement.getfId();
 | 
	
		
			
				|  |  |          }else{
 |