Browse Source

fix:

增加分布式事务
pull/30/head
pref_mail@163.com 12 months ago
parent
commit
a2a33841f3
  1. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  2. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/TrunkLineApplication.java
  3. 16
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/launcher/TrunklineLauncherServiceImpl.java
  4. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  5. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java
  6. 5
      blade-service/pom.xml

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -6579,6 +6579,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
orderMap.put("合计数量", tn);
orderMap.put("产品明细", numObj);
orderMap.put("产品明细长度", numObj.size());
//通过订单id和预约id查询对应包件的物料信息
List<String> materialNameStrList = distributionReservationMapper.getMaterialNameByStockArticleIdAndReservationId(stockArticleId, reservationId);

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/TrunkLineApplication.java

@ -19,6 +19,7 @@ package com.logpm.trunkline;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.transaction.annotation.SeataCloudApplication;
/**
* Demo启动器

16
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/launcher/TrunklineLauncherServiceImpl.java

@ -16,6 +16,7 @@
*/
package com.logpm.trunkline.launcher;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.auto.service.AutoService;
import org.springblade.core.launch.constant.NacosConstant;
import org.springblade.core.launch.service.LauncherService;
@ -41,6 +42,21 @@ public class TrunklineLauncherServiceImpl implements LauncherService {
PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].data-id", NacosConstant.dataId(appName, profile));
PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].group", NacosConstant.NACOS_CONFIG_GROUP);
PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH);
// 分布式事物
// seata注册地址
// PropsUtil.setProperty(props, "seata.service.grouplist.default", LauncherConstant.seataAddr(profile));
//// seata注册group格式
//// PropsUtil.setProperty(props, "seata.tx-service-group", LauncherConstant.seataServiceGroup(appName));
//// seata配置服务group
// PropsUtil.setProperty(props, "seata.service.vgroup-mapping.default_tx_group".concat(LauncherConstant.seataServiceGroup(appName)), LauncherConstant.DEFAULT_MODE);
//// seata注册模式配置
// PropsUtil.setProperty(props, "seata.registry.type", LauncherConstant.NACOS_MODE);
// PropsUtil.setProperty(props, "seata.registry.nacos.server-addr", LauncherConstant.nacosAddr(profile));
// PropsUtil.setProperty(props, "seata.config.type", LauncherConstant.NACOS_MODE);
// PropsUtil.setProperty(props, "seata.config.nacos.server-addr", LauncherConstant.nacosAddr(profile));
// 指定注册IP
// PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1");
// 指定注册端口

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
@ -27,6 +28,7 @@ import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseWaybillClient;
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient;
import com.logpm.warehouse.vo.WarehouseWaybillVO;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.CodeNumConstant;
@ -34,6 +36,7 @@ import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.order.*;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
@ -270,7 +273,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
return R.success("验证成功");
}
@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = ServiceException.class)
@Override
public R openWaybill(OpenOrderDTO openOrderDTO) {
log.info("############openWaybill: 开单开始 openOrderDTO={}",openOrderDTO);
@ -379,6 +382,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setDocumentMakingTime(CommonUtil.StringToDate(openOrderDTO.getOpenOrderDate()));
Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity);
if(!Objects.isNull(waybillId)){
log.info("#################openWaybill: 运单保存成功");
//保存运单货物明细

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java

@ -1077,6 +1077,8 @@ public class WarehouseUpdownTypeApiController {
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
//查询该库位的货物信息
return warehouseUpdownTypeService.findAllAllocationId(myCurrentWarehouse.getId());

5
blade-service/pom.xml

@ -61,6 +61,11 @@
<groupId>org.springblade</groupId>
<artifactId>blade-starter-metrics</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-transaction</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-tenant</artifactId>

Loading…
Cancel
Save