liurunyu
2024-11-08 5b8a52d6cef6f6b1032cc576471b505e69304331
上传RTU升级文件接收端增加判断重名文件,重名文件不允许上传
4个文件已修改
37 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuProgramMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuProgramMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/program/UgRtuProgramCtrl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/program/UgRtuProgramSv.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/UgRtuProgramMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.UgRtuProgram;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@@ -71,6 +72,12 @@
     * @return 实体集合
     * */
    List<UgRtuProgram> selectAll() ;
    /**
     * 查询数据库,是否存在给定升级文件名称
     * @param programFileName 文件名称
     * @return bool
     */
    Long selectByFileName(@Param("programFileName") String programFileName) ;
    /**
     * update record selective
pipIrr-platform/pipIrr-global/src/main/resources/mapper/UgRtuProgramMapper.xml
@@ -74,6 +74,17 @@
    where bd.deleted != 1
    order by bd.id DESC
  </select>
  <select id="selectByFileName" parameterType="java.lang.String" resultType="java.lang.Long">
    select
    count(*)
    from ug_rtu_program bd
    where bd.deleted != 1
    <trim prefix="and" suffixOverrides="and">
      <if test="programFileName != null and programFileName != ''">
        bd.hex_file_name = #{programFileName ,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/program/UgRtuProgramCtrl.java
@@ -151,6 +151,10 @@
        if(vo.file == null){
            return BaseResponseUtils.buildFail("RTU程序文件必须上传") ;
        }
        String fileName = vo.file.getOriginalFilename() ;
        if(this.sv.existFileName(fileName)){
            return BaseResponseUtils.buildFail("RTU程序文件名已存在") ;
        }
        HexFileVo fileVo = null ;
        byte[] fileBytes = null ;
@@ -166,7 +170,7 @@
        }
        if(fileVo != null){
            UgRtuProgram po = new UgRtuProgram();
            po.hexFileName = vo.file.getOriginalFilename() ;
            po.hexFileName = fileName ;
            po.programCalculateBytes = (int)fileVo.calculateBytes ;
            po.programCrc16 = fileVo.bytesCrc16 ;
            po.programBytes = fileVo.bytes;
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/program/UgRtuProgramSv.java
@@ -59,6 +59,19 @@
        rsVo.obj = this.dao.selectAll() ;
        return rsVo ;
    }
    /**
     * 查询数据库,是否存在给定升级文件名称
     * @param programFileName 文件名称
     * @return bool
     */
    public boolean existFileName(String programFileName){
        Long count = this.dao.selectByFileName(programFileName) ;
        if(count != null && count > 0){
            return true ;
        }else{
            return false ;
        }
    }
    /**
     * 新增保存分水口实体