From b9a206a36296477107fd41ce8854511c862edbc8 Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Tue, 29 Aug 2023 11:15:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BB=84?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicdataTeamStaffController.java | 3 +- .../basicdata/dto/BasicdataTeamStaffDTO.java | 4 ++ .../service/IBasicdataTeamStaffService.java | 3 +- .../impl/BasicdataTeamStaffServiceImpl.java | 52 ++++++++++++++----- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataTeamStaffController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataTeamStaffController.java index 039e27042..49783e9a6 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataTeamStaffController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataTeamStaffController.java @@ -16,6 +16,7 @@ */ package com.logpm.basicdata.controller; +import com.logpm.basicdata.dto.BasicdataTeamStaffDTO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -116,7 +117,7 @@ public class BasicdataTeamStaffController extends BladeController { @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入basicdataTeamStaff") - public R submit(@Valid @RequestBody BasicdataTeamStaffEntity basicdataTeamStaff) { + public R submit(@Valid @RequestBody BasicdataTeamStaffDTO basicdataTeamStaff) { return R.status(basicdataTeamStaffService.saveOrUpdateOwn(basicdataTeamStaff)); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataTeamStaffDTO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataTeamStaffDTO.java index 9711281db..d05c332c3 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataTeamStaffDTO.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataTeamStaffDTO.java @@ -20,6 +20,8 @@ import com.logpm.basicdata.entity.BasicdataTeamStaffEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.List; + /** * 班组人员表 数据传输对象实体类 * @@ -31,4 +33,6 @@ import lombok.EqualsAndHashCode; public class BasicdataTeamStaffDTO extends BasicdataTeamStaffEntity { private static final long serialVersionUID = 1L; + private List staffIds; + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataTeamStaffService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataTeamStaffService.java index 57cd44834..4a8bf497c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataTeamStaffService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataTeamStaffService.java @@ -17,6 +17,7 @@ package com.logpm.basicdata.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.logpm.basicdata.dto.BasicdataTeamStaffDTO; import com.logpm.basicdata.entity.BasicdataTeamStaffEntity; import com.logpm.basicdata.vo.BasicdataTeamStaffVO; import com.logpm.basicdata.excel.BasicdataTeamStaffExcel; @@ -49,5 +50,5 @@ public interface IBasicdataTeamStaffService extends BaseService exportBasicdataTeamStaff(Wrapper queryWrapper); - Boolean saveOrUpdateOwn(BasicdataTeamStaffEntity basicdataTeamStaff); + Boolean saveOrUpdateOwn(BasicdataTeamStaffDTO basicdataTeamStaff); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTeamStaffServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTeamStaffServiceImpl.java index a8f7933d1..f08b400fd 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTeamStaffServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTeamStaffServiceImpl.java @@ -16,10 +16,11 @@ */ package com.logpm.basicdata.service.impl; +import com.baomidou.mybatisplus.core.toolkit.BeanUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.basicdata.dto.BasicdataTeamStaffDTO; import com.logpm.basicdata.entity.BasicdataTeamStaffEntity; -import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.service.IBasicdataWarehouseService; import com.logpm.basicdata.vo.BasicdataTeamStaffVO; import com.logpm.basicdata.excel.BasicdataTeamStaffExcel; @@ -27,10 +28,16 @@ import com.logpm.basicdata.mapper.BasicdataTeamStaffMapper; import com.logpm.basicdata.service.IBasicdataTeamStaffService; import lombok.AllArgsConstructor; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.system.entity.User; +import org.springblade.system.feign.IUserClient; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseServiceImpl; + +import java.util.ArrayList; import java.util.List; /** @@ -45,6 +52,8 @@ public class BasicdataTeamStaffServiceImpl extends BaseServiceImpl selectBasicdataTeamStaffPage(IPage page, BasicdataTeamStaffVO basicdataTeamStaff) { return page.setRecords(baseMapper.selectBasicdataTeamStaffPage(page, basicdataTeamStaff)); @@ -66,27 +75,42 @@ public class BasicdataTeamStaffServiceImpl extends BaseServiceImplquery().lambda().eq(BasicdataWarehouseEntity::getId, basicdataTeamStaff.getWarehouseId())); - if(ObjectUtils.isNull(one)){ - throw new ServiceException("仓库数据异常!!"); - } - if(ObjectUtils.isNotNull(basicdataTeamStaff.getId())){ + + /*if(ObjectUtils.isNotNull(basicdataTeamStaff.getId())){ //修改 basicdataTeamStaff.setDepartment(one.getDepartment()); basicdataTeamStaff.setDepartmentName(one.getDepartmentName()); this.updateById(basicdataTeamStaff); return true; - }else{ - //添加 - basicdataTeamStaff.setDepartment(one.getDepartment()); - basicdataTeamStaff.setDepartmentName(one.getDepartmentName()); - this.save(basicdataTeamStaff); - return true; - } + }else{*/ + + + //添加 + List list = new ArrayList<>(); + basicdataTeamStaff.getStaffIds().forEach(i ->{ + //查询是否已存在 + List list1 = baseMapper.selectList(Wrappers.query().lambda() + .eq(BasicdataTeamStaffEntity::getStaffId, i) + .eq(BasicdataTeamStaffEntity::getWarehouseId, basicdataTeamStaff.getWarehouseId()) + .eq(BasicdataTeamStaffEntity::getIsDeleted,0) + ); + if(list1.size() > 0){ + throw new ServiceException("人员已存在,不能重复添加!"); + } + R userR = userClient.userInfoById(Long.valueOf(i)); + BasicdataTeamStaffEntity entity = new BasicdataTeamStaffEntity(); + BeanUtil.copyProperties(basicdataTeamStaff,entity); + entity.setStaffId(Long.valueOf(i)); + entity.setName(userR.getData().getName()); + list.add(entity); + }); + + return this.saveBatch(list); +// } } From 73e3c8a4dd895dfe6323caf2a87a227dca4b12f2 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" <123456> Date: Tue, 29 Aug 2023 12:26:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=E4=BF=AE=E6=AD=A3=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=9B=B6=E6=8B=85=E6=95=B0=E6=8D=AE=E5=88=B0?= =?UTF-8?q?=E6=96=B0=E7=B3=BB=E7=BB=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../warehouse/entity/WarehouseWayBillDetail.java | 2 +- .../feign/DistributionStockArticleClient.java | 2 +- .../warehouse/receiver/WaybillDataHandler.java | 16 ++++++++++------ .../impl/WarehouseWaybillServiceImpl.java | 9 +++++---- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWayBillDetail.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWayBillDetail.java index c9443f0af..5e5e9f9b1 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWayBillDetail.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWayBillDetail.java @@ -13,7 +13,7 @@ public class WarehouseWayBillDetail extends BaseEntity { /** 运单号 */ @ApiModelProperty(name = "运单号",notes = "") - private String waybillCode; + private String waybillNo; /** 运单号id */ @ApiModelProperty(name = "运单id",notes = "") diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index 84e13d229..01050a7cf 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -93,7 +93,7 @@ public class DistributionStockArticleClient implements IDistributionStockArticle @Override public DistributionStockArticleEntity findByOrderSelfNum(String waybillNo) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_self_numbering",waybillNo); + queryWrapper.eq("waybill_number",waybillNo); return distributionStockArticleService.getOne(queryWrapper); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java index 0e4a9b8fd..9f3fbf241 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java @@ -30,16 +30,20 @@ public class WaybillDataHandler { @RabbitHandler public void waybillDataHandler(Map map, Message message, Channel channel) { - // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 + // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 final long deliveryTag = message.getMessageProperties().getDeliveryTag(); String msg = new String(message.getBody()); WaybillDTO waybillDTO = (WaybillDTO) map.get("messageData"); - log.info("##################waybillDataHandler: 处理开单零单数据 waybillDTO={}",waybillDTO); + log.info("##################waybillDataHandler: 处理开单零单数据 waybillDTO={}", waybillDTO); - if(!Objects.isNull(waybillDTO)) { - warehouseWaybillService.waybillDataHandler(waybillDTO); - }else { - log.info("##################waybillDataHandler: 处理开单零单数据 失败 WaybillNo={} ",waybillDTO.getWaybillNo()); + if (!Objects.isNull(waybillDTO)) { + try { + warehouseWaybillService.waybillDataHandler(waybillDTO); + } catch (Exception e) { + log.error(e.getMessage()); + } + } else { + log.info("##################waybillDataHandler: 处理开单零单数据 失败 WaybillNo={} ", waybillDTO.getWaybillNo()); } } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index a4ec24d18..8569185e9 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java @@ -87,12 +87,12 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl waybillQueryWrapper = new QueryWrapper<>(); waybillQueryWrapper.eq("waybill_no", waybillNo); @@ -114,7 +114,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl