zouyu
2023-11-15 c9db22f6ccb6a6d66e38dec09807e88b160f29e8
mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java
@@ -26,9 +26,9 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaztt.ifs.api.feign.IfsFeignClient;
import com.chinaztt.mes.basic.entity.Part;
import com.chinaztt.mes.basic.entity.Staff;
import com.chinaztt.mes.basic.mapper.PartMapper;
import com.chinaztt.mes.basic.mapper.StaffMapper;
import com.chinaztt.mes.basic.mapper.UserServiceMapper;
import com.chinaztt.mes.basic.util.RedisUtils;
import com.chinaztt.mes.common.handler.StateMachineHandler;
import com.chinaztt.mes.common.numgen.NumberGenerator;
@@ -37,7 +37,7 @@
import com.chinaztt.mes.common.oa.OAResult;
import com.chinaztt.mes.common.util.StateResult;
import com.chinaztt.mes.common.util.WechatMsgTips;
import com.chinaztt.mes.common.util.WxCpUtils;
import com.chinaztt.mes.common.util.easyexcel.EasyExcelUtils;
import com.chinaztt.mes.common.wechat.WechatProperty;
import com.chinaztt.mes.plan.dto.*;
import com.chinaztt.mes.plan.entity.*;
@@ -52,6 +52,8 @@
import com.chinaztt.mes.plan.util.CustomerOrderClientConfigure;
import com.chinaztt.mes.plan.util.CustomerOrderUnitWhiteListConfig;
import com.chinaztt.mes.plan.util.CustomerOrderUtil;
import com.chinaztt.mes.plan.util.FileSaveUtil;
import com.chinaztt.mes.plan.vo.CustomerOrderVO1;
import com.chinaztt.mes.quality.dto.CustomOrderSyncDTO;
import com.chinaztt.mes.technology.entity.*;
import com.chinaztt.mes.technology.mapper.*;
@@ -83,7 +85,6 @@
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.messaging.Message;
@@ -98,19 +99,18 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * 客户订单表
@@ -181,6 +181,7 @@
   private WechatProperty wechatProperty;
   private UserServiceMapper userServiceMapper;
   private final OssProperties ossProperties;
   private final OssTemplate minioTemplate;
@@ -188,6 +189,14 @@
   private final static String MO_RETURN_STAFF = "MO_RETURN_STAFF";
   private Environment environment;
   private final static String OTC_MAIN_STATUS_CANCEL = "已取消";
   private final static String OTC_MAIN_STATUS_TRANSMIT = "已下达";
   private final static String AFFILIATED_CONTRACT = "中天注塑厂";
   @Override
   public void otcDownload(Long id, HttpServletResponse response) {
@@ -213,9 +222,12 @@
   @Override
   public IPage getCustomerOrderPage(Page page, QueryWrapper<CustomerOrder> planCustomerOrder, String type) {
      IPage iPage = baseMapper.getCustomerOrderPage(page, planCustomerOrder, type);
      return iPage;
      //ZttUser currentUser = SecurityUtils.getUser();
      ////获取员工id
      //Long staffId = userServiceMapper.selectById(currentUser.getId()).getStaffId();
      return customerOrderMapper.getCustomerOrderPage(page, planCustomerOrder);
   }
   @Override
   public boolean changeMarkPlanned(List<Long> ids, String coState) {
@@ -327,39 +339,25 @@
   @Override
   public CustomerOrderDTO getCustomerOrderById(Long id) {
      CustomerOrder newCustomerOrder = baseMapper.selectById(id);
      Customer customer = customerMapper.selectById(newCustomerOrder.getCustomerId());
      CustomerOrderDTO customerOrderDTO = new CustomerOrderDTO();
      BeanUtils.copyProperties(newCustomerOrder, customerOrderDTO);
      customerOrderDTO.setComment(customer.getComment());
      //获取字段和列名
      List<OrderParamDTO> orderParamList = orderParamMapper.getAllOrder();
      customerOrderDTO.setOrderParamList(orderParamList);
      //拼接crosstab所需要的验证数据
      //      OrderParam orderParam = orderParamMapper.getParam();
      //获取客户订单和绑定的订单参数
      JSONObject customerOrderList = baseMapper.getCustomerOrderByIdnew(id);
      customerOrderDTO.setCustomerOrderList(customerOrderList);
      List<JSONObject> list = new ArrayList<>();
      customerOrderDTO.setCustomerOrderAttachmentList(list);
      // 获取工单所需物料
      List<OperationTaskProduce> operationTaskProduceList = operationTaskProduceMapper.selectList(Wrappers.<OperationTaskProduce>lambdaQuery()
            .eq(OperationTaskProduce::getCustomerOrderId, id).orderByAsc(OperationTaskProduce::getSort));
      customerOrderDTO.setOutPutBatchList(operationTaskProduceList);
      if (newCustomerOrder.getTechnologyDocumentId() != null) {
         Document document = documentMapper.selectById(newCustomerOrder.getTechnologyDocumentId());
   public CustomerOrderVO1 getCustomerOrderById(Long id) {
      CustomerOrderVO1 customerOrderVO1 = new CustomerOrderVO1();
      //销售产品单(客户行表)
      CustomerOrder customerOrder = baseMapper.selectById(id);
      BeanUtils.copyProperties(customerOrder, customerOrderVO1);
      //客户主表
      Customer customer = customerMapper.selectById(customerOrder.getCustomerId());
      BeanUtils.copyProperties(customer,customerOrderVO1);
      if (customerOrder.getTechnologyDocumentId() != null) {
         Document document = documentMapper.selectById(customerOrder.getTechnologyDocumentId());
         if (document != null) {
            customerOrderDTO.setDocNumber(document.getNumber());
            //工艺文件编号
            customerOrderVO1.setDocNumber(document.getNumber());
            //工艺文件名称
            customerOrderVO1.setDocName(document.getName());
         }
      }
      List<OrderProcessConfigFileDTO> configFiles =
            orderProcessConfigFileMapper.getProcessConfigFiles(newCustomerOrder.getCustomerOrderNo(),
                  newCustomerOrder.getOtcLineNo());
      customerOrderDTO.setConfigFiles(configFiles);
      ProcessConfigDTO processConfigdto = processConfigService.getProcessConfig(id);
      customerOrderDTO.setProcessConfigDTO(processConfigdto);
      return customerOrderDTO;
      customerOrderVO1.setId(id);
      return customerOrderVO1;
   }
   @Override
@@ -668,31 +666,19 @@
    * @return
    */
   @Override
   @Transactional(rollbackFor = Exception.class)
   public R otcCustomerOrderSync(String selectTime, String pathCode) {
      try {
         if (StringUtils.isBlank(selectTime)) {
            return R.failed("缺少查询时间");
         }
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LocalDateTime startDate = LocalDateTime.parse(selectTime, formatter);
         Long days = LocalDate.now().toEpochDay() - startDate.toLocalDate().toEpochDay();
         if (days > 30) {
            return R.failed("超出查询时间范围");
         }
         String token = customerOrderUtil.getToken();
         if (pathCode.equals("0")) {
            return addCustomerFromOtc(selectTime, token);
         } else if (pathCode.equals("1")) {
            return addCustomerFromOtcForJointStockCompany(selectTime, token);
         } else {
            throw new RuntimeException("路径请求码 = 【" + pathCode + "】非法");
         }
         return addCustomerFromOtc(selectTime, token);
      } catch (Exception e) {
         return R.failed(e.getMessage());
      }
   }
   /**
    * 添加主表信息
@@ -707,10 +693,13 @@
         if (StringUtils.isNotBlank(selectTime)) {
            map.put("selectTime", selectTime);
         }
         String str = HttpRequest.get(customerOrderClientConfigure.getOtcHost() + customerOrderClientConfigure.getOtcCusomerUrl())
         String str = HttpRequest.get(customerOrderClientConfigure.getOtcHost() + customerOrderClientConfigure.getOtcCustomerUrl())
               .contentType("application/json")
               .header("Authorization", "Bearer " + token).form(map).execute().body();
         JSONObject result = JSONObject.parseObject(str);
         //JSONArray jsonArray = result.getJSONArray("data");
         //jsonArray.forEach();
         //return null;
         //主表参数表
         List<OrderParam> orderParams = orderParamService.list();
         if (result.getInteger("code") == 0) {
@@ -725,6 +714,12 @@
               String otcMainStatus = customerJSONObject.getString("status");
               //所属公司
               String affiliatedCompany = customerJSONObject.getString("affiliatedCompany");
               //所属工厂
               String affiliatedContract=customerJSONObject.getString("affiliatedContract");
               //只拉取所属公司为中天海洋系统有限公司的数据
               if (!AFFILIATED_CONTRACT.equals(affiliatedContract)){
                  continue;
               }
               // 不在这几个状态中的数据就跳过
               if (!Arrays.asList(CustomerOrderStateStringValues.GETOTCSTATE).contains(otcMainStatus)) {
                  continue;
@@ -734,15 +729,15 @@
                  customer = new Customer();
               }
               //如果OTC中主表状态是取消那就跳过或者删除已经同步的数据
               if (otcMainStatus.equals("已取消")) {
               if (OTC_MAIN_STATUS_CANCEL.equals(otcMainStatus)) {
                  if (customer.getId() != null) {
                     customerMapper.deleteById(customer.getId());
                     baseMapper.delete(Wrappers.<CustomerOrder>lambdaQuery().eq(CustomerOrder::getCustomerId, customer.getId()));
                  }
                  continue;
               }
               if (null == affiliatedCompany || !Arrays.asList("已审核", "已下达").contains(otcMainStatus) || affiliatedCompany.equals("江苏中天科技股份有限公司")) {
                  continue;//只获取OTC中已审核及已下达的订单,且所属公司不是中天科技
               if (!OTC_MAIN_STATUS_TRANSMIT.equals(otcMainStatus)) {//null == affiliatedCompany || !Arrays.asList("已下达").contains(otcMainStatus) /*|| affiliatedCompany.equals("江苏中天科技股份有限公司")*/) {
                  continue;//只获取OTC中已审核及已下达的订单,
               }
               //客户编号
               customer.setCustomerNo(customerJSONObject.getString("customerNo"));
@@ -799,7 +794,6 @@
      }
   }
   /**
    * 添加子表信息
    *
@@ -841,17 +835,19 @@
               //otc行号
               customerOrder.setOtcLineNo(otcLoneId);
               //零件号
               customerOrder.setSalesPartNo(customerOrderJSONObject.getString("partNo"));
               //来源
               customerOrder.setSourceId("OTC");
               customerOrder.setPartNo(customerOrderJSONObject.getString("partNo"));
               //来源 0:自动
               customerOrder.setSourceId("0");
               //合同号
               customerOrder.setCustomerOrderNo(customer.getContractNo());
               //客户号
               customerOrder.setCustomerNo(customer.getCustomerNo());
               //客户名称
               customerOrder.setCustomerName(customer.getCustomerName());
               //销售数量原先OTC的单位
               customerOrder.setOtcQuantity(customerOrderJSONObject.getBigDecimal("quantity"));
               //工程名称
               customerOrder.setEntityName(customer.getEntityName());
               //数量
               customerOrder.setBuyQtyDue(customerOrderJSONObject.getBigDecimal("quantity"));
               //OTC单位
               customerOrder.setOtcUnit(customerOrderJSONObject.getString("unit"));
               //期望交货日期
@@ -890,8 +886,8 @@
               customerOrder.setSalesmanName(customer.getSalesMan());
               //盘长要求
               customerOrder.setLengthRequirement(customerOrderJSONObject.getString("lengthRequirement"));
               //备注Ï
               customerOrder.setRemark(customerOrderJSONObject.getString("comment"));
               //产品备注Ï
               customerOrder.setRemark(customerOrderJSONObject.getString("orderComment"));
               //产品类型
               customerOrder.setProductType(customerOrderJSONObject.getString("productType"));
               //产品分组
@@ -920,16 +916,14 @@
                     customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK);
                     customerOrder.setOtcPartSync(Boolean.TRUE);
                  }
                  //审核状态为 01draft 草稿
                  customerOrder.setIsAudit(AuditStateStringValues.DRAFT);
                  baseMapper.insert(customerOrder);
               } else {
                  // 如果状态为零件待选,且销售件号不为空,更新状态
                  if (StrUtil.isNotBlank(customerOrder.getSalesPartNo()) && CustomerOrderStateStringValues.PARTUNCHECKED.equals(customerOrder.getCoState())) {
                  // 如果状态为零件待选,且零件号不为空,更新状态
                  if (StrUtil.isNotBlank(customerOrder.getPartNo()) && CustomerOrderStateStringValues.PARTUNCHECKED.equals(customerOrder.getCoState())) {
                     customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK);
                     customerOrder.setOtcPartSync(Boolean.TRUE);
                  }
                  baseMapper.updateById(customerOrder);
                  //审核状态为 01draft 草稿
                  customerOrder.setIsAudit(AuditStateStringValues.DRAFT);
                  baseMapper.insert(customerOrder);
               }
               addCustomerPara(customerJSONObject, customerOrderJSONObject, customerOrder, orderParamList);
               num += 1;
@@ -940,6 +934,253 @@
      }
      return num;
   }
   ///**
   // * 添加主表信息
   // *
   // * @param selectTime 时间
   // * @param token      token
   // * @return
   // */
   //private R addCustomerFromOtc(String selectTime, String token) {
   //   try {
   //      Map<String, Object> map = new HashMap<>();
   //      if (StringUtils.isNotBlank(selectTime)) {
   //         map.put("selectTime", selectTime);
   //      }
   //      String str = HttpRequest.get(customerOrderClientConfigure.getOtcHost() + customerOrderClientConfigure.getOtcCusomerUrl())
   //            .contentType("application/json")
   //            .header("Authorization", "Bearer " + token).form(map).execute().body();
   //      JSONObject result = JSONObject.parseObject(str);
   //      //主表参数表
   //      List<OrderParam> orderParams = orderParamService.list();
   //      if (result.getInteger("code") == 0) {
   //         int num = 0;
   //         int detailNum = 0;
   //         JSONArray jsonArray = result.getJSONArray("data");
   //         for (Object obj : jsonArray) {
   //            JSONObject customerJSONObject = JSONObject.parseObject(obj.toString());
   //            //合同编号
   //            String contractNo = customerJSONObject.getString("orderNo");
   //            //主表在OTC中的状态
   //            String otcMainStatus = customerJSONObject.getString("status");
   //            //所属公司
   //            String affiliatedCompany = customerJSONObject.getString("affiliatedCompany");
   //            // 不在这几个状态中的数据就跳过
   //            if (!Arrays.asList(CustomerOrderStateStringValues.GETOTCSTATE).contains(otcMainStatus)) {
   //               continue;
   //            }
   //            Customer customer = customerMapper.selectOne(Wrappers.<Customer>lambdaQuery().eq(Customer::getContractNo, contractNo));
   //            if (customer == null) {
   //               customer = new Customer();
   //            }
   //            //如果OTC中主表状态是取消那就跳过或者删除已经同步的数据
   //            if (otcMainStatus.equals("已取消")) {
   //               if (customer.getId() != null) {
   //                  customerMapper.deleteById(customer.getId());
   //                  baseMapper.delete(Wrappers.<CustomerOrder>lambdaQuery().eq(CustomerOrder::getCustomerId, customer.getId()));
   //               }
   //               continue;
   //            }
   //            if (null == affiliatedCompany || !Arrays.asList("已审核", "已下达").contains(otcMainStatus) || affiliatedCompany.equals("江苏中天科技股份有限公司")) {
   //               continue;//只获取OTC中已审核及已下达的订单,且所属公司不是中天科技
   //            }
   //            //客户编号
   //            customer.setCustomerNo(customerJSONObject.getString("customerNo"));
   //            //合同号
   //            customer.setContractNo(contractNo);
   //            //客户合同号
   //            customer.setCustomerContractNo(customerJSONObject.getString("customerContractNumber"));
   //            //客户名称
   //            customer.setCustomerName(customerJSONObject.getString("customerName"));
   //            //工程名称
   //            customer.setEntityName(customerJSONObject.getString("projectName"));
   //            //交货日期
   //            customer.setDeliveryDate(customerJSONObject.get("wantedDeliveryDate") != null ?
   //                  customerJSONObject.getDate("wantedDeliveryDate").toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() : null);
   //            //事业部
   //            customer.setSalesDepartment(customerJSONObject.getString("division"));
   //            //省份
   //            customer.setProvince(customerJSONObject.getString("province"));
   //            //业务员名称
   //            customer.setSalesMan(customerJSONObject.getString("salesmanName"));
   //            //业务员编号
   //            customer.setSalerWorkCode(customerJSONObject.getString("salesmanNo"));
   //            //正本状态
   //            customer.setOriginalContractStatus(customerJSONObject.getString("originalStatus"));
   //            //合同正本状态
   //            customer.setReturnStatus(customerJSONObject.getString("returnStatus"));
   //            //项目性质
   //            customer.setIsCp(customerJSONObject.getString("natureOfProjectExecution"));
   //            //下单日期
   //            customer.setPlaceOrderDate(customerJSONObject.getDate("orderDate").toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
   //            //审核日期
   //            customer.setVerifyDate(customerJSONObject.get("reviewTime") != null ?
   //                  customerJSONObject.getDate("reviewTime").toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() : null);
   //            //工厂下单日期
   //            customer.setFactoryPlaceOrderDate(customerJSONObject.get("factoryOrderDate") != null ?
   //                  customerJSONObject.getDate("factoryOrderDate").toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() : null);
   //            //备注
   //            customer.setComment(customerJSONObject.getString("comment"));
   //            if (customer.getId() == null) {
   //               customerMapper.insert(customer);
   //            } else {
   //               customerMapper.updateById(customer);
   //            }
   //            num += 1;
   //
   //            detailNum += addCustomerOrderFromOtc(customerJSONObject, customer, token, orderParams, otcMainStatus);
   //         }
   //         return R.ok().setMsg("同步或更新合同主体" + num + "条,合同明细" + detailNum + "条!");
   //      } else {
   //         return R.failed("订单主体获取失败");
   //      }
   //   } catch (Exception e) {
   //      throw new RuntimeException(e.getMessage());
   //   }
   //}
   //
   /**
    * 添加子表信息
    *
    * @param customer
    * @param otcMainStatus
    * @throws Exception
    */
   //private int addCustomerOrderFromOtc(JSONObject customerJSONObject, Customer customer, String token, List<OrderParam> orderParamList, String otcMainStatus) {
   //   Map<String, String> productTypeGroupMap = customerOrderUnitWhiteListConfig.getProductTypeGroupMap();
   //   int num = 0;
   //   try {
   //      Map<String, Object> map = new HashMap<>();
   //      map.put("orderNo", customer.getContractNo());
   //      map.put("selectTime", "1899-12-31 23:59:59");
   //      JSONObject result = JSONObject.parseObject(HttpRequest.get(customerOrderClientConfigure.getOtcHost() + customerOrderClientConfigure.getOtcCustomerOrderUrl())
   //            .contentType("application/json")
   //            .header("Authorization", "Bearer " + token).form(map).execute().body());
   //      if (result.getInteger("code") == 0) {
   //         JSONArray jsonArray = result.getJSONArray("data");
   //         for (Object obj : jsonArray) {
   //            JSONObject customerOrderJSONObject = JSONObject.parseObject(obj.toString());
   //            String otcLoneId = customerOrderJSONObject.getLong("id").toString();
   //            //OTC的订单状态
   //            String otcOrderStatus = customerOrderJSONObject.getString("lineStatus").toString();
   //            CustomerOrder customerOrder = baseMapper.selectOne(Wrappers.<CustomerOrder>lambdaQuery()
   //                  .eq(CustomerOrder::getOtcLineNo, otcLoneId));
   //            if (customerOrder == null) {
   //               customerOrder = new CustomerOrder();
   //            }
   //            //如果这个单子在OTC中取消状态 那就删除
   //            if (otcOrderStatus.equals("已取消")) {
   //               if (customerOrder.getId() != null) {
   //                  baseMapper.deleteById(customerOrder.getId());
   //               }
   //               continue;
   //            }
   //            //OTC合同号主表id
   //            customerOrder.setOtcOrderId(customerOrderJSONObject.getLong("orderId"));
   //            //otc行号
   //            customerOrder.setOtcLineNo(otcLoneId);
   //            //零件号
   //            customerOrder.setSalesPartNo(customerOrderJSONObject.getString("partNo"));
   //            //来源
   //            customerOrder.setSourceId("OTC");
   //            //合同号
   //            customerOrder.setCustomerOrderNo(customer.getContractNo());
   //            //客户号
   //            customerOrder.setCustomerNo(customer.getCustomerNo());
   //            //客户名称
   //            customerOrder.setCustomerName(customer.getCustomerName());
   //            //销售数量原先OTC的单位
   //            customerOrder.setOtcQuantity(customerOrderJSONObject.getBigDecimal("quantity"));
   //            //OTC单位
   //            customerOrder.setOtcUnit(customerOrderJSONObject.getString("unit"));
   //            //期望交货日期
   //            customerOrder.setWantedDeliveryDate(customer.getDeliveryDate());
   //            //主表id
   //            customerOrder.setCustomerId(customer.getId());
   //            //电压等级
   //            customerOrder.setVoltAgeClass(customerOrderJSONObject.getString("voltageLevel"));
   //            //外呼颜色
   //            customerOrder.setOuterColor(customerOrderJSONObject.getString("outerSheathColor"));
   //            //客户零件名称
   //            customerOrder.setProductName(customerOrderJSONObject.getString("productName"));
   //            //客户零件规格
   //            customerOrder.setCustomerPartSpec(customerOrderJSONObject.getString("specificationModel"));
   //            //订单版本
   //            customerOrder.setVersion(customerOrderJSONObject.getInteger("version"));
   //            //事业部
   //            customerOrder.setDivision(customerOrderJSONObject.getString("division"));
   //            //印字类型
   //            customerOrder.setPrintType(customerOrderJSONObject.getString("printType"));
   //            //印字内容
   //            customerOrder.setPrintContent(customerOrderJSONObject.getString("printContent"));
   //            //印字要求
   //            customerOrder.setPrintingRequirements(customerOrderJSONObject.getString("printingRequirements"));
   //            //包装要求
   //            customerOrder.setPackageRequire(customerOrderJSONObject.getString("packageRequire"));
   //            //质量要求
   //            customerOrder.setQualityRequire(customerOrderJSONObject.getString("qualityRequire"));
   //            //生产需求说明
   //            customerOrder.setOtherProductRequire(customerOrderJSONObject.getString("otherProductRequire"));
   //            //系统
   //            customerOrder.setDivisionSystem(customerOrderJSONObject.getString("divisionSystem"));
   //            //收货地址
   //            customerOrder.setShippingAddress(customerOrderJSONObject.getString("shippingAddress"));
   //            //业务员
   //            customerOrder.setSalesmanName(customer.getSalesMan());
   //            //盘长要求
   //            customerOrder.setLengthRequirement(customerOrderJSONObject.getString("lengthRequirement"));
   //            //备注Ï
   //            customerOrder.setRemark(customerOrderJSONObject.getString("comment"));
   //            //产品类型
   //            customerOrder.setProductType(customerOrderJSONObject.getString("productType"));
   //            //产品分组
   //            customerOrder.setProductGroup(productTypeGroupMap.get(customerOrderJSONObject.getString("productType")));
   //            //采集性质
   //            customerOrder.setCentralizedMiningProperty(customerJSONObject.getString("centralizedMiningProperty"));
   //            //最终客户名称
   //            customerOrder.setFinalCustomerName(customerJSONObject.getString("finalCustomerName"));
   //            //销售件描述
   //            customerOrder.setSalesPartName(customerOrderJSONObject.getString("partDesc"));
   //
   //            if (customerOrder.getId() == null) {
   //               // 零件是否推送
   //               customerOrder.setOtcPartSync(false);
   //               // 默认为N 数据字典为:N:普通,S:样品,D:研发
   //               customerOrder.setManufactureAttr("N");
   //               //是否关联工艺文件为否
   //               customerOrder.setIsDocument(false);
   //               //状态为 如果采集性质 非采集和 省采集  状态位编辑  否则为 零件待选
   //               if (customerOrder.getCentralizedMiningProperty().equals("非集采") || customerOrder.getCentralizedMiningProperty().equals("省集采")) {
   //                  customerOrder.setCoState(CustomerOrderStateStringValues.UNIEDIT);
   //               } else {
   //                  customerOrder.setCoState(CustomerOrderStateStringValues.PARTUNCHECKED);
   //               }
   //               if (org.apache.commons.lang3.StringUtils.equals("已下达", otcMainStatus)) {
   //                  customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK);
   //                  customerOrder.setOtcPartSync(Boolean.TRUE);
   //               }
   //               //审核状态为 01draft 草稿
   //               customerOrder.setIsAudit(AuditStateStringValues.DRAFT);
   //               baseMapper.insert(customerOrder);
   //            } else {
   //               // 如果状态为零件待选,且销售件号不为空,更新状态
   //               if (StrUtil.isNotBlank(customerOrder.getSalesPartNo()) && CustomerOrderStateStringValues.PARTUNCHECKED.equals(customerOrder.getCoState())) {
   //                  customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK);
   //                  customerOrder.setOtcPartSync(Boolean.TRUE);
   //               }
   //               baseMapper.updateById(customerOrder);
   //            }
   //            addCustomerPara(customerJSONObject, customerOrderJSONObject, customerOrder, orderParamList);
   //            num += 1;
   //         }
   //      }
   //   } catch (Exception e) {
   //      throw new RuntimeException("订单行数据获取失败,原因:" + e.getMessage());
   //   }
   //   return num;
   //}
   /**
    * @param jsonObjMain    主表的jsonObj
@@ -1635,15 +1876,14 @@
   @Override
   public R uploadProcessConfigFile(MultipartFile file, String orderNumber, String lineNumber) {
      String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename());
      String fileName = FileUtil.extName(file.getOriginalFilename());
      try {
         minioTemplate.putObject(ossProperties.getBucketName(), fileName, file.getInputStream());
         OrderProcessConfigFile configFile = new OrderProcessConfigFile();
         configFile.setFileName(fileName);
         configFile.setOriginalFileName(file.getOriginalFilename());
         configFile.setOrderNumber(orderNumber);
         configFile.setLineNumber(lineNumber);
         configFile.setBucketName(ossProperties.getBucketName());
         configFile.setBucketName(FileSaveUtil.StoreFile(file));
         orderProcessConfigFileMapper.insert(configFile);
         ProcessConfigFileOrderMapping mapping = ProcessConfigFileOrderMapping.builder().configFileId(configFile.getId())
               .orderNumber(orderNumber).lineNumber(lineNumber).build();
@@ -1670,7 +1910,10 @@
   @Override
   public void getFile(String bucket, String fileName, HttpServletResponse response) {
      try (InputStream inputStream = minioTemplate.getObject(bucket, fileName)) {
      try {
         String path = FileSaveUtil.FILE_PATH + bucket;
         InputStream inputStream = new FileInputStream(path);
//         EasyExcel.write(path).sheet().doWrite(null);
         response.setContentType("application/octet-stream; charset=UTF-8");
         IoUtil.copy(inputStream, response.getOutputStream());
      } catch (Exception e) {
@@ -1832,7 +2075,7 @@
         if (StringUtils.isNotBlank(selectTime)) {
            map.put("selectTime", selectTime);
         }
         String str = HttpRequest.get(customerOrderClientConfigure.getOtcHost() + customerOrderClientConfigure.getOtcCusomerUrl())
         String str = HttpRequest.get(customerOrderClientConfigure.getOtcHost() + customerOrderClientConfigure.getOtcCustomerUrl())
               .contentType("application/json")
               .header("Authorization", "Bearer " + token).form(map).execute().body();
         JSONObject result = JSONObject.parseObject(str);