From 0d214b98f1a5c831da9dbc9e23581c2f5b682d07 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" <123456> Date: Sun, 8 Oct 2023 14:03:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=BF=97=E9=82=A6=E5=8C=85?= =?UTF-8?q?=E4=BB=B6=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AsyncDataServiceImpl.java | 10 +-- .../java/com/logpm/factory/TestService.java | 83 +++++++++++++++++++ 2 files changed, 88 insertions(+), 5 deletions(-) diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java index 979510dbb..d025e18f6 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java @@ -889,7 +889,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService { advanceEntity.setOrderTypeName(zbReceiptEntity.getOrderType()); //订单类型名称 可以为空 advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空 advanceEntity.setType(FactoryConstant.ZHIBANG); - int num = mathTotalOrderPackageNum(serviceNumEntity.getCustomerCode(), zbOrderPackageEntityList); + int num = mathTotalOrderPackageNum(serviceNumEntity.getRelationOrderCode(), zbOrderPackageEntityList); advanceEntity.setTotal(num); //订单总数据 advanceEntity.setMctsTruck(StringUtil.isBlank(zbReceiptEntity.getDepartCode()) ? "" : zbReceiptEntity.getDepartCode()); //车次 advanceEntity.setMctsTruckNo(zbReceiptEntity.getCarNumber()); @@ -945,14 +945,14 @@ public class AsyncDataServiceImpl implements IAsyncDataService { /** * 按照订单合同号统计下面的包件数量 * - * @param orderNum - * @param zbOrderPackageEntityList - * @return + * @param orderNum 订单号 + * @param zbOrderPackageEntityList 订单包间集合 + * @return int */ private int mathTotalOrderPackageNum(String orderNum, List zbOrderPackageEntityList) { int totalPackageNum = 0; for (ZbOrderPackageEntity entity : zbOrderPackageEntityList) { - if (entity.getCustomerCode().equals(orderNum)) { + if (entity.getRelationOrderCode().equals(orderNum)) { totalPackageNum++; } } diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index 7c5f94eef..3d315880f 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java @@ -11,6 +11,7 @@ import com.alibaba.excel.metadata.Sheet; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.nacos.common.utils.MD5Utils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper; @@ -20,6 +21,7 @@ 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.MtOrderLogEntity; import com.logpm.factory.mt.entity.MtPushData; import com.logpm.factory.mt.service.IMtFactoryDataService; import com.logpm.factory.mt.service.IMtFactoryOrderMainService; @@ -31,6 +33,7 @@ import com.logpm.factory.oupai.service.IFactoryPackageService; import com.logpm.factory.oupai.service.IOuPaiFactoryService; import com.logpm.factory.oupai.service.impl.OuPaiFactoryServiceImpl; import com.logpm.factory.pan.service.IPanFactoryDataService; +import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; import com.logpm.factory.zb.dto.ZBReceiptDTO; import com.logpm.factory.zb.entity.ZbFactoryLogEntity; @@ -69,6 +72,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import java.io.*; +import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -361,5 +365,84 @@ public class TestService { zbFactoryLogService.save(zbFactoryLogEntity); } + + @Test + public void test10() throws NoSuchAlgorithmException { + // 重新获取 + String appkey = "HuiTong"; + String appsecret = "HT20230822140820"; + String userid = "5003"; + String userpwd = "mt123456*"; + long time = new Date().getTime(); + + String sign = MD5Utils.md5Hex((appkey + appsecret + time).getBytes(StandardCharsets.UTF_8)); + String pwd = MD5Utils.md5Hex(userpwd.getBytes(StandardCharsets.UTF_8)); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("APPKEY", appkey); + jsonObject1.put("SIGN", sign); + jsonObject1.put("USERID", userid); + jsonObject1.put("USERPWD", pwd); + jsonObject1.put("Timestamp", time); + String result = HttpRequest.post("http://www.mengtian.cn/Auth/Validate") + .header("Content-Type", "application/json").body(jsonObject1.toJSONString()).timeout(5 * 1000) + .execute() + .body(); + //获取的结果转成json对象 + JSONObject jsonObject = JSONObject.parseObject(result); + System.out.println(jsonObject.toJSONString()); + + Integer code = jsonObject.getInteger("Result"); + String access_token = jsonObject.getString("Data"); + System.out.println(access_token); + } + + @Test + public void test11() throws NoSuchAlgorithmException { + + + String url="http://www.mengtian.cn/ZXCFaHuoDan/QueRenShouHuo"; + String appkey = "HuiTong"; + String appsecret = "HT20230822140820"; + String userid = "5003"; + String userpwd = "mt123456*"; + // 发送数据 + String data ="{\"发货单编号\":\"HYLEJIA-230983\",\"确认收货时间\":\"2023-10-01 16:15:38\"}"; + + //先获取token + String token = "AMiwQcwT33JksqEfDeRFbjgRieAUo/ztCQWLfpFiEqZpvUXrv0OW1GcJPFhE+ZdmPYQo+K6rUwoJ53u58Bv85A=="; + //处理逻辑 + String result = HttpRequest.post(url) + .header("APPKEY", appkey) + .header("Authorization", token) + .header("USERID", userid) + .header("USERPWD", MD5Utils.md5Hex(userpwd.getBytes(StandardCharsets.UTF_8))) + .header("Content-Type", "application/json") + .body(data).timeout(5 * 1000) + .execute().body(); + + // 保存数据到数据库 +// MtOrderLogEntity mtOrderLogEntity = new MtOrderLogEntity(); +// mtOrderLogEntity.setReqArgs(data); +// mtOrderLogEntity.setResBody(result); +// mtOrderLogEntity.setType(type); +// mtOrderLogEntity.setRefCode(refCode); +// mtOrderLogService.save(mtOrderLogEntity); + + //把结果字符串转为json对象 + JSONObject jsonObject = JSONObject.parseObject(result); + + System.out.println(jsonObject); + if (!Objects.isNull(jsonObject)) { + Integer code = jsonObject.getInteger("Result"); + String message = jsonObject.getString("Message"); + } + + } + + @Test + public void test12(){ + + } + }