forked from gzzfw/backEnd/gz-dyh

liyj
2024-09-02 56008e5f28dd54025e11a6e988fbc09e66a3ebe8
1、附件管理模块修改
2 files added
18 files modified
310 ■■■■■ changed files
dyh-service/dyh-base/src/main/resources/template/dao.mapperXml.ftl 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoleMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoledataMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtAccountMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtDeptMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtPostMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml 6 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/dao/mapper/xml/PaAccountMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/dao/mapper/xml/PaUserMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseAgentMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CasePersonMapper.xml 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java 42 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/wechat/FileInfoWechatController.java 12 ●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/dao/mapper/FileInfoMapper.java 8 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/dao/mapper/xml/FileInfoMapper.xml 44 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/domain/dto/FileForCatDTO.java 91 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/domain/dto/FileForCatListDTO.java 39 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileInfoService.java 44 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/resources/template/dao.mapperXml.ftl
@@ -61,7 +61,7 @@
                </#if>
                <#if (col.name == "delete_status")>
                <if test="terms.${col.fieldName} = null and terms.${col.fieldName} =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.${col.fieldName} != null and terms.${col.fieldName} !=''">
                    and ${col.name} = <#noparse>#{</#noparse>terms.${col.fieldName}<#noparse>}</#noparse>
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoleMapper.xml
@@ -66,7 +66,7 @@
                    and role_type = #{terms.roleType}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoledataMapper.xml
@@ -60,7 +60,7 @@
                    and unit_id = #{terms.unitId}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtAccountMapper.xml
@@ -90,7 +90,7 @@
                    and limit_time = #{terms.limitTime}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtDeptMapper.xml
@@ -96,7 +96,7 @@
                    and can_field_name = #{terms.canFieldName}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtPostMapper.xml
@@ -60,7 +60,7 @@
                    and unit_id = #{terms.unitId}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
@@ -222,7 +222,7 @@
                    and disp_status = #{terms.dispStatus}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml
@@ -240,7 +240,7 @@
                    and disp_status = #{terms.dispStatus}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
@@ -348,7 +348,7 @@
                    and t1.status = #{terms.status}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and t1.delete_status = '0'
                    and t1.delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and t1.delete_status = #{terms.deleteStatus}
@@ -383,7 +383,7 @@
                    and t1.status = #{terms.status}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and t1.delete_status = '0'
                    and t1.delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and t1.delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/dao/mapper/xml/PaAccountMapper.xml
@@ -90,7 +90,7 @@
                    and limit_time = #{terms.limitTime}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/dao/mapper/xml/PaUserMapper.xml
@@ -180,7 +180,7 @@
                    and follow_case_type = #{terms.followCaseType}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseAgentMapper.xml
@@ -333,7 +333,7 @@
                    and cust_id = #{terms.custId}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -414,7 +414,7 @@
                    and want_user_name = #{terms.wantUserName}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CasePersonMapper.xml
@@ -339,7 +339,7 @@
                    and cust_id = #{terms.custId}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java
@@ -116,7 +116,7 @@
    }
    /**
     * 在线查附件
     * 在线查附件-文件流方式
     * @url {ctx}/api/web/fileInfo/show/{id}
     * @param id 附件编号
     * @param response 响应头
@@ -149,7 +149,7 @@
            IOUtils.closeQuietly(inputStream);
            IOUtils.closeQuietly(outputStream);
        } catch (Exception e) {
            log.error("controller接口[FileInfoWebController.show]请求异常:"+e, e);
            log.error("controller接口[FileInfoWebController.show]请求失败,异常信息:"+e, e);
            throw new ClientException("FileInfoWebController.show", e);
        }
    }
@@ -176,12 +176,46 @@
            IOUtils.closeQuietly(inputStream);
            IOUtils.closeQuietly(outputStream);
        } catch (Exception e) {
            log.error("controller接口[FileInfoWebController.down]请求异常:"+e, e);
            log.error("controller接口[FileInfoWebController.down]请求失败,异常信息:"+e, e);
            throw new ClientException("FileInfoWebController.down", e);
        }
    }
    /**
     * 查看附件组件-分类查询附件
     * @url {ctx}/api/web/fileInfo/listFileByCat
     * @param mainId 所属业务主体编号
     * @return Object
     */
    @GetMapping("/listFileByCat")
    public Object listFileByCat(@RequestParam(value = "mainId") String mainId, @CurrentUser String userId) {
        try{
            Map<String, Object> terms = Maps.newHashMap();
            // 材料大类
            String fileOwnerCat = request.getParameter("fileOwnerCat");
            if (StringUtils.isNotBlank(fileOwnerCat)){
                terms.put("ownerCat", fileOwnerCat);
            }
            // 上传时间区间
            String createStart = request.getParameter("createStart");
            String createEnd = request.getParameter("createEnd");
            if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) {
                terms.put("createStart", createStart);
                terms.put("createEnd", createEnd);
            }
            // 上传人类型
            String uploaderType = request.getParameter("uploaderType");
            if (StringUtils.isNotBlank(uploaderType)){
                terms.put("uploaderType", uploaderType);
            }
            // 所属主体编号
            terms.put("mainId", mainId);
            return ReturnSucUtils.getRepInfo(service.webListFileByCat(terms));
        } catch (Exception e) {
            log.error("service方法[FileInfoWebController.listFileByCat]请求失败,异常信息:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/wechat/FileInfoWechatController.java
@@ -61,17 +61,17 @@
    /**
     * 页面附件上传-文件流方式
     * @url {ctx}/api/wechat/fileInfo/upload/{mainId}/{ownerId}/{ownerType}
     * @url {ctx}/api/wechat/fileInfo/upload?mainId=&ownerId=&ownerType=
     * @param mainId 所属业务主体编号
     * @param ownerId 所属业务编号
     * @param ownerType 所属业务类型
     * @param request 请求头
     * @return Object
     */
    @PostMapping("/upload/{ownerId}/{ownerType}")
    public Object upload(@PathVariable(value = "mainId") String mainId,
                         @PathVariable(value = "ownerId") String ownerId,
                         @PathVariable(value = "ownerType") String ownerType,
    @PostMapping("/upload")
    public Object upload(@RequestParam(value = "mainId") String mainId,
                         @RequestParam(value = "ownerId") String ownerId,
                         @RequestParam(value = "ownerType") String ownerType,
                         @CurrentUser String userId, MultipartHttpServletRequest request) {
        try{
            PaUserDTO loginUser = custClient.paClientGetUserAll(userId);
@@ -93,7 +93,7 @@
                        if (StringUtils.isEmpty(ownerType)) {
                            ownerType = FileOwnerTypeBaseEnum.OWNER_TYPE_000.getIndex();
                        }
                        FileInfo fileInfo = service.webUploadFile(file, mainId, ownerId, ownerType, fileCount, uploaderDTO);
                        FileInfo fileInfo = service.wechatUploadFile(file, mainId, ownerId, ownerType, fileCount, uploaderDTO);
                        FileInfoBaseDTO fileInfoBaseDTO = new FileInfoBaseDTO();
                        BeanUtils.copyProperties(fileInfo, fileInfoBaseDTO);
                        files.add(fileInfoBaseDTO);
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/dao/mapper/FileInfoMapper.java
@@ -1,5 +1,6 @@
package cn.huge.module.file.dao.mapper;
import cn.huge.module.file.domain.dto.FileForCatDTO;
import cn.huge.module.file.domain.po.FileInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
@@ -61,4 +62,11 @@
    */
    List<FileInfo> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
    /**
     * 查看附件组件-分类查询附件
     * @param terms 查询条件集合
     * @return List<FileInfo>
     */
    List<FileForCatDTO> listFileByCatTerms(@Param("terms") Map<String, Object> terms);
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/dao/mapper/xml/FileInfoMapper.xml
@@ -126,7 +126,7 @@
                    and zip_url = #{terms.zipUrl}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '0'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
@@ -211,4 +211,46 @@
        limit #{page.offset}, #{page.size}
    </select>
    <!-- 查看附件组件-分类查询附件-结果集 -->
    <resultMap id="fileByCatDTO" type="cn.huge.module.file.domain.dto.FileForCatDTO">
    </resultMap>
    <!-- 查看附件组件-分类查询附件 -->
    <sql id="listFileByCatTerms-where-part">
        <if test="terms != null">
            <where>
                <if test="terms.mainId != null and terms.mainId !=''">
                    and t2.main_id = #{terms.mainId}
                </if>
                <if test="terms.ownerCat != null and terms.ownerCat !=''">
                    and t2.owner_cat = #{terms.ownerCat}
                </if>
                <if test="terms.uploaderType != null and terms.uploaderType !=''">
                    and t2.uploader_type = #{terms.uploaderType}
                </if>
                <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
                    and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart}
                    and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd})
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
                </if>
            </where>
        </if>
    </sql>
    <!--  查看附件组件-分类查询附件  -->
    <select id="listFileByCatTerms" resultMap="fileByCatDTO">
        select t1.id, t1.name, t1.true_name as trueName,
        t1.suffix, t1.size, t1.unit, t1.show_url as showUrl, t1.down_url as downUrl,
        t2.owner_cat as ownerCat, t2.uploader_id as uploaderId, t2.uploader_name as uploaderName,
        t2.uploader_type as uploaderType, t2.create_time as uploadTime
        from dyh_file_info t1
        left join dyh_file_relate t2 on t1.id = t2.file_id
        <include refid="listFileByCatTerms-where-part"/>
    </select>
</mapper> 
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/domain/dto/FileForCatDTO.java
New file
@@ -0,0 +1,91 @@
package cn.huge.module.file.domain.dto;
import cn.huge.module.file.domain.po.FileInfo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.util.Date;
/**
 * @title: 附件上传人信息
 * @description: DTO数据传输对象。
 * @company:hugeinfo
 * @author: chenx
 * @time: 2022-02-22 14:19:43
 * @version 1.0.0
 */
@Data
public class FileForCatDTO {
    /**
     * 附件编号
     */
    private String id;
    /**
     * 附件展示名称(不带后缀)
     */
    private String name;
    /**
     * 附件原本名称(带后缀)
     */
    private String trueName;
    /**
     * 附件后缀(不带.),jpg|png|pdf|doc|docx|xsl|xslx 等
     */
    private String suffix;
    /**
     * 附件大小
     */
    private Double size;
    /**
     * 单位
     */
    private String unit;
    /**
     * 附件查看地址
     */
    private String showUrl;
    /**
     * 附件下载地址
     */
    private String downUrl;
    /**
     * 所属业务大类
     */
    private String ownerCat;
    /**
     * 所属业务大类名称
     */
    private String ownerCatName;
    /**
     * 上传人编号
     */
    private String uploaderId;
    /**
     * 上传人姓名
     */
    private String uploaderName;
    /**
     * 上传人类型,1:工作人员,2:当事人
     */
    private Integer uploaderType;
    /**
     * 上传人编号
     */
    private Date uploadTime;
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/domain/dto/FileForCatListDTO.java
New file
@@ -0,0 +1,39 @@
package cn.huge.module.file.domain.dto;
import lombok.Data;
import java.util.List;
/**
 * @title: 固定格式附件交互对象
 * @description: 固定格式附件交互对象
 * @company:hugeinfo
 * @author: liyj
 * @time: 2022-03-22 11:41:14
 * @version 1.0.0
 */
@Data
public class FileForCatListDTO {
    /**
     * 附件大类
     */
    private String ownerCat;
    /**
     * 附件大类名称
     */
    private String ownerCatName;
    /**
     * 附件数量
     */
    private Integer fileSize;
    /**
     * 附件详细信息
     */
    private List<FileForCatDTO> fileList;
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/service/FileInfoService.java
@@ -3,15 +3,19 @@
import cn.huge.base.common.exception.ServiceException;
import cn.huge.base.common.utils.DateUtils;
import cn.huge.base.common.utils.IdUtils;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.constant.BaseConsts;
import cn.huge.module.file.dao.mapper.FileInfoMapper;
import cn.huge.module.file.domain.dto.FileForCatDTO;
import cn.huge.module.file.domain.dto.FileForCatListDTO;
import cn.huge.module.file.domain.dto.UploaderDTO;
import cn.huge.module.file.domain.po.FileInfo;
import cn.huge.module.file.utils.FtpUtils;
import cn.huge.module.file.utils.FtpMultipartFileWrapper;
import cn.huge.module.sys.constant.FileOwnerTypeBaseEnum;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
@@ -21,9 +25,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @title: 附件信息表业务逻辑处理
@@ -214,4 +216,40 @@
        }
    }
    /**
     * 查看附件组件-分类查询附件
     * @param terms
     * @return
     */
    public List<FileForCatListDTO> webListFileByCat(Map<String, Object> terms){
        List<FileForCatListDTO> fileForCatListDTOList = new ArrayList<>();
        // 查询附件信息进行封装
        List<FileForCatDTO> oldFileForCatDTOList = mapper.listFileByCatTerms(terms);
        if (CollectionUtils.isNotEmpty(oldFileForCatDTOList)) {
            Set<String> setTmp = new HashSet<>();
            for (FileForCatDTO fileForCatDTO: oldFileForCatDTOList) {
                if (ObjectUtils.isNotEmpty(fileForCatDTO.getOwnerCat())) {
                    setTmp.add(fileForCatDTO.getOwnerCat());
                }
            }
            Iterator<String> it = setTmp.iterator();
            while (it.hasNext()) {
                String ownerCat = it.next();
                FileForCatListDTO fileForCatListDTO = new FileForCatListDTO();
                fileForCatListDTO.setOwnerCat(ownerCat);
                fileForCatListDTO.setOwnerCatName(FileOwnerTypeBaseEnum.getDes(ownerCat));
                List<FileForCatDTO> newFileForCatDTOS = new ArrayList<>();
                for (FileForCatDTO fileForCatDTO : oldFileForCatDTOList) {
                    if (ownerCat.equals(fileForCatDTO.getOwnerCat())) {
                        newFileForCatDTOS.add(fileForCatDTO);
                    }
                }
                fileForCatListDTO.setFileList(newFileForCatDTOS);
                fileForCatListDTO.setFileSize(newFileForCatDTOS.size());
                fileForCatListDTOList.add(fileForCatListDTO);
            }
        }
        return fileForCatListDTOList;
    }
}