From 30781d5253c46cd9f1027b8517d72489ee5f2684 Mon Sep 17 00:00:00 2001 From: linfso Date: Sat, 15 Jun 2024 20:15:30 +0800 Subject: [PATCH] md --- .../emis/EmisWaybillAttachmentController.java | 33 ++++++++++++++++--- .../emis/domain/EmisWaybillAttachment.java | 7 ++++ .../domain/enumtype/WaybillAttachType.java | 1 + .../mapper/EmisWaybillAttachmentMapper.java | 4 ++- .../IEmisWaybillAttachmentService.java | 8 ++++- .../EmisWaybillAttachmentServiceImpl.java | 4 +-- .../service/impl/EmisWaybillServiceImpl.java | 33 ++++++++++++++++++- .../mapper/EmisWaybillAttachmentMapper.xml | 11 +++++-- 8 files changed, 89 insertions(+), 12 deletions(-) diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillAttachmentController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillAttachmentController.java index e0efa2216..d51f6d33a 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillAttachmentController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillAttachmentController.java @@ -132,6 +132,17 @@ public class EmisWaybillAttachmentController extends EmisBaseController return AjaxResult.success(emisWaybillAttachmentService.selectEmisWaybillAttachmentById(id)); } + + /** + * APP运单附件上传 + */ + @Log(title = "运单附件上传", businessType = BusinessType.INSERT) + @PostMapping("/uploadWaybillAttachByApp") + public AjaxResult uploadWaybillAttach(@RequestBody EmisWaybillAttachment emisWaybillAttachment) + { + return addAttachment(emisWaybillAttachment); + } + /** * 新增运单附件 */ @@ -140,7 +151,17 @@ public class EmisWaybillAttachmentController extends EmisBaseController @PostMapping public AjaxResult add(@RequestBody EmisWaybillAttachment emisWaybillAttachment) { - // 1-揽收底单 2-签收底单 + return addAttachment(emisWaybillAttachment); + } + + /** + * 上传图片 + * @param emisWaybillAttachment + * @return + */ + public AjaxResult addAttachment(EmisWaybillAttachment emisWaybillAttachment) + { + // 0-GOODS_PIC 1-揽收底单 2-签收底单 if(WaybillAttachType.SIGNED_PIC.typeCode.equals(emisWaybillAttachment.getAttachType())){ // 检查运单是否签收,如果没有签收需要做图片签收 EmisWaybill waybill=emisBaseService.getWaybillByBillCode(emisWaybillAttachment.getBillCode()); @@ -166,7 +187,7 @@ public class EmisWaybillAttachmentController extends EmisBaseController } */ - if(WaybillStatus.SIGNED.statusCode.equals(waybill.getWaybillStatus())) + if(!WaybillStatus.SIGNED.statusCode.equals(waybill.getWaybillStatus())) { ScanInfo scanInfo = new ScanInfo(); @@ -183,7 +204,6 @@ public class EmisWaybillAttachmentController extends EmisBaseController scanDataList.add(scanDateItem); scanInfo.setScanData(scanDataList); - try { emisTmsScanRecordService.scan(scanInfo); } catch (EmisBizError emisBizError) { @@ -200,8 +220,11 @@ public class EmisWaybillAttachmentController extends EmisBaseController return toAjax(emisWaybillAttachmentService.insertEmisWaybillAttachment(emisWaybillAttachment)); } - - }else { + } + else if(WaybillAttachType.GOODS_PIC.typeCode.equals(emisWaybillAttachment.getAttachType())){ + return toAjax(emisWaybillAttachmentService.insertEmisWaybillAttachment(emisWaybillAttachment)); + } + else { return toAjax(emisWaybillAttachmentService.insertEmisWaybillAttachment(emisWaybillAttachment)); } } diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisWaybillAttachment.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisWaybillAttachment.java index dc283d607..359ad4e28 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisWaybillAttachment.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisWaybillAttachment.java @@ -33,6 +33,13 @@ public class EmisWaybillAttachment extends BaseEntity { private static final long serialVersionUID = 1L; + /* + { + "billCode":"运单号", + "attachType":"0-商品图片 1-寄件底单 2-签收底单 3-清关文件", + "fileUrl":"文件url" + } + */ /* id */ private Long id; /* 运单id */ diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/WaybillAttachType.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/WaybillAttachType.java index 826190db2..26e5e6e64 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/WaybillAttachType.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/WaybillAttachType.java @@ -2,6 +2,7 @@ package com.xdadan.erp.emis.domain.enumtype; public enum WaybillAttachType { + GOODS_PIC("0","货物图片"), GOT_PIC("1","寄件底单"), SIGNED_PIC("2","签收底单"), DECLEAR_PIC("3","报关文件"), diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillAttachmentMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillAttachmentMapper.java index a00951d87..05d6bb432 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillAttachmentMapper.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillAttachmentMapper.java @@ -13,6 +13,8 @@ package com.xdadan.erp.emis.mapper; import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xdadan.erp.emis.domain.EmisWaybillAttachment; +import org.apache.ibatis.annotations.Param; + /** * @ClassName EmisWaybillAttachmentMapper * @Description

运单附件 Mapper 接口

@@ -69,5 +71,5 @@ public interface EmisWaybillAttachmentMapper extends BaseMapper attachmentList = new ArrayList(); + EmisWaybillAttachment goodsPicAttachment = new EmisWaybillAttachment(); + goodsPicAttachment.setAttachType(WaybillAttachType.GOODS_PIC.typeCode); + goodsPicAttachment.setBillCode(emisWaybillSave.getBillCode()); + goodsPicAttachment.setFileUrl(emisWaybillSave.getGoodsPics()); + attachmentList.add(goodsPicAttachment); + emisWaybillSave.setAttachmentList(attachmentList); + } + } + + // 插入附件信息 if(!CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){ + // 商品附件图片插入到附件 List attachmentList=emisWaybillSave.getAttachmentList(); for (EmisWaybillAttachment attachmentItem:attachmentList) { attachmentItem.setWaybillId(emisWaybillSave.getId()); + attachmentItem.setBillCode(emisWaybillSave.getBillCode()); emisWaybillAttachmentMapper.insertEmisWaybillAttachment(attachmentItem); } } @@ -755,7 +771,22 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } } - // 插入附件信息 + // 保存货物图片 + if(!StringUtils.isEmpty(emisWaybillSave.getGoodsPics())){ + // 删除图片插入新图片 + emisWaybillAttachmentMapper.deleteByBillCodeAndAttachType(emisWaybillSave.getBillCode(),WaybillAttachType.GOODS_PIC.typeCode); + + EmisWaybillAttachment goodsPicAttachment = new EmisWaybillAttachment(); + goodsPicAttachment.setWaybillId(emisWaybillSave.getId()); + goodsPicAttachment.setAttachType(WaybillAttachType.GOODS_PIC.typeCode); + goodsPicAttachment.setBillCode(emisWaybillSave.getBillCode()); + goodsPicAttachment.setFileUrl(emisWaybillSave.getGoodsPics()); + + emisWaybillAttachmentMapper.insertEmisWaybillAttachment(goodsPicAttachment); + + } + + // 插入其他附件信息 if(!CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){ List attachmentList=emisWaybillSave.getAttachmentList(); for (EmisWaybillAttachment attachmentItem:attachmentList) { diff --git a/emis-biz/src/main/resources/mapper/EmisWaybillAttachmentMapper.xml b/emis-biz/src/main/resources/mapper/EmisWaybillAttachmentMapper.xml index 5af924f4e..1400c0eac 100644 --- a/emis-biz/src/main/resources/mapper/EmisWaybillAttachmentMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisWaybillAttachmentMapper.xml @@ -155,13 +155,20 @@ - delete from emis_waybill_attachment where id = #{id} + update emis_waybill_attachment set del_flag='1' where id = #{id} - delete from emis_waybill_attachment where id in + update emis_waybill_attachment set del_flag='1' where id in #{id} + + + + update emis_waybill_attachment set del_flag='1' where bill_code = #{billCode} and attach_type = #{attachType} + + + \ No newline at end of file