Browse Source

1.修改志邦包件数据统计bug

training
pref_mail@163.com 1 year ago
parent
commit
0d214b98f1
  1. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java
  2. 83
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

10
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<ZbOrderPackageEntity> zbOrderPackageEntityList) {
int totalPackageNum = 0;
for (ZbOrderPackageEntity entity : zbOrderPackageEntityList) {
if (entity.getCustomerCode().equals(orderNum)) {
if (entity.getRelationOrderCode().equals(orderNum)) {
totalPackageNum++;
}
}

83
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(){
}
}

Loading…
Cancel
Save