瀏覽代碼

凯和商务端导入修改

lazhaoqian 4 年之前
父節點
當前提交
19f73b9df5

+ 14 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/KHTWarehousebillsController.java

@@ -335,11 +335,24 @@ public class KHTWarehousebillsController extends BaseController
     /**
      * 凯和商务版导入【箱信息】Excel
      */
-    @PostMapping(value = "/importCreate")
+    @PostMapping(value = "/importCreateNew")
     public AjaxResult importCreateCompanyMsg(@RequestParam("file") MultipartFile file)throws Exception
     {
         return tWarehousebillsService.importCreateCompanyMsg(file);
     }
+
+    /**
+     * 凯和商务端新的上传方式
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = "/importCreate")
+    public AjaxResult importCreateCompanyMsgNew(@RequestParam("file") MultipartFile file)throws Exception
+    {
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tWarehousebillsService.importCreateCompanyMsgNew(file,loginUser);
+    }
     /**
      * 下载箱信息导入模板
      */

+ 115 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/TTemporaryFileController.java

@@ -0,0 +1,115 @@
+package com.ruoyi.web.controller.shipping.controller;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.shipping.domain.TTemporaryFile;
+import com.ruoyi.shipping.service.ITTemporaryFileService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 凯和商务端上传箱信息暂存数据Controller
+ * 
+ * @author ruoyi
+ * @date 2021-07-01
+ */
+@RestController
+@RequestMapping("/warehouse/file")
+public class TTemporaryFileController extends BaseController
+{
+    @Autowired
+    private ITTemporaryFileService tTemporaryFileService;
+
+    /**
+     * 查询凯和商务端上传箱信息暂存数据列表
+     */
+    //@PreAuthorize("@ss.hasPermi('warehouse:file:list')")
+    @GetMapping("/list")
+    public AjaxResult list(TTemporaryFile tTemporaryFile)
+    {
+        if ("".equals(tTemporaryFile.getFileName()) || "null".equals(tTemporaryFile.getFileName())){
+            return AjaxResult.error("文件名不能为空");
+        }
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        tTemporaryFile.setCreateBy(loginUser.getUser().getUserName());
+        //startPage();
+        List<TTemporaryFile> list = tTemporaryFileService.selectTTemporaryFileList(tTemporaryFile);
+        //return getDataTable(list);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 导出凯和商务端上传箱信息暂存数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:file:export')")
+    @Log(title = "凯和商务端上传箱信息暂存数据", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TTemporaryFile tTemporaryFile)
+    {
+        List<TTemporaryFile> list = tTemporaryFileService.selectTTemporaryFileList(tTemporaryFile);
+        ExcelUtil<TTemporaryFile> util = new ExcelUtil<TTemporaryFile>(TTemporaryFile.class);
+        return util.exportExcel(list, "file");
+    }
+
+    /**
+     * 获取凯和商务端上传箱信息暂存数据详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:file:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId)
+    {
+        return AjaxResult.success(tTemporaryFileService.selectTTemporaryFileById(fId));
+    }
+
+    /**
+     * 新增凯和商务端上传箱信息暂存数据
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:file:add')")
+    @Log(title = "凯和商务端上传箱信息暂存数据", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TTemporaryFile tTemporaryFile)
+    {
+        return toAjax(tTemporaryFileService.insertTTemporaryFile(tTemporaryFile));
+    }
+
+    /**
+     * 修改凯和商务端上传箱信息暂存数据
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:file:edit')")
+    @Log(title = "凯和商务端上传箱信息暂存数据", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TTemporaryFile tTemporaryFile)
+    {
+        return toAjax(tTemporaryFileService.updateTTemporaryFile(tTemporaryFile));
+    }
+
+    /**
+     * 删除凯和商务端上传箱信息暂存数据
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:file:remove')")
+    @Log(title = "凯和商务端上传箱信息暂存数据", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds)
+    {
+        return toAjax(tTemporaryFileService.deleteTTemporaryFileByIds(fIds));
+    }
+}

+ 178 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/domain/TTemporaryFile.java

@@ -0,0 +1,178 @@
+package com.ruoyi.shipping.domain;
+
+import java.math.BigDecimal;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 凯和商务端上传箱信息暂存数据对象 t_temporary_file
+ * 
+ * @author ruoyi
+ * @date 2021-07-01
+ */
+public class TTemporaryFile extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long fId;
+
+    /** 箱号 */
+    @Excel(name = "箱号")
+    private String fCntrno;
+
+    /** 铅封号 */
+    @Excel(name = "铅封号")
+    private String fSealno;
+
+    /** 商品ID */
+    @Excel(name = "商品ID")
+    private Long fGoodsid;
+
+    /** 包装ID */
+    @Excel(name = "包装ID")
+    private String fPackageid;
+
+    /** 箱型id */
+    @Excel(name = "箱型id")
+    private Long fCntrid;
+
+    /** 单箱重 */
+    @Excel(name = "单箱重")
+    private BigDecimal fCntrweight;
+
+    /** 货名 */
+    @Excel(name = "货名")
+    private String goodsName;
+
+    /** 包装类型中文 */
+    @Excel(name = "包装类型中文")
+    private String packageName;
+
+    /** 箱型中文 */
+    @Excel(name = "箱型中文")
+    private String cntrName;
+
+    /** 文件名 */
+    @Excel(name = "文件名")
+    private String fileName;
+
+    public void setfId(Long fId) 
+    {
+        this.fId = fId;
+    }
+
+    public Long getfId() 
+    {
+        return fId;
+    }
+    public void setfCntrno(String fCntrno) 
+    {
+        this.fCntrno = fCntrno;
+    }
+
+    public String getfCntrno() 
+    {
+        return fCntrno;
+    }
+    public void setfSealno(String fSealno) 
+    {
+        this.fSealno = fSealno;
+    }
+
+    public String getfSealno() 
+    {
+        return fSealno;
+    }
+    public void setfGoodsid(Long fGoodsid) 
+    {
+        this.fGoodsid = fGoodsid;
+    }
+
+    public Long getfGoodsid() 
+    {
+        return fGoodsid;
+    }
+    public void setfPackageid(String fPackageid) 
+    {
+        this.fPackageid = fPackageid;
+    }
+
+    public String getfPackageid() 
+    {
+        return fPackageid;
+    }
+    public void setfCntrid(Long fCntrid) 
+    {
+        this.fCntrid = fCntrid;
+    }
+
+    public Long getfCntrid() 
+    {
+        return fCntrid;
+    }
+    public void setfCntrweight(BigDecimal fCntrweight) 
+    {
+        this.fCntrweight = fCntrweight;
+    }
+
+    public BigDecimal getfCntrweight() 
+    {
+        return fCntrweight;
+    }
+    public void setGoodsName(String goodsName) 
+    {
+        this.goodsName = goodsName;
+    }
+
+    public String getGoodsName() 
+    {
+        return goodsName;
+    }
+    public void setPackageName(String packageName) 
+    {
+        this.packageName = packageName;
+    }
+
+    public String getPackageName() 
+    {
+        return packageName;
+    }
+    public void setCntrName(String cntrName) 
+    {
+        this.cntrName = cntrName;
+    }
+
+    public String getCntrName() 
+    {
+        return cntrName;
+    }
+    public void setFileName(String fileName) 
+    {
+        this.fileName = fileName;
+    }
+
+    public String getFileName() 
+    {
+        return fileName;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("fId", getfId())
+            .append("fCntrno", getfCntrno())
+            .append("fSealno", getfSealno())
+            .append("fGoodsid", getfGoodsid())
+            .append("fPackageid", getfPackageid())
+            .append("fCntrid", getfCntrid())
+            .append("fCntrweight", getfCntrweight())
+            .append("goodsName", getGoodsName())
+            .append("packageName", getPackageName())
+            .append("cntrName", getCntrName())
+            .append("fileName", getFileName())
+            .toString();
+    }
+}

+ 76 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/mapper/TTemporaryFileMapper.java

@@ -0,0 +1,76 @@
+package com.ruoyi.shipping.mapper;
+
+import com.ruoyi.shipping.domain.TTemporaryFile;
+
+import java.util.List;
+
+/**
+ * 凯和商务端上传箱信息暂存数据Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2021-07-01
+ */
+public interface TTemporaryFileMapper 
+{
+    /**
+     * 查询凯和商务端上传箱信息暂存数据
+     * 
+     * @param fId 凯和商务端上传箱信息暂存数据ID
+     * @return 凯和商务端上传箱信息暂存数据
+     */
+    public TTemporaryFile selectTTemporaryFileById(Long fId);
+
+    /**
+     * 查询凯和商务端上传箱信息暂存数据列表
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 凯和商务端上传箱信息暂存数据集合
+     */
+    public List<TTemporaryFile> selectTTemporaryFileList(TTemporaryFile tTemporaryFile);
+    /**
+     * 查询凯和商务端上传箱信息暂存数据列表
+     *
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 凯和商务端上传箱信息暂存数据集合
+     */
+    public List<TTemporaryFile> selectTTemporaryFileMessage(TTemporaryFile tTemporaryFile);
+
+    /**
+     * 新增凯和商务端上传箱信息暂存数据
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 结果
+     */
+    public int insertTTemporaryFile(TTemporaryFile tTemporaryFile);
+
+    /**
+     * 修改凯和商务端上传箱信息暂存数据
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 结果
+     */
+    public int updateTTemporaryFile(TTemporaryFile tTemporaryFile);
+
+    /**
+     * 删除凯和商务端上传箱信息暂存数据
+     * 
+     * @param fId 凯和商务端上传箱信息暂存数据ID
+     * @return 结果
+     */
+    public int deleteTTemporaryFileById(Long fId);
+
+    /**
+     * 根据文件名删除暂存数据
+     * @param fileName
+     * @return
+     */
+    public int deleteTTemporaryFilefileName(String fileName);
+
+    /**
+     * 批量删除凯和商务端上传箱信息暂存数据
+     * 
+     * @param fIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTTemporaryFileByIds(Long[] fIds);
+}

+ 62 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/ITTemporaryFileService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.shipping.service;
+
+import com.ruoyi.shipping.domain.TTemporaryFile;
+
+import java.util.List;
+
+/**
+ * 凯和商务端上传箱信息暂存数据Service接口
+ * 
+ * @author ruoyi
+ * @date 2021-07-01
+ */
+public interface ITTemporaryFileService 
+{
+    /**
+     * 查询凯和商务端上传箱信息暂存数据
+     * 
+     * @param fId 凯和商务端上传箱信息暂存数据ID
+     * @return 凯和商务端上传箱信息暂存数据
+     */
+    public TTemporaryFile selectTTemporaryFileById(Long fId);
+
+    /**
+     * 查询凯和商务端上传箱信息暂存数据列表
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 凯和商务端上传箱信息暂存数据集合
+     */
+    public List<TTemporaryFile> selectTTemporaryFileList(TTemporaryFile tTemporaryFile);
+
+    /**
+     * 新增凯和商务端上传箱信息暂存数据
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 结果
+     */
+    public int insertTTemporaryFile(TTemporaryFile tTemporaryFile);
+
+    /**
+     * 修改凯和商务端上传箱信息暂存数据
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 结果
+     */
+    public int updateTTemporaryFile(TTemporaryFile tTemporaryFile);
+
+    /**
+     * 批量删除凯和商务端上传箱信息暂存数据
+     * 
+     * @param fIds 需要删除的凯和商务端上传箱信息暂存数据ID
+     * @return 结果
+     */
+    public int deleteTTemporaryFileByIds(Long[] fIds);
+
+    /**
+     * 删除凯和商务端上传箱信息暂存数据信息
+     * 
+     * @param fId 凯和商务端上传箱信息暂存数据ID
+     * @return 结果
+     */
+    public int deleteTTemporaryFileById(Long fId);
+}

+ 99 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TTemporaryFileServiceImpl.java

@@ -0,0 +1,99 @@
+package com.ruoyi.shipping.service.impl;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.ruoyi.shipping.domain.TTemporaryFile;
+import com.ruoyi.shipping.mapper.TTemporaryFileMapper;
+import com.ruoyi.shipping.service.ITTemporaryFileService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 凯和商务端上传箱信息暂存数据Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2021-07-01
+ */
+@Service
+public class TTemporaryFileServiceImpl implements ITTemporaryFileService
+{
+    @Autowired
+    private TTemporaryFileMapper tTemporaryFileMapper;
+
+    /**
+     * 查询凯和商务端上传箱信息暂存数据
+     * 
+     * @param fId 凯和商务端上传箱信息暂存数据ID
+     * @return 凯和商务端上传箱信息暂存数据
+     */
+    @Override
+    public TTemporaryFile selectTTemporaryFileById(Long fId)
+    {
+        return tTemporaryFileMapper.selectTTemporaryFileById(fId);
+    }
+
+    /**
+     * 查询凯和商务端上传箱信息暂存数据列表
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 凯和商务端上传箱信息暂存数据
+     */
+    @Override
+    public List<TTemporaryFile> selectTTemporaryFileList(TTemporaryFile tTemporaryFile)
+    {
+        List<TTemporaryFile> tTemporaryFiles = tTemporaryFileMapper.selectTTemporaryFileMessage(tTemporaryFile);
+        if (CollectionUtils.isNotEmpty(tTemporaryFiles)){
+            int i = tTemporaryFileMapper.deleteTTemporaryFilefileName(tTemporaryFile.getFileName());
+        }
+        return tTemporaryFiles;
+    }
+
+    /**
+     * 新增凯和商务端上传箱信息暂存数据
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 结果
+     */
+    @Override
+    public int insertTTemporaryFile(TTemporaryFile tTemporaryFile)
+    {
+        return tTemporaryFileMapper.insertTTemporaryFile(tTemporaryFile);
+    }
+
+    /**
+     * 修改凯和商务端上传箱信息暂存数据
+     * 
+     * @param tTemporaryFile 凯和商务端上传箱信息暂存数据
+     * @return 结果
+     */
+    @Override
+    public int updateTTemporaryFile(TTemporaryFile tTemporaryFile)
+    {
+        return tTemporaryFileMapper.updateTTemporaryFile(tTemporaryFile);
+    }
+
+    /**
+     * 批量删除凯和商务端上传箱信息暂存数据
+     * 
+     * @param fIds 需要删除的凯和商务端上传箱信息暂存数据ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTTemporaryFileByIds(Long[] fIds)
+    {
+        return tTemporaryFileMapper.deleteTTemporaryFileByIds(fIds);
+    }
+
+    /**
+     * 删除凯和商务端上传箱信息暂存数据信息
+     * 
+     * @param fId 凯和商务端上传箱信息暂存数据ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTTemporaryFileById(Long fId)
+    {
+        return tTemporaryFileMapper.deleteTTemporaryFileById(fId);
+    }
+}

+ 163 - 0
ruoyi-shipping/src/main/resources/mapper/shipping/TTemporaryFileMapper.xml

@@ -0,0 +1,163 @@
+<?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.ruoyi.shipping.mapper.TTemporaryFileMapper">
+    
+    <resultMap type="TTemporaryFile" id="TTemporaryFileResult">
+        <result property="fId"    column="f_id"    />
+        <result property="fCntrno"    column="f_cntrno"    />
+        <result property="fSealno"    column="f_sealno"    />
+        <result property="fGoodsid"    column="f_goodsid"    />
+        <result property="fPackageid"    column="f_packageid"    />
+        <result property="fCntrid"    column="f_cntrid"    />
+        <result property="fCntrweight"    column="f_cntrweight"    />
+        <result property="goodsName"    column="goods_name"    />
+        <result property="packageName"    column="package_name"    />
+        <result property="cntrName"    column="cntr_name"    />
+        <result property="fileName"    column="file_name"    />
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
+    <sql id="selectTTemporaryFileVo">
+        select f_id, f_cntrno, f_sealno, f_goodsid, f_packageid, f_cntrid, f_cntrweight, goods_name, package_name, cntr_name, file_name, create_by, create_time, update_by, update_time, remark from t_temporary_file
+    </sql>
+
+    <select id="selectTTemporaryFileList" parameterType="TTemporaryFile" resultMap="TTemporaryFileResult">
+        <include refid="selectTTemporaryFileVo"/>
+        <where>  
+            <if test="fCntrno != null  and fCntrno != ''"> and f_cntrno = #{fCntrno}</if>
+            <if test="fSealno != null  and fSealno != ''"> and f_sealno = #{fSealno}</if>
+            <if test="fGoodsid != null "> and f_goodsid = #{fGoodsid}</if>
+            <if test="fPackageid != null  and fPackageid != ''"> and f_packageid = #{fPackageid}</if>
+            <if test="fCntrid != null "> and f_cntrid = #{fCntrid}</if>
+            <if test="fCntrweight != null "> and f_cntrweight = #{fCntrweight}</if>
+            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
+            <if test="packageName != null  and packageName != ''"> and package_name like concat('%', #{packageName}, '%')</if>
+            <if test="cntrName != null  and cntrName != ''"> and cntr_name like concat('%', #{cntrName}, '%')</if>
+            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectTTemporaryFileById" parameterType="Long" resultMap="TTemporaryFileResult">
+        <include refid="selectTTemporaryFileVo"/>
+        where f_id = #{fId}
+    </select>
+        
+    <insert id="insertTTemporaryFile" parameterType="TTemporaryFile" useGeneratedKeys="true" keyProperty="fId">
+        insert into t_temporary_file
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fCntrno != null">f_cntrno,</if>
+            <if test="fSealno != null">f_sealno,</if>
+            <if test="fGoodsid != null">f_goodsid,</if>
+            <if test="fPackageid != null">f_packageid,</if>
+            <if test="fCntrid != null">f_cntrid,</if>
+            <if test="fCntrweight != null">f_cntrweight,</if>
+            <if test="goodsName != null">goods_name,</if>
+            <if test="packageName != null">package_name,</if>
+            <if test="cntrName != null">cntr_name,</if>
+            <if test="fileName != null">file_name,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fCntrno != null">#{fCntrno},</if>
+            <if test="fSealno != null">#{fSealno},</if>
+            <if test="fGoodsid != null">#{fGoodsid},</if>
+            <if test="fPackageid != null">#{fPackageid},</if>
+            <if test="fCntrid != null">#{fCntrid},</if>
+            <if test="fCntrweight != null">#{fCntrweight},</if>
+            <if test="goodsName != null">#{goodsName},</if>
+            <if test="packageName != null">#{packageName},</if>
+            <if test="cntrName != null">#{cntrName},</if>
+            <if test="fileName != null">#{fileName},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTTemporaryFile" parameterType="TTemporaryFile">
+        update t_temporary_file
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fCntrno != null">f_cntrno = #{fCntrno},</if>
+            <if test="fSealno != null">f_sealno = #{fSealno},</if>
+            <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
+            <if test="fPackageid != null">f_packageid = #{fPackageid},</if>
+            <if test="fCntrid != null">f_cntrid = #{fCntrid},</if>
+            <if test="fCntrweight != null">f_cntrweight = #{fCntrweight},</if>
+            <if test="goodsName != null">goods_name = #{goodsName},</if>
+            <if test="packageName != null">package_name = #{packageName},</if>
+            <if test="cntrName != null">cntr_name = #{cntrName},</if>
+            <if test="fileName != null">file_name = #{fileName},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
+
+    <delete id="deleteTTemporaryFileById" parameterType="Long">
+        delete from t_temporary_file where f_id = #{fId}
+    </delete>
+    <delete id="deleteTTemporaryFilefileName" parameterType="string">
+        delete from t_temporary_file where file_name = #{fileName}
+    </delete>
+
+    <delete id="deleteTTemporaryFileByIds" parameterType="String">
+        delete from t_temporary_file where f_id in 
+        <foreach item="fId" collection="array" open="(" separator="," close=")">
+            #{fId}
+        </foreach>
+    </delete>
+    <select id="selectTTemporaryFileMessage" parameterType="TTemporaryFile" resultType="com.ruoyi.shipping.domain.TTemporaryFile">
+        SELECT
+        tf.f_id AS fId,
+        tf.f_cntrno AS fCntrno,
+        tf.f_sealno AS fSealno,
+        tg.f_id AS fGoodsid,
+        sd.dict_value AS fPackageid,
+        tc.f_id AS fCntrid,
+        tf.f_cntrweight AS fCntrweight,
+        tf.goods_name AS goodsName,
+        tf.package_name AS packageName,
+        tf.cntr_name AS cntrName,
+        tf.file_name AS fileName,
+        tf.create_by AS createBy,
+        tf.create_time AS createTime,
+        tf.update_by AS updateBy,
+        tf.update_time AS updateTime,
+        tf.remark AS remark
+        FROM
+        t_temporary_file tf
+        LEFT JOIN t_goods tg ON tf.goods_name = tg.f_name
+        LEFT JOIN sys_dict_data sd ON sd.dict_label = tf.package_name
+        AND sd.dict_type = 'f_packageid'
+        LEFT JOIN t_cntr tc ON tc.f_no = tf.cntr_name
+        <where>
+            <if test="fCntrno != null  and fCntrno != ''"> and tf.f_cntrno = #{fCntrno}</if>
+            <if test="fSealno != null  and fSealno != ''"> and tf.f_sealno = #{fSealno}</if>
+            <if test="fGoodsid != null "> and tf.f_goodsid = #{fGoodsid}</if>
+            <if test="fPackageid != null  and fPackageid != ''"> and tf.f_packageid = #{fPackageid}</if>
+            <if test="fCntrid != null "> and tf.f_cntrid = #{fCntrid}</if>
+            <if test="fCntrweight != null "> and tf.f_cntrweight = #{fCntrweight}</if>
+            <if test="goodsName != null  and goodsName != ''"> and tf.goods_name like concat('%', #{goodsName}, '%')</if>
+            <if test="packageName != null  and packageName != ''"> and tf.package_name like concat('%', #{packageName}, '%')</if>
+            <if test="cntrName != null  and cntrName != ''"> and tf.cntr_name like concat('%', #{cntrName}, '%')</if>
+            <if test="fileName != null  and fileName != ''"> and tf.file_name = #{fileName}</if>
+            <if test="createBy != null  and createBy != ''">and tf.create_by = #{createBy}</if>
+        </where>
+    </select>
+    
+</mapper>

+ 6 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -407,6 +407,12 @@ public interface ITWarehouseBillsService {
      * @return  结果
      */
     public AjaxResult importCreateCompanyMsg(MultipartFile file) throws Exception;
+    /**
+     *  导入Excel生成箱信息
+     * @param file  excel
+     * @return  结果
+     */
+    public AjaxResult importCreateCompanyMsgNew(MultipartFile file,LoginUser loginUser) throws Exception;
 
     /**
      * 提交仓库主表审批

+ 116 - 9
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -28,15 +28,9 @@ import com.ruoyi.quotation.mapper.TSeapriceMapper;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
-import com.ruoyi.shipping.domain.TCntr;
-import com.ruoyi.shipping.domain.TVoyage;
-import com.ruoyi.shipping.domain.TWarehousebillsCntr;
-import com.ruoyi.shipping.domain.TWarehousebillsCntritems;
+import com.ruoyi.shipping.domain.*;
 import com.ruoyi.shipping.excel.TWarehousebillsCntritemsExcel;
-import com.ruoyi.shipping.mapper.TCntrMapper;
-import com.ruoyi.shipping.mapper.TVoyageMapper;
-import com.ruoyi.shipping.mapper.TWarehousebillsCntrMapper;
-import com.ruoyi.shipping.mapper.TWarehousebillsCntritemsMapper;
+import com.ruoyi.shipping.mapper.*;
 import com.ruoyi.system.domain.SysCheckCode;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
@@ -50,6 +44,7 @@ import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.omg.CORBA.OBJ_ADAPTER;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -153,6 +148,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
     @Autowired
     private TWarehousebillsCntritemsMapper tWarehousebillsCntritemsMapper;
+    @Autowired
+    private TTemporaryFileMapper tTemporaryFileMapper;
 
 
     /**
@@ -1668,7 +1665,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     @Override
     public AjaxResult importCreateCompanyMsg(MultipartFile file) throws Exception {
         List<TWarehousebillsCntritemsExcel> fleetCompanyMsgs = new ArrayList<>();
-
         InputStream inputStream = null;
          try {
         inputStream = file.getInputStream();
@@ -1762,6 +1758,117 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
     }
 
+    @Override
+    @Transactional
+    public AjaxResult importCreateCompanyMsgNew(MultipartFile file,LoginUser loginUser) throws Exception {
+        List<TTemporaryFile> fleetCompanyMsgs = new ArrayList<>();
+
+        InputStream inputStream = null;
+        Map<String,Object> map = new HashMap<>();
+        try {
+            inputStream = file.getInputStream();
+            String originalFilename = file.getOriginalFilename();
+            Workbook workbook = null;
+            if (originalFilename.endsWith("xls")){
+                workbook = WorkbookFactory.create(inputStream);
+            }else if (originalFilename.endsWith("xlsx")){
+                workbook = new XSSFWorkbook(inputStream);
+            }
+            Sheet sheet = workbook.getSheetAt(0);
+            int line = 0;
+            for (Row rows : sheet) {
+                line++;
+                if (rows.getRowNum() == 0) {
+                    continue;
+                }
+                TTemporaryFile companyMsg = new TTemporaryFile();
+                companyMsg.setFileName(originalFilename);
+                companyMsg.setCreateBy(loginUser.getUser().getUserName());
+                companyMsg.setCreateTime(new Date());
+                for (int a = 0; a < rows.getPhysicalNumberOfCells(); a++) {
+                    Cell cell = rows.getCell(a);
+                    String value = filter(sheet.getRow(0), CellReference.convertNumToColString(cell.getColumnIndex()));
+                    switch (value) {
+                        case "箱号":
+                            //设置单元格类型
+                            cell.setCellType(CellType.STRING);
+                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少箱号",500);
+                            }
+                            companyMsg.setfCntrno(cell.getStringCellValue());
+                            break;
+                        case "铅封号":
+                            //设置单元格类型
+                            cell.setCellType(CellType.STRING);
+                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少封号",500);
+                            }
+                            companyMsg.setfSealno(cell.getStringCellValue());
+                            break;
+                        case "单箱重(不得超过40)":
+                            //设置单元格类型
+                            cell.setCellType(CellType.STRING);
+                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少单箱重",500);
+                            }
+                            companyMsg.setfCntrweight(new BigDecimal(cell.getStringCellValue()));
+                            break;
+                        case "货名":
+                            //设置单元格类型
+                            cell.setCellType(CellType.STRING);
+                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少货名",500);
+                            }
+                            companyMsg.setGoodsName(cell.getStringCellValue());
+                            /*TGoods tGoods = tGoodsMapper.checkUFNnameUnique(companyMsg.getGoodsName());
+                            if (tGoods != null && tGoods.getfId() != null) {
+                                companyMsg.setfGoodsid(tGoods.getfId());
+                            }*/
+                            break;
+                        case "包装类型":
+                            //设置单元格类型
+                            cell.setCellType(CellType.STRING);
+                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少包装类型",500);
+                            }
+                            companyMsg.setPackageName(cell.getStringCellValue());
+                            /*String fPackageid = sysDictDataMapper.selectDictValue("f_packageid", companyMsg.getPackageName());
+                            if (StringUtils.isNotEmpty(fPackageid)) {
+                                companyMsg.setfPackageid(fPackageid);
+                            }*/
+                            break;
+                        case "箱型":
+                            //设置单元格类型
+                            cell.setCellType(CellType.STRING);
+                            if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少箱型",500);
+                            }
+                            companyMsg.setCntrName(cell.getStringCellValue());
+                            /*Long fId = tCntrMapper.selectRcntrFId(companyMsg.getCntrName());
+                            if (fId != null) {
+                                companyMsg.setfCntrid(fId);
+                            }*/
+                            break;
+                    }
+                }
+                tTemporaryFileMapper.insertTTemporaryFile(companyMsg);
+                fleetCompanyMsgs.add(companyMsg);
+            }
+            map.put("total",fleetCompanyMsgs.size());
+            map.put("fileName",originalFilename);
+        } catch (IOException e) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return AjaxResult.error("上传文件失败,请检查文件是否损坏");
+        }
+        return AjaxResult.success("success", map);
+    }
+
     /**
      * 提交仓库主表审批
      * @param tWarehouseBills       主表信息