Browse Source

Merge branch 'dev' into pre-production

newStockUp
pref_mail@163.com 1 year ago
parent
commit
134aef14bf
  1. 3
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/zb/entity/ZbOrderPackageEntity.java
  2. 31
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java
  3. 16
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java
  4. 38
      blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/impl/ZbFactoryDataServiceImpl.java

3
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/zb/entity/ZbOrderPackageEntity.java

@ -189,5 +189,8 @@ public class ZbOrderPackageEntity extends BaseEntity {
@ApiModelProperty(name = "预留5", notes = "")
private String reserve5;
//2023-09-30 00:20:00
// @ApiModelProperty(name = "入库扫描状态", notes = "")
// private Integer rukuScanStatus;
}

31
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java

@ -851,6 +851,22 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
return advanceEntity;
}
/**
* 获取订单对象 加入了缓存
*
* @param orderSelfNum
* @return
*/
private AdvanceEntity findAdvanceEntityUseCacheByOrderSelfNumAndReceiptId(Long receiptId,String orderSelfNum,String departCode) {
String key = AdvanceEntity.class.getName() + ":"+receiptId + orderSelfNum + ":" + departCode;
AdvanceEntity advanceEntity = bladeRedis.get(key);
// if (ObjectUtils.isNull(advanceEntity)) {
//// advanceEntity = iAdvanceClient.getEntityByMctsTruck(orderSelfNum,departCode);
//// bladeRedis.setEx(key, advanceEntity, 12 * 60 * 60L);
// }
return advanceEntity;
}
private AdvanceEntity saveAdvanceInfor(ZbOrderPackageEntity serviceNumEntity, List<ZbOrderPackageEntity> zbOrderPackageEntityList) {
Long orderId = serviceNumEntity.getId();
log.info("#########handlerDataToHt: 当前处理的订单id={}", orderId);
@ -858,14 +874,15 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
// 查询订单对应的发货单
ZbReceiptEntity zbReceiptEntity = findZbReceiptEntityUseCacheById(serviceNumEntity.getReceiptId());
AdvanceEntity advanceEntity = findAdvanceEntityUseCacheByOrderSelfNum(serviceNumEntity.getRelationOrderCode(),zbReceiptEntity.getDepartCode());
AdvanceEntity advanceEntity = findAdvanceEntityUseCacheByOrderSelfNumAndReceiptId(serviceNumEntity.getReceiptId(),serviceNumEntity.getRelationOrderCode(),zbReceiptEntity.getDepartCode());
if (ObjectUtils.isNotNull(advanceEntity)) {
return advanceEntity;
}
//添加订单信息
advanceEntity = new AdvanceEntity();
advanceEntity = new AdvanceEntity();
advanceEntity.setOrderSelfNum(StringUtil.isBlank(serviceNumEntity.getRelationOrderCode()) ? "" : serviceNumEntity.getRelationOrderCode()); //订单自编号
advanceEntity.setSiteName(""); // 基地
advanceEntity.setArea(""); // 区域
@ -889,8 +906,8 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
advanceEntity.setCustomerPhone(StringUtil.isBlank(serviceNumEntity.getReceiverMobile()) ? "" : serviceNumEntity.getReceiverMobile()); // 顾客电话
advanceEntity.setCustomerRoad(StringUtil.isBlank(serviceNumEntity.getReceiverAddress()) ? "" : serviceNumEntity.getReceiverAddress());//顾客地址
advanceEntity.setSystemType("线上"); //订单类型
advanceEntity.setStoreNo(""); //门店编码
advanceEntity.setStoreName(""); //门店名称
advanceEntity.setStoreNo(StringUtil.isBlank(serviceNumEntity.getCustomerCode()) ? "" : serviceNumEntity.getCustomerCode()); //门店编码
advanceEntity.setStoreName(serviceNumEntity.getCustomerName()); //门店名称
advanceEntity.setSerialKey(""); //序列号
advanceEntity.setServiceNum(StringUtil.isBlank(serviceNumEntity.getPlatformOrderCode()) ? "" : serviceNumEntity.getPlatformOrderCode()); //服务号
advanceEntity.setMatingCode("");//齐套模式 可以为空
@ -915,6 +932,12 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
advanceEntity.setDeleteAdministratorsId(0);//删除用户
Integer advanceId = iAdvanceClient.addAdvanceClient(advanceEntity);
advanceEntity.setId(advanceId);
String key = AdvanceEntity.class.getName() + ":"+serviceNumEntity.getReceiptId() + serviceNumEntity.getRelationOrderCode() + ":" + zbReceiptEntity.getDepartCode();
// 加入缓存 1小时的缓存
bladeRedis.setEx(key, advanceEntity, 60*60L);
return advanceEntity;
}

16
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java

@ -96,14 +96,14 @@ public class OrderStatusHandler {
}
break;
case FactoryConstant.ZHIBANG:
// r = zbFactoryDataService.handleStatusData(orderStatusDTO);
// int resultCode = r.getCode();
// if (resultCode == 400 || resultCode == 200) {
// log.info("##################orderStatusHandler: 该条数据不用处理 orderNo={}", orderSelfNum);
//// channel.basicAck(deliveryTag,true);
// } else {
// throw new CustomerException(resultCode, r.getMsg());
// }
r = zbFactoryDataService.handleStatusData(orderStatusDTO);
int resultCode = r.getCode();
if (resultCode == 400 || resultCode == 200) {
log.info("##################orderStatusHandler: 该条数据不用处理 orderNo={}", orderSelfNum);
// channel.basicAck(deliveryTag,true);
} else {
throw new CustomerException(resultCode, r.getMsg());
}
break;
default:
log.info("##################orderStatusHandler: 未知品牌 type={}", type);

38
blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/impl/ZbFactoryDataServiceImpl.java

@ -149,15 +149,35 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService {
return Resp.fail(400, "发车单信息不存在");
}
//2023-09-30 00:20:00查询入库单对应的所有包件
// QueryWrapper<ZbOrderPackageEntity> queryWrapper1 = new QueryWrapper<>();
// queryWrapper1.eq("receipt_id",receiptId);
// List<ZbOrderPackageEntity> details = orderPackageService.list(queryWrapper1);
//查询拼接body
JSONArray detailsArray = new JSONArray();
JSONObject detailObject = new JSONObject();
detailObject.put("lineNo",orderPackageEntity.getLineNo());
detailObject.put("packageCode",orderPackageEntity.getPackageCode());
detailObject.put("inventoryStatus","已入库");
detailObject.put("inventoryStatus",orderPackageEntity.getInventoryStatus());
detailObject.put("qty",orderPackageEntity.getPlanQty());
detailObject.put("scanFlag",1);
JSONArray detailsArray = new JSONArray();
detailsArray.add(detailObject);
// for(ZbOrderPackageEntity entity:details){
// String packageCode = entity.getPackageCode();
// if(unitNo.equals(packageCode)){
// entity.setRukuScanStatus(1);
// orderPackageService.updateById(entity);
// }
// JSONObject detailObject = new JSONObject();
// detailObject.put("lineNo",entity.getLineNo());
// detailObject.put("packageCode",packageCode);
// detailObject.put("inventoryStatus",entity.getInventoryStatus());
// detailObject.put("qty",entity.getPlanQty());
// detailObject.put("scanFlag",entity.getRukuScanStatus());
// detailsArray.add(detailObject);
// }
JSONObject result = new JSONObject();
result.put("taskCode",receiptEntity.getTaskCode());
result.put("companyCode",receiptEntity.getCompanyCode());
@ -165,6 +185,7 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService {
result.put("inWmsTime",operationTime);
result.put("orderType",receiptEntity.getOrderType());
result.put("bizCode",CommonUtil.getUUID());
result.put("details",detailsArray);
Map<String, String> params = new HashMap<>();
@ -181,15 +202,18 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService {
log.info("################### secretkey={}",zbFactoryProperties.getSecretkey());
log.info("################### signMethod={}","md5");
String body = result.toJSONString();
log.info(">################### 格式化之前 body={}",body);
String s = body.replaceAll("\\s+", "");
log.info(">################### 格式化之后 body={}",s);
String sign = QmSignUntil.signTopRequest(params, zbFactoryProperties.getSecretkey(), "md5", s);
String url = getZbUrl(zbFactoryProperties.getUrl()+"/api/edi/ots/in?",params,sign);
R r = sendZbFactoryData(url, s, 1, unitNo);
log.info("################### url={}",url);
R r = sendZbFactoryData(url, body, 1, unitNo);
return r;
}catch (Exception e){
log.error("#################handleStatusData: 推送失败",e);
log.error("#################handleStatusData by zb: 推送失败 {}",e.getMessage());
return R.fail(500,"推送失败");
}
}
@ -206,7 +230,7 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService {
array[0] = key;
array[1] = value;
if (areNotEmpty(array)) {
stringBuilder.append(key).append("=").append(value);
stringBuilder.append(key).append("=").append(value).append("&");
}
}
stringBuilder.append("sign=").append(sign);
@ -259,9 +283,11 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService {
private R sendZbFactoryData(String url, String data, Integer type,String refCode) throws NoSuchAlgorithmException {
log.info("##############sendZbFactoryData 发送数据: {}", data);
//处理逻辑
log.info("##############sendZbFactoryData url: {}", url);
log.info("##############sendZbFactoryData 发送数据: {}", data);
String result = HttpRequest.post(url)
.header("Content-Type", "application/json")
.body(data).timeout(5 * 1000)

Loading…
Cancel
Save