|  | @@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.domain.AuditItems;
 | 
	
		
			
				|  |  | -import com.ruoyi.approvalFlow.mapper.AuditItemsDoMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.mapper.AuditItemsMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.mapper.AuditItemsUsersMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.service.impl.AuditItemsAbout;
 | 
	
	
		
			
				|  | @@ -22,6 +21,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.entity.TWarehouse;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.model.LoginUser;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.exception.BaseException;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.exception.StorageFeeException;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.exception.WarehouseException;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.DictUtils;
 | 
	
	
		
			
				|  | @@ -67,7 +67,6 @@ import com.ruoyi.warehouseBusiness.mapper.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 | 
	
		
			
				|  |  |  import lombok.AllArgsConstructor;
 | 
	
		
			
				|  |  |  import org.apache.poi.hssf.usermodel.*;
 | 
	
		
			
				|  |  | -import org.apache.poi.ss.formula.functions.T;
 | 
	
		
			
				|  |  |  import org.apache.poi.ss.usermodel.*;
 | 
	
		
			
				|  |  |  import org.apache.poi.ss.util.CellRangeAddress;
 | 
	
		
			
				|  |  |  import org.apache.poi.ss.util.CellReference;
 | 
	
	
		
			
				|  | @@ -76,9 +75,13 @@ import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.http.*;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.interceptor.TransactionAspectSupport;
 | 
	
		
			
				|  |  | +import org.springframework.util.LinkedMultiValueMap;
 | 
	
		
			
				|  |  | +import org.springframework.util.MultiValueMap;
 | 
	
		
			
				|  |  | +import org.springframework.web.client.RestTemplate;
 | 
	
		
			
				|  |  |  import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.io.*;
 | 
	
	
		
			
				|  | @@ -2965,6 +2968,127 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | +    public AjaxResult ruoYiVersionOrderListNew(TWarehouseBills tWarehouseBills) {
 | 
	
		
			
				|  |  | +        List<Map<String,Object>> result = tWarehouseBillsMapper.ruoYiVersionOrderList(tWarehouseBills);
 | 
	
		
			
				|  |  | +        List<ShipperDataVo> list = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (Map<String,Object> map : result) {
 | 
	
		
			
				|  |  | +            // 新建实体
 | 
	
		
			
				|  |  | +            ShipperDataVo dataVo = new ShipperDataVo();
 | 
	
		
			
				|  |  | +            dataVo.setBillOfLadingNo((String) map.get("fBillno"));
 | 
	
		
			
				|  |  | +            dataVo.setOrderEnterprise((String) map.get("corpName"));
 | 
	
		
			
				|  |  | +            dataVo.setOrderEnterpriseNo("91370220334191898X");
 | 
	
		
			
				|  |  | +            dataVo.setConsignee((String) map.get("fConsigneername"));
 | 
	
		
			
				|  |  | +            dataVo.setConsigneeAddress((String) map.get("fConsigneername"));
 | 
	
		
			
				|  |  | +            dataVo.setConsigneePersonPhone((String) map.get("fConsigneetel"));
 | 
	
		
			
				|  |  | +            dataVo.setBillTime(StringUtils.nowTimeStr(map.get("createTime")));
 | 
	
		
			
				|  |  | +            dataVo.setShipAgent("青岛凯和志成");
 | 
	
		
			
				|  |  | +            dataVo.setShipAgentNo("BH1234678767");
 | 
	
		
			
				|  |  | +            dataVo.setSendEnterprise("青岛凯和志成");
 | 
	
		
			
				|  |  | +            dataVo.setSendType("2");
 | 
	
		
			
				|  |  | +            dataVo.setSwitchBillPerson("OP");
 | 
	
		
			
				|  |  | +            dataVo.setDeliveryClause((String) map.get("fServiceitems"));
 | 
	
		
			
				|  |  | +            //dataVo.setContractNo("HT2345678");
 | 
	
		
			
				|  |  | +            //dataVo.setBillType("A");
 | 
	
		
			
				|  |  | +            //dataVo.setOceanFreight("到付海运费");
 | 
	
		
			
				|  |  | +            //dataVo.setCurrency("币种");
 | 
	
		
			
				|  |  | +            dataVo.setShipCompany("青岛凯和志成");
 | 
	
		
			
				|  |  | +            dataVo.setXsgsm("GSM001");
 | 
	
		
			
				|  |  | +            dataVo.setImportZone("进口关区");
 | 
	
		
			
				|  |  | +            dataVo.setFirstTrans("第一程运输");
 | 
	
		
			
				|  |  | +            dataVo.setTradeFlag("N");
 | 
	
		
			
				|  |  | +            dataVo.setMtdm("QQCTN");
 | 
	
		
			
				|  |  | +            dataVo.setLoadingPort((String) map.get("loadportName"));
 | 
	
		
			
				|  |  | +            dataVo.setDischargePort((String) map.get("destportName"));
 | 
	
		
			
				|  |  | +            //dataVo.setDestination("目的地");
 | 
	
		
			
				|  |  | +            //dataVo.setDischargePlace("卸货地点");
 | 
	
		
			
				|  |  | +            dataVo.setArrivalDatetime((String) map.get("fEta"));
 | 
	
		
			
				|  |  | +            dataVo.setBillMark((String) map.get("fMarks"));
 | 
	
		
			
				|  |  | +            //dataVo.setVesselNameCn("中文船名");
 | 
	
		
			
				|  |  | +            dataVo.setVesselNameEn("KaiHeZhinCheng");
 | 
	
		
			
				|  |  | +            dataVo.setVoyageNumber((String) map.get("fVoyTwoName"));
 | 
	
		
			
				|  |  | +            dataVo.setImo("IMO001");
 | 
	
		
			
				|  |  | +            dataVo.setMtdm("TDH2345678");
 | 
	
		
			
				|  |  | +            dataVo.setMtVesselCode("QD22334455");
 | 
	
		
			
				|  |  | +            dataVo.setMtVoyageNumber("HC12345678");
 | 
	
		
			
				|  |  | +            dataVo.setGoodsName((String) map.get("goodsName"));
 | 
	
		
			
				|  |  | +            dataVo.setPackages("12");
 | 
	
		
			
				|  |  | +            dataVo.setPackagesUnit("吨");
 | 
	
		
			
				|  |  | +            dataVo.setWeight("12.3");
 | 
	
		
			
				|  |  | +            dataVo.setWeightUnit("吨");
 | 
	
		
			
				|  |  | +            dataVo.setVolume("23.1");
 | 
	
		
			
				|  |  | +            dataVo.setVolumeUnit("体积单位");
 | 
	
		
			
				|  |  | +            //dataVo.setTransferRemark("备注(换单备注)");
 | 
	
		
			
				|  |  | +            dataVo.setConDescribe((String) map.get("fNo"));
 | 
	
		
			
				|  |  | +            dataVo.setLclType("0");
 | 
	
		
			
				|  |  | +            List<ShipperContList> contLists = new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //配箱信息
 | 
	
		
			
				|  |  | +            TWarehousebillsCntritems warehousebillsCntritems = new TWarehousebillsCntritems();
 | 
	
		
			
				|  |  | +            warehousebillsCntritems.setfPid(Long.valueOf(map.get("fId").toString()));
 | 
	
		
			
				|  |  | +            List<TWarehousebillsCntritems> tWarehousebillsCntritems = tWarehousebillsCntritemsMapper.selectTWarehousebillsCntritemsList(warehousebillsCntritems);
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(tWarehousebillsCntritems)) {
 | 
	
		
			
				|  |  | +                for (TWarehousebillsCntritems cntritems : tWarehousebillsCntritems) {
 | 
	
		
			
				|  |  | +                    ShipperContList contList = new ShipperContList();
 | 
	
		
			
				|  |  | +                    contList.setContainerNo(cntritems.getfCntrno());
 | 
	
		
			
				|  |  | +                    contList.setContainerType(cntritems.getfCntrid().toString());
 | 
	
		
			
				|  |  | +                    contList.setContainerSize(cntritems.getfPackageid());
 | 
	
		
			
				|  |  | +                    contList.setSealno(cntritems.getfSealno());
 | 
	
		
			
				|  |  | +                    //contList.setConPackages("12");
 | 
	
		
			
				|  |  | +                    //contList.setConWeight("1.2");
 | 
	
		
			
				|  |  | +                    //contList.setConVolume("21");
 | 
	
		
			
				|  |  | +                    contList.setLclType("0");
 | 
	
		
			
				|  |  | +                    contLists.add(contList);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            dataVo.setContList(contLists);
 | 
	
		
			
				|  |  | +            // list.add(dataVo);
 | 
	
		
			
				|  |  | +            String json = JSONObject.toJSONString(dataVo);
 | 
	
		
			
				|  |  | +            System.err.println("json:" + json);
 | 
	
		
			
				|  |  | +            //String jsonStr = JSONObject.toJSONString(dataVo);
 | 
	
		
			
				|  |  | +            // 请求路径 (测试)
 | 
	
		
			
				|  |  | +            // String postUrl = "https://api.qingdao-port.net/container/web/eir/edo/shipagent/insertEdo.do";
 | 
	
		
			
				|  |  | +            String postUrl = "https://api.qingdao-port.net/container/web/eir/edo/shipagent/insertEdo.do";
 | 
	
		
			
				|  |  | +            // 请求路径 (正式)
 | 
	
		
			
				|  |  | +            //String postUrl = "https://api.qingdao-port.net/container/web/wlds_eir/edo/shipagent/insertEdo.do";
 | 
	
		
			
				|  |  | +            // 请求参数
 | 
	
		
			
				|  |  | +            Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  | +            params.put("customerCode","A00001");
 | 
	
		
			
				|  |  | +            params.put("sign","abcdef");
 | 
	
		
			
				|  |  | +            params.put("reqTime",StringUtils.nowTimeStr());
 | 
	
		
			
				|  |  | +            params.put("data",json);
 | 
	
		
			
				|  |  | +            System.err.println(params);
 | 
	
		
			
				|  |  | +            TResponseVo responseVo = sendPostRequest(postUrl,params);
 | 
	
		
			
				|  |  | +            System.err.println(responseVo);
 | 
	
		
			
				|  |  | +            if (!responseVo.isSuccess()) {
 | 
	
		
			
				|  |  | +                return AjaxResult.error(responseVo.getMessage().get("msg"));
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                return AjaxResult.success(responseVo.getMessage().get("msg"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // String json = JSONObject.toJSONString(list);
 | 
	
		
			
				|  |  | +        return AjaxResult.success("成功");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 向目的 URL 发送 post 请求
 | 
	
		
			
				|  |  | +     * @param url 目的 url
 | 
	
		
			
				|  |  | +     * @param params 发送的参数
 | 
	
		
			
				|  |  | +     * @return ResponseVo
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public static TResponseVo sendPostRequest(String url, Map<String,String> params) {
 | 
	
		
			
				|  |  | +        RestTemplate client = new RestTemplate();
 | 
	
		
			
				|  |  | +        HttpHeaders headers = new HttpHeaders();
 | 
	
		
			
				|  |  | +        HttpMethod method = HttpMethod.POST;
 | 
	
		
			
				|  |  | +        // 以表单的方式提交
 | 
	
		
			
				|  |  | +        headers.setContentType(MediaType.APPLICATION_JSON);
 | 
	
		
			
				|  |  | +        // 将请求头部和参数合成一个请求
 | 
	
		
			
				|  |  | +        HttpEntity<Map<String,String>> requestEntity = new HttpEntity<>(params,headers);
 | 
	
		
			
				|  |  | +        // 执行 HTTP 请求,将返回的结构使用 ResponseVo 类格式化
 | 
	
		
			
				|  |  | +        ResponseEntity<TResponseVo> response = client.exchange(url, method, requestEntity, TResponseVo.class);
 | 
	
		
			
				|  |  | +        return response.getBody();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  |      public List<Map<String, Object>> webVersionOrderMessage(LoginUser loginUser, TWarehouseBills tWarehouseBills) {
 | 
	
		
			
				|  |  |          TWarehouseBills warehouseBills = new TWarehouseBills();
 | 
	
		
			
				|  |  |          if (tWarehouseBills != null) {
 | 
	
	
		
			
				|  | @@ -4551,6 +4675,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          // 获取税率
 | 
	
		
			
				|  |  |          List<SysDictData> taxRate = sysDictDataMapper.selectDictDataByType("tax_rate");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        List<String> fMblnoMsgList = new ArrayList<>();
 | 
	
		
			
				|  |  |          for (CalculateStorageFeesInfoVO item : feesInfoVOList) {
 | 
	
		
			
				|  |  |              // 交以计算明细计费方式必填
 | 
	
		
			
				|  |  |              if (StringUtils.isNull(item.getFBillingway())) {
 | 
	
	
		
			
				|  | @@ -4611,7 +4736,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |              storageFeesDto.setfNetweight(item.getFNetweight());
 | 
	
		
			
				|  |  |              storageFeesDto.setfGrossweight(item.getFGrossweight());
 | 
	
		
			
				|  |  |              // 仓储费协议计算
 | 
	
		
			
				|  |  | -            StorageFeeCalculationResultVO feeCalculationResultVO = tWarehouseAgreementService.getCarryingCost(storageFeesDto);
 | 
	
		
			
				|  |  | +            StorageFeeCalculationResultVO feeCalculationResultVO = null;
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                feeCalculationResultVO = tWarehouseAgreementService.getCarryingCost(storageFeesDto);
 | 
	
		
			
				|  |  | +            } catch (StorageFeeException e) {
 | 
	
		
			
				|  |  | +                fMblnoMsgList.add(e.getMessage());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              if (Objects.isNull(feeCalculationResultVO)) {
 | 
	
		
			
				|  |  |                  continue;
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -4665,6 +4796,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          resultVO.setAmt(sumAmt);
 | 
	
		
			
				|  |  |          resultVO.setItemFeesList(itemsList);
 | 
	
		
			
				|  |  | +        resultVO.setfMblnoMsgList(fMblnoMsgList);
 | 
	
		
			
				|  |  |          return resultVO;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -4726,6 +4858,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          tWarehouseBills.setfId(null);
 | 
	
		
			
				|  |  |          List<CalculateStorageFeesInfoVO> feesInfoVOList = tWarehousebillsitemsMapper.selectStorageFeeItemList1(tWarehouseBills);
 | 
	
		
			
				|  |  |          tWarehouseBills.setfId(fPid);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<String> fMblnoMsgList = new ArrayList<>();
 | 
	
		
			
				|  |  |          if (CollectionUtils.isNotEmpty(feesInfoVOList)) {
 | 
	
		
			
				|  |  |              StorageFeeCalculationResultVO resultVO = getWarehouseItems(tWarehouseBills, feesInfoVOList, loginUser, cangKey);
 | 
	
		
			
				|  |  |              if (CollectionUtils.isNotEmpty(resultVO.getItemFeesList())) {
 | 
	
	
		
			
				|  | @@ -4737,6 +4871,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |                  itemsList = resultVO.getItemFeesList();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            fMblnoMsgList.addAll(resultVO.getfMblnoMsgList());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<CalculateStorageFeesInfoVO> whgenlegfeesInfoVOList = tWhgenlegMapper.selectStorageFeeItemList1(tWarehouseBills);
 | 
	
		
			
				|  |  |          if (CollectionUtils.isNotEmpty(whgenlegfeesInfoVOList)) {
 | 
	
	
		
			
				|  | @@ -4754,6 +4889,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                      itemsList.add(li);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            fMblnoMsgList.addAll(resultVO.getfMblnoMsgList());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          TFees tFees = new TFees();
 | 
	
		
			
				|  |  |          tFees.setfStatus("2");
 | 
	
	
		
			
				|  | @@ -4765,6 +4901,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          calculationResultVO.setFeesList(feesList);
 | 
	
		
			
				|  |  |          calculationResultVO.setWarehouseBills(tWarehouseBills);
 | 
	
		
			
				|  |  |          calculationResultVO.setWarehouseItemList(itemsList);
 | 
	
		
			
				|  |  | +        calculationResultVO.setfMblnoMsg(fMblnoMsgList.stream().distinct().collect(Collectors.joining(",")));
 | 
	
		
			
				|  |  |          return AjaxResult.success(calculationResultVO);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -5043,7 +5180,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |              storageFeesDto.setfNetweight(new BigDecimal(String.valueOf(item.get("fNetweight"))));
 | 
	
		
			
				|  |  |              storageFeesDto.setfGrossweight(new BigDecimal(String.valueOf(item.get("fGrossweight"))));
 | 
	
		
			
				|  |  |              // 计算仓储费明细
 | 
	
		
			
				|  |  | -            StorageFeeCalculationResultVO carryingCost = tWarehouseAgreementService.getCarryingCost(storageFeesDto);
 | 
	
		
			
				|  |  | +            StorageFeeCalculationResultVO carryingCost = null;
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                carryingCost = tWarehouseAgreementService.getCarryingCost(storageFeesDto);
 | 
	
		
			
				|  |  | +            } catch (StorageFeeException e) {
 | 
	
		
			
				|  |  | +                throw new WarehouseException("编号" + e.getMessage() + "未找到计费规则");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              if (StringUtils.isNull(carryingCost)) {
 | 
	
		
			
				|  |  |                  continue;
 | 
	
		
			
				|  |  |              }
 |