This commit is contained in:
linfso 2024-06-15 20:15:30 +08:00
parent dc7f10a1ce
commit 30781d5253
8 changed files with 89 additions and 12 deletions

View File

@ -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));
}
}

View File

@ -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 */

View File

@ -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","报关文件"),

View File

@ -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 <p> 运单附件 Mapper 接口 </p>
@ -69,5 +71,5 @@ public interface EmisWaybillAttachmentMapper extends BaseMapper<EmisWaybillAttac
public int deleteEmisWaybillAttachmentByIds(Long[] ids);
public int deleteEmisWaybillAttachmentByWaybillId(Long waybillId);
public int deleteByBillCodeAndAttachType(@Param("billCode") String billCode,@Param("attachType") String attachType);
}

View File

@ -67,6 +67,12 @@ public interface IEmisWaybillAttachmentService
*/
public int deleteEmisWaybillAttachmentById(Long id);
/**
* 删除特定的图片
* @param billCode
* @param attachType
* @return
*/
public int deleteByBillCodeAndAttachType(String billCode,String attachType);
public int deleteEmisWaybillAttachmentByWaybillId(Long waybillId);
}

View File

@ -102,9 +102,9 @@ public class EmisWaybillAttachmentServiceImpl implements IEmisWaybillAttachmentS
}
@Override
public int deleteEmisWaybillAttachmentByWaybillId(Long waybillId)
public int deleteByBillCodeAndAttachType(String billCode,String attachType)
{
return emisWaybillAttachmentMapper.deleteEmisWaybillAttachmentByWaybillId(waybillId);
return emisWaybillAttachmentMapper.deleteByBillCodeAndAttachType(billCode,attachType);
}
}

View File

@ -677,11 +677,27 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
}
// 保存货物图片
if(!StringUtils.isEmpty(emisWaybillSave.getGoodsPics())){
if(CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){
List<EmisWaybillAttachment> attachmentList = new ArrayList<EmisWaybillAttachment>();
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<EmisWaybillAttachment> 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<EmisWaybillAttachment> attachmentList=emisWaybillSave.getAttachmentList();
for (EmisWaybillAttachment attachmentItem:attachmentList) {

View File

@ -155,13 +155,20 @@
</update>
<delete id="deleteEmisWaybillAttachmentById" parameterType="Long">
delete from emis_waybill_attachment where id = #{id}
update emis_waybill_attachment set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisWaybillAttachmentByIds" parameterType="String">
delete from emis_waybill_attachment where id in
update emis_waybill_attachment set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByBillCodeAndAttachType">
update emis_waybill_attachment set del_flag='1' where bill_code = #{billCode} and attach_type = #{attachType}
</delete>
</mapper>