DN单的附件会传多个,修改成支持多个附件保存
This commit is contained in:
parent
813afe40a8
commit
e3b3f014a3
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, mom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the foreverwin.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: mom
|
||||
*/
|
||||
|
||||
package com.foreverwin.mom.wms.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* DN单的附件
|
||||
*
|
||||
* @author Snow
|
||||
* @date 2025-01-01 09:33:16
|
||||
*/
|
||||
@Data
|
||||
@TableName("wms_dn_order_file")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "DN单的附件")
|
||||
public class DnOrderFile extends Model<DnOrderFile> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "流水号")
|
||||
private String sid;
|
||||
|
||||
@ApiModelProperty(value = "附件名称")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "附件路径")
|
||||
private String filePath;
|
||||
|
||||
@ApiModelProperty(value = "创建人员")
|
||||
private String createUser;
|
||||
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private LocalDateTime createDate;
|
||||
|
||||
}
|
||||
@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -189,13 +190,13 @@ public class ZWmsDispatchNoteItf extends Model<ZWmsDispatchNoteItf> {
|
||||
* 客户要货附件地址
|
||||
*/
|
||||
@ApiModelProperty(value="客户要货附件地址")
|
||||
private String z003;
|
||||
private JSONArray z003;
|
||||
|
||||
/**
|
||||
* 客户出库附件地址
|
||||
*/
|
||||
@ApiModelProperty(value="客户出库附件地址")
|
||||
private String z004;
|
||||
private JSONArray z004;
|
||||
|
||||
/**
|
||||
* 仓库出库附件地址
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.foreverwin.mom.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -10,8 +12,10 @@ import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.dto.DocumentSaveRequestDTO;
|
||||
import com.foreverwin.mom.wms.entity.*;
|
||||
import com.foreverwin.mom.wms.mapper.DnOrderFileMapper;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsDispatchNoteItfMapper;
|
||||
import com.foreverwin.mom.wms.service.*;
|
||||
import com.foreverwin.mom.wms.util.StringUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -44,6 +48,8 @@ public class ZWmsDispatchNoteItfServiceImpl extends ServiceImpl<ZWmsDispatchNote
|
||||
|
||||
private final ZWmsDispatchNoteDetailItfService zWmsDispatchNoteDetailItfService;
|
||||
|
||||
private final DnOrderFileMapper dnOrderFileMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String saveOrUpdateSapDispatchNote(ZWmsDispatchNoteItf zWmsDispatchNoteItf) {
|
||||
@ -76,8 +82,10 @@ public class ZWmsDispatchNoteItfServiceImpl extends ServiceImpl<ZWmsDispatchNote
|
||||
dnOrder.setExtWarehourseRemarks(zWmsDispatchNoteItf.getName1());
|
||||
dnOrder.setDeliveryPartyAddressd(zWmsDispatchNoteItf.getZShdz());
|
||||
dnOrder.setReFields4(zWmsDispatchNoteItf.getZWldw());
|
||||
dnOrder.setReFields1(zWmsDispatchNoteItf.getZ003());
|
||||
dnOrder.setReFields2(zWmsDispatchNoteItf.getZ004());
|
||||
String file3Path = saveDnOrderFile(zWmsDispatchNoteItf.getZ003());
|
||||
dnOrder.setReFields1(file3Path);
|
||||
String file4Path = saveDnOrderFile(zWmsDispatchNoteItf.getZ004());
|
||||
dnOrder.setReFields2(file4Path);
|
||||
dnOrder.setReFields3(zWmsDispatchNoteItf.getZ005());
|
||||
DnOrder dnOrderSelect = dnOrderService.getById(dnOrder.getHandle());
|
||||
if (dnOrderSelect == null) {
|
||||
@ -313,4 +321,34 @@ public class ZWmsDispatchNoteItfServiceImpl extends ServiceImpl<ZWmsDispatchNote
|
||||
return responseDescription;
|
||||
}
|
||||
}
|
||||
|
||||
private String saveDnOrderFile(JSONArray jsonFile){
|
||||
String sid = "";
|
||||
if(jsonFile!=null && !jsonFile.isEmpty()){
|
||||
sid = StringUtil.createQUID();
|
||||
String user = SecurityUtils.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (int i = 0; i < jsonFile.size(); i++) {
|
||||
JSONObject obj = jsonFile.getJSONObject(i);
|
||||
// "FILE":"合同类型附件10000421-1.pdf:SAP/SD/202501/0010000188/3eda0a74258c72557da388b33.pdf"
|
||||
String fileSrc = obj.getString("FILE");
|
||||
if(StringUtil.notEmpty(fileSrc)){
|
||||
// 从后往前找第一个:符号就行分割
|
||||
int splitFlag = fileSrc.lastIndexOf(":");
|
||||
if(splitFlag>-1){
|
||||
String fileName = fileSrc.substring(0, splitFlag);
|
||||
String filePath = fileSrc.substring(splitFlag+1);
|
||||
DnOrderFile dnOrderFile = new DnOrderFile();
|
||||
dnOrderFile.setSid(sid);
|
||||
dnOrderFile.setFileName(fileName);
|
||||
dnOrderFile.setFilePath(filePath);
|
||||
dnOrderFile.setCreateUser(user);
|
||||
dnOrderFile.setCreateDate(now);
|
||||
dnOrderFileMapper.insert(dnOrderFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sid;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.foreverwin.mom.wms.mapper;
|
||||
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.mom.wms.entity.DnOrderFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* DN单的附件
|
||||
*
|
||||
* @author Snow
|
||||
* @date 2025-01-01 09:33:16
|
||||
*/
|
||||
@Mapper
|
||||
public interface DnOrderFileMapper extends MomBaseMapper<DnOrderFile> {
|
||||
|
||||
}
|
||||
15
mom-wms-db/src/main/resources/mapper/DnOrderFileMapper.xml
Normal file
15
mom-wms-db/src/main/resources/mapper/DnOrderFileMapper.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.mom.wms.mapper.DnOrderFileMapper">
|
||||
|
||||
<resultMap id="dnOrderMap" type="com.foreverwin.mom.wms.entity.DnOrderFile">
|
||||
<result property="sid" column="SID"/>
|
||||
<result property="fileName" column="FILE_NAME"/>
|
||||
<result property="filePath" column="FILE_PATH"/>
|
||||
<result property="createUser" column="CREATE_USER"/>
|
||||
<result property="createDate" column="CREATE_DATE"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user