pref_mail@163.com
1 year ago
1 changed files with 168 additions and 129 deletions
@ -1,129 +1,168 @@
|
||||
//package com.logpm.factory;
|
||||
//
|
||||
//import cn.hutool.http.HttpResponse;
|
||||
//import cn.hutool.http.HttpUtil;
|
||||
//import com.alibaba.excel.EasyExcel;
|
||||
//import com.alibaba.excel.EasyExcelFactory;
|
||||
//import com.alibaba.excel.annotation.ExcelProperty;
|
||||
//import com.alibaba.excel.metadata.BaseRowModel;
|
||||
//import com.alibaba.excel.metadata.Sheet;
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.alibaba.fastjson.JSONArray;
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
//import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
//import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
|
||||
//import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
//import com.logpm.factory.comfac.controller.FactoryCommonController;
|
||||
//import com.logpm.factory.comfac.dto.UnloadCarDTO;
|
||||
//import com.logpm.factory.excel.ExcelMode;
|
||||
//import com.logpm.factory.excel.JpDataMode;
|
||||
//import com.logpm.factory.mt.entity.MtFactoryOrderMain;
|
||||
//import com.logpm.factory.mt.entity.MtPushData;
|
||||
//import com.logpm.factory.mt.service.IMtFactoryDataService;
|
||||
//import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
|
||||
//import com.logpm.factory.mt.service.IMtPushDataService;
|
||||
//import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl;
|
||||
//import com.logpm.factory.oupai.service.IOuPaiFactoryService;
|
||||
//import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
|
||||
//import com.logpm.oldproject.entity.AdvanceDetailEntity;
|
||||
//import com.logpm.oldproject.feign.IAdvanceDetailClient;
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import lombok.Data;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.junit.jupiter.api.extension.ExtendWith;
|
||||
//import org.springblade.core.test.BladeBootTest;
|
||||
//import org.springblade.core.test.BladeSpringExtension;
|
||||
//import org.springblade.core.tool.api.R;
|
||||
//import org.springblade.core.tool.api.ResultCode;
|
||||
//import org.springblade.core.tool.utils.StringUtil;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//
|
||||
//import java.io.*;
|
||||
//import java.security.NoSuchAlgorithmException;
|
||||
//import java.text.ParseException;
|
||||
//import java.text.SimpleDateFormat;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
//@ExtendWith(BladeSpringExtension.class)
|
||||
//@BladeBootTest(appName = "logpm-factory-pref", enableLoader = true)
|
||||
//public class TestService {
|
||||
//
|
||||
//
|
||||
//// @Autowired
|
||||
//// private IOuPaiFactoryService ouPaiFactoryService;
|
||||
////
|
||||
////
|
||||
////
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void test2() {
|
||||
//// ouPaiFactoryService.findOuPaiFactoryOrderDTOByCarCarNumber("LCD230505047");
|
||||
//
|
||||
// // 获取Excle
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// File file = new File("F://response.json");
|
||||
//
|
||||
// BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
//
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
//
|
||||
// while (true) {
|
||||
// String ms = reader.readLine();
|
||||
// if (StringUtil.isBlank(ms)) {
|
||||
// break;
|
||||
// }
|
||||
// sb.append(ms);
|
||||
// }
|
||||
// JSONObject object = JSONObject.parseObject(sb.toString());
|
||||
//
|
||||
// JSONArray jsonArray = object.getJSONArray("rows");
|
||||
//
|
||||
// List<JpDataMode> ls = new ArrayList<>();
|
||||
// for (int i = 0; i < jsonArray.size(); i++) {
|
||||
// JpDataMode jpDataMode = new JpDataMode();
|
||||
// JSONObject t = jsonArray.getJSONObject(i);
|
||||
// String yjOrderNo =t.getString("yjOrderNo");
|
||||
// String omsExtYsId =t.getString("omsExtYsId");
|
||||
// String sendTime =t.getString("sendTime");
|
||||
// String goodsNumber =t.getString("goodsNumber");
|
||||
// String scanedNum =t.getString("scanedNum");
|
||||
// String handedNum =t.getString("handedNum");
|
||||
//
|
||||
//
|
||||
// jpDataMode.setOmsExtYsId(omsExtYsId);
|
||||
// jpDataMode.setOrderId(yjOrderNo);
|
||||
// jpDataMode.setGoodsNumber(goodsNumber);
|
||||
// jpDataMode.setSendTime(sendTime);
|
||||
// jpDataMode.setScanedNum(scanedNum);
|
||||
// jpDataMode.setHandedNum(handedNum);
|
||||
//
|
||||
//
|
||||
// ls.add(jpDataMode);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// EasyExcel.write("F:\\11.xlsx").sheet("sheet1").doWrite(ls);
|
||||
//
|
||||
//
|
||||
//
|
||||
// } catch (FileNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
//
|
||||
package com.logpm.factory; |
||||
|
||||
import cn.hutool.http.HttpResponse; |
||||
import cn.hutool.http.HttpUtil; |
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.alibaba.excel.EasyExcelFactory; |
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.metadata.BaseRowModel; |
||||
import com.alibaba.excel.metadata.Sheet; |
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
||||
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper; |
||||
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
import com.logpm.factory.comfac.controller.FactoryCommonController; |
||||
import com.logpm.factory.comfac.dto.UnloadCarDTO; |
||||
import com.logpm.factory.excel.ExcelMode; |
||||
import com.logpm.factory.excel.JpDataMode; |
||||
import com.logpm.factory.mt.entity.MtFactoryOrderMain; |
||||
import com.logpm.factory.mt.entity.MtPushData; |
||||
import com.logpm.factory.mt.service.IMtFactoryDataService; |
||||
import com.logpm.factory.mt.service.IMtFactoryOrderMainService; |
||||
import com.logpm.factory.mt.service.IMtPushDataService; |
||||
import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl; |
||||
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity; |
||||
import com.logpm.factory.oupai.service.IOuPaiFactoryService; |
||||
import com.logpm.factory.pan.service.IPanFactoryDataService; |
||||
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; |
||||
import com.logpm.oldproject.entity.AdvanceDetailEntity; |
||||
import com.logpm.oldproject.feign.IAdvanceDetailClient; |
||||
import com.rabbitmq.client.Channel; |
||||
import lombok.Data; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.junit.jupiter.api.extension.ExtendWith; |
||||
import org.springblade.common.utils.CommonUtil; |
||||
import org.springblade.core.test.BladeBootTest; |
||||
import org.springblade.core.test.BladeSpringExtension; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.api.ResultCode; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.amqp.core.Message; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
import java.io.*; |
||||
import java.security.NoSuchAlgorithmException; |
||||
import java.text.ParseException; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.*; |
||||
import java.util.stream.Collectors; |
||||
|
||||
@ExtendWith(BladeSpringExtension.class) |
||||
@BladeBootTest(appName = "logpm-factory-pref", enableLoader = true) |
||||
public class TestService { |
||||
|
||||
|
||||
@Autowired |
||||
private IPanFactoryDataService panFactoryDataService; |
||||
|
||||
|
||||
@Test |
||||
public void test2() { |
||||
// ouPaiFactoryService.findOuPaiFactoryOrderDTOByCarCarNumber("LCD230505047");
|
||||
|
||||
// 获取Excle
|
||||
|
||||
try { |
||||
|
||||
File file = new File("F://response.json"); |
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file)); |
||||
|
||||
StringBuffer sb = new StringBuffer(); |
||||
|
||||
while (true) { |
||||
String ms = reader.readLine(); |
||||
if (StringUtil.isBlank(ms)) { |
||||
break; |
||||
} |
||||
sb.append(ms); |
||||
} |
||||
JSONObject object = JSONObject.parseObject(sb.toString()); |
||||
|
||||
JSONArray jsonArray = object.getJSONArray("rows"); |
||||
|
||||
List<JpDataMode> ls = new ArrayList<>(); |
||||
for (int i = 0; i < jsonArray.size(); i++) { |
||||
JpDataMode jpDataMode = new JpDataMode(); |
||||
JSONObject t = jsonArray.getJSONObject(i); |
||||
String yjOrderNo = t.getString("yjOrderNo"); |
||||
String omsExtYsId = t.getString("omsExtYsId"); |
||||
String sendTime = t.getString("sendTime"); |
||||
String goodsNumber = t.getString("goodsNumber"); |
||||
String scanedNum = t.getString("scanedNum"); |
||||
String handedNum = t.getString("handedNum"); |
||||
|
||||
|
||||
jpDataMode.setOmsExtYsId(omsExtYsId); |
||||
jpDataMode.setOrderId(yjOrderNo); |
||||
jpDataMode.setGoodsNumber(goodsNumber); |
||||
jpDataMode.setSendTime(sendTime); |
||||
jpDataMode.setScanedNum(scanedNum); |
||||
jpDataMode.setHandedNum(handedNum); |
||||
|
||||
|
||||
ls.add(jpDataMode); |
||||
} |
||||
|
||||
|
||||
EasyExcel.write("F:\\11.xlsx").sheet("sheet1").doWrite(ls); |
||||
|
||||
|
||||
} catch (FileNotFoundException e) { |
||||
e.printStackTrace(); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
@Test |
||||
public void test3() throws IOException { |
||||
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
|
||||
|
||||
StringBuffer sb = new StringBuffer(); |
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader("F:\\json.txt")); |
||||
|
||||
while(reader.ready()) { |
||||
String te =reader.readLine(); |
||||
if(StringUtil.isBlank(te)){ |
||||
break; |
||||
} |
||||
sb.append(te); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString()); |
||||
JSONArray jsonArray = jsonObject.getJSONArray("value"); |
||||
for (int i = 0; i < jsonArray.size(); i++) { |
||||
JSONObject valueObject = jsonArray.getJSONObject(i); |
||||
JSONArray packages = valueObject.getJSONArray("Packages"); |
||||
for (int j = 0; j < packages.size(); j++) { |
||||
JSONObject packageJSON = packages.getJSONObject(j); |
||||
String packageStatus = packageJSON.getString("PackageStatus"); |
||||
String orderPackageCode = packageJSON.getString("Code"); |
||||
String receivingTime = packageJSON.getString("CreateTime"); |
||||
if ("已收货".equals(packageStatus)) { |
||||
//真正的处理需要的数据
|
||||
try { |
||||
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
Loading…
Reference in new issue