| | |
| | | import com.chinaztt.mes.basic.entity.Part; |
| | | 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; |
| | |
| | | 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.vo.CustomerOrderVO1; |
| | | import com.chinaztt.mes.quality.dto.CustomOrderSyncDTO; |
| | | import com.chinaztt.mes.technology.entity.*; |
| | | import com.chinaztt.mes.technology.mapper.*; |
| | |
| | | |
| | | private WechatProperty wechatProperty; |
| | | |
| | | private UserServiceMapper userServiceMapper; |
| | | |
| | | private final OssProperties ossProperties; |
| | | private final OssTemplate minioTemplate; |
| | |
| | | |
| | | @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) { |
| | |
| | | |
| | | |
| | | @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 |
| | |
| | | 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()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ·»å åè¡¨ä¿¡æ¯ |
| | | * |
| | | * @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.setPartNo(customerOrderJSONObject.getString("partNo")); |
| | | //æ¥æº 0:èªå¨ |
| | | customerOrder.setSourceId("0"); |
| | | //ååå· |
| | | customerOrder.setCustomerOrderNo(customer.getContractNo()); |
| | | //客æ·å· |
| | | customerOrder.setCustomerNo(customer.getCustomerNo()); |
| | | //客æ·åç§° |
| | | customerOrder.setCustomerName(customer.getCustomerName()); |
| | | //å·¥ç¨åç§° |
| | | customerOrder.setEntityName(customer.getEntityName()); |
| | | //æ°é |
| | | customerOrder.setBuyQtyDue(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("orderComment")); |
| | | //产åç±»å |
| | | 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); |
| | | } |
| | | // å¦æç¶æä¸ºé¶ä»¶å¾
éï¼ä¸é¶ä»¶å·ä¸ä¸ºç©ºï¼æ´æ°ç¶æ |
| | | if (StrUtil.isNotBlank(customerOrder.getPartNo()) && CustomerOrderStateStringValues.PARTUNCHECKED.equals(customerOrder.getCoState())) { |
| | | customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK); |
| | | customerOrder.setOtcPartSync(Boolean.TRUE); |
| | | } |
| | | //å®¡æ ¸ç¶æä¸º 01draft è稿 |
| | | customerOrder.setIsAudit(AuditStateStringValues.DRAFT); |
| | | baseMapper.insert(customerOrder); |
| | | } |
| | | addCustomerPara(customerJSONObject, customerOrderJSONObject, customerOrder, orderParamList); |
| | | num += 1; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("订åè¡æ°æ®è·å失败ï¼åå ï¼" + e.getMessage()); |
| | | } |
| | | return num; |
| | | } |
| | | |
| | | ///** |
| | | // * æ·»å ä¸»è¡¨ä¿¡æ¯ |
| | |
| | | * @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; |
| | | } |
| | | //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 |