From 27879ae8c1df7ff014858456b17996cf62d34f9b Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期三, 15 十一月 2023 15:34:11 +0800 Subject: [PATCH] 销售订单-修改3 --- mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java | 394 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 318 insertions(+), 76 deletions(-) diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java index bd34f17..085c240 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java +++ b/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涓富琛ㄧ姸鎬佹槸鍙栨秷閭e氨璺宠繃鎴栬�呭垹闄ゅ凡缁忓悓姝ョ殑鏁版嵁 - 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;//鍙幏鍙朞TC涓凡瀹℃牳鍙婂凡涓嬭揪鐨勮鍗曪紝涓旀墍灞炲叕鍙镐笉鏄腑澶╃鎶� + if (!OTC_MAIN_STATUS_TRANSMIT.equals(otcMainStatus)) {//null == affiliatedCompany || !Arrays.asList("宸蹭笅杈�").contains(otcMainStatus) /*|| affiliatedCompany.equals("姹熻嫃涓ぉ绉戞妧鑲′唤鏈夐檺鍏徃")*/) { + continue;//鍙幏鍙朞TC涓凡瀹℃牳鍙婂凡涓嬭揪鐨勮鍗曪紝 } //瀹㈡埛缂栧彿 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()); - //閿�鍞暟閲忓師鍏圤TC鐨勫崟浣� - 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"); + // //涓昏〃鍦∣TC涓殑鐘舵�� + // 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涓富琛ㄧ姸鎬佹槸鍙栨秷閭e氨璺宠繃鎴栬�呭垹闄ゅ凡缁忓悓姝ョ殑鏁版嵁 + // 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;//鍙幏鍙朞TC涓凡瀹℃牳鍙婂凡涓嬭揪鐨勮鍗曪紝涓旀墍灞炲叕鍙镐笉鏄腑澶╃鎶� + // } + // //瀹㈡埛缂栧彿 + // 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")); + // //姝f湰鐘舵�� + // customer.setOriginalContractStatus(customerJSONObject.getString("originalStatus")); + // //鍚堝悓姝f湰鐘舵�� + // 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(); + // } + // //濡傛灉杩欎釜鍗曞瓙鍦∣TC涓彇娑堢姸鎬� 閭e氨鍒犻櫎 + // if (otcOrderStatus.equals("宸插彇娑�")) { + // if (customerOrder.getId() != null) { + // baseMapper.deleteById(customerOrder.getId()); + // } + // continue; + // } + // //OTC鍚堝悓鍙蜂富琛╥d + // 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()); + // //閿�鍞暟閲忓師鍏圤TC鐨勫崟浣� + // 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锛氭櫘閫氾紝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 涓昏〃鐨刯sonObj @@ -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,9 @@ @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); response.setContentType("application/octet-stream; charset=UTF-8"); IoUtil.copy(inputStream, response.getOutputStream()); } catch (Exception e) { @@ -1832,7 +2074,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); -- Gitblit v1.9.3