| | |
| | | */ |
| | | OWNER_CAT_1("22_00014-1", "申请材料"), |
| | | OWNER_CAT_2("22_00014-2", "证据材料"), |
| | | OWNER_CAT_7("22_00014-7", "办理材料"), |
| | | OWNER_CAT_5("22_00014-5", "结案材料"), |
| | | OWNER_CAT_3("22_00014-3", "身份证明材料"), |
| | | OWNER_CAT_7("22_00014-7", "任务处理附件"), |
| | | OWNER_CAT_5("22_00014-5", "调解结果材料"), |
| | | OWNER_CAT_6("22_00014-6", "司法确认结果材料"), |
| | | OWNER_CAT_8("22_00014-8", "模板附件"), |
| | | OWNER_CAT_4("22_00014-4", "其他材料"), |
| | |
| | | return OWNER_CAT_4.getIndex(); |
| | | |
| | | case "22_00018-201": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-202": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-203": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-204": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-205": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-206": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-207": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-208": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | case "22_00018-299": |
| | | return OWNER_CAT_3.getIndex(); |
| | | return OWNER_CAT_1.getIndex(); |
| | | |
| | | case "22_00018-301": |
| | | return OWNER_CAT_5.getIndex(); |
| | |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * 所属业务主体编号,如纠纷信息编号 |
| | | */ |
| | | private String mainId; |
| | | |
| | | /** |
| | | * 所属业务编号 |
| | |
| | | |
| | | /** |
| | | * 页面附件上传-文件流方式 |
| | | * @url {ctx}/api/web/fileInfo/upload/{ownerId}/{ownerType} |
| | | * @url {ctx}/api/web/fileInfo/upload/{mainId}/{ownerId}/{ownerType} |
| | | * @param mainId 所属业务主体编号 |
| | | * @param ownerId 所属业务编号 |
| | | * @param ownerType 所属业务类型 |
| | | * @param request 请求头 |
| | | * @return Object |
| | | */ |
| | | @PostMapping("/upload/{ownerId}/{ownerType}") |
| | | public Object upload(@PathVariable(value = "ownerId") String ownerId, @PathVariable(value = "ownerType") String ownerType, |
| | | public Object upload(@PathVariable(value = "mainId") String mainId, |
| | | @PathVariable(value = "ownerId") String ownerId, |
| | | @PathVariable(value = "ownerType") String ownerType, |
| | | @CurrentUser String userId, MultipartHttpServletRequest request) { |
| | | try{ |
| | | CtUserDTO loginUser = custClient.clientGetUser(userId); |
| | |
| | | if (StringUtils.isEmpty(ownerType)) { |
| | | ownerType = FileOwnerTypeBaseEnum.OWNER_TYPE_000.getIndex(); |
| | | } |
| | | FileInfo fileInfo = service.webPploadFile(file, ownerId, ownerType, fileCount, uploaderDTO); |
| | | FileInfo fileInfo = service.webUploadFile(file, mainId, ownerId, ownerType, fileCount, uploaderDTO); |
| | | FileInfoBaseDTO fileInfoBaseDTO = new FileInfoBaseDTO(); |
| | | BeanUtils.copyProperties(fileInfo, fileInfoBaseDTO); |
| | | files.add(fileInfoBaseDTO); |
| | |
| | | |
| | | /** |
| | | * 页面附件上传-文件流方式 |
| | | * @url {ctx}/api/wechat/fileInfo/upload/{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 = "ownerId") String ownerId, @PathVariable(value = "ownerType") String ownerType, |
| | | public Object upload(@PathVariable(value = "mainId") String mainId, |
| | | @PathVariable(value = "ownerId") String ownerId, |
| | | @PathVariable(value = "ownerType") String ownerType, |
| | | @CurrentUser String userId, MultipartHttpServletRequest request) { |
| | | try{ |
| | | CtUserDTO loginUser = custClient.clientGetUser(userId); |
| | |
| | | if (StringUtils.isEmpty(ownerType)) { |
| | | ownerType = FileOwnerTypeBaseEnum.OWNER_TYPE_000.getIndex(); |
| | | } |
| | | FileInfo fileInfo = service.webPploadFile(file, ownerId, ownerType, fileCount, uploaderDTO); |
| | | FileInfo fileInfo = service.webUploadFile(file, mainId, ownerId, ownerType, fileCount, uploaderDTO); |
| | | FileInfoBaseDTO fileInfoBaseDTO = new FileInfoBaseDTO(); |
| | | BeanUtils.copyProperties(fileInfo, fileInfoBaseDTO); |
| | | files.add(fileInfoBaseDTO); |
| | |
| | | <resultMap id="dataResult" type="cn.huge.module.file.domain.po.FileRelate"> |
| | | <result property="id" column="id"/> |
| | | <result property="fileId" column="file_id"/> |
| | | <result property="mainId" column="main_id"/> |
| | | <result property="ownerId" column="owner_id"/> |
| | | <result property="ownerCat" column="owner_cat"/> |
| | | <result property="ownerType" column="owner_type"/> |
| | |
| | | <sql id="column-part"> |
| | | id, |
| | | file_id, |
| | | main_id, |
| | | owner_id, |
| | | owner_cat, |
| | | owner_type, |
| | |
| | | <!-- 更新实体字段 --> |
| | | <sql id="set-part"> |
| | | <if test="entity.fileId != null">file_id = #{entity.fileId},</if> |
| | | <if test="entity.mainId != null">main_id = #{entity.mainId},</if> |
| | | <if test="entity.ownerId != null">owner_id = #{entity.ownerId},</if> |
| | | <if test="entity.ownerCat != null">owner_cat = #{entity.ownerCat},</if> |
| | | <if test="entity.ownerType != null">owner_type = #{entity.ownerType},</if> |
| | |
| | | <if test="terms.fileId != null and terms.fileId !=''"> |
| | | and file_id = #{terms.fileId} |
| | | </if> |
| | | <if test="terms.mainId != null and terms.mainId !=''"> |
| | | and main_id = #{terms.mainId} |
| | | </if> |
| | | <if test="terms.ownerId != null and terms.ownerId !=''"> |
| | | and owner_id = #{terms.ownerId} |
| | | </if> |
| | |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 所属业务主体编号,如纠纷信息编号 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String mainId; |
| | | |
| | | /** |
| | | * 所属业务编号 |
| | | */ |
| | |
| | | private String fileId; |
| | | |
| | | /** |
| | | * 所属业务主体编号,如纠纷信息编号 |
| | | */ |
| | | @TableField(value = "main_id") |
| | | private String mainId; |
| | | |
| | | /** |
| | | * 所属业务编号 |
| | | */ |
| | | @TableField(value = "owner_id") |
| | |
| | | * @param uploaderDTO 上传人信息 |
| | | * @return |
| | | */ |
| | | public FileInfo webPploadFile(MultipartFile file, String ownerId, String ownerType, int fileCount, UploaderDTO uploaderDTO) { |
| | | public FileInfo webUploadFile(MultipartFile file, String mainId, String ownerId, String ownerType, int fileCount, UploaderDTO uploaderDTO) { |
| | | try { |
| | | String fileId = utilsClient.getNewTimeId(); |
| | | // 创建附件信息 |
| | |
| | | ftpUtils.upload(fileInfo.getPath(), fileInfo.getFileName(), file.getInputStream()); |
| | | // 保存附件信息 |
| | | fileInfo.setName(FileOwnerTypeBaseEnum.getDes(ownerType) + BaseConsts.UNDER + fileCount); |
| | | fileInfo.setMainId(mainId); |
| | | fileInfo.setOwnerId(ownerId); |
| | | fileInfo.setOwnerCat(FileOwnerTypeBaseEnum.getCat(ownerType)); |
| | | fileInfo.setOwnerCatName(FileOwnerTypeBaseEnum.getDes(fileInfo.getOwnerCat())); |
| | |
| | | * @param uploaderDTO 上传人信息 |
| | | * @return |
| | | */ |
| | | public FileInfo wechatPploadFile(MultipartFile file, String ownerId, String ownerType, int fileCount, UploaderDTO uploaderDTO) { |
| | | public FileInfo wechatUploadFile(MultipartFile file, String mainId, String ownerId, String ownerType, int fileCount, UploaderDTO uploaderDTO) { |
| | | try { |
| | | String fileId = utilsClient.getNewTimeId(); |
| | | // 创建附件信息 |
| | |
| | | ftpUtils.upload(fileInfo.getPath(), fileInfo.getFileName(), file.getInputStream()); |
| | | // 保存附件信息 |
| | | fileInfo.setName(FileOwnerTypeBaseEnum.getDes(ownerType) + BaseConsts.UNDER + fileCount); |
| | | fileInfo.setMainId(mainId); |
| | | fileInfo.setOwnerId(ownerId); |
| | | fileInfo.setOwnerCat(FileOwnerTypeBaseEnum.getCat(ownerType)); |
| | | fileInfo.setOwnerCatName(FileOwnerTypeBaseEnum.getDes(fileInfo.getOwnerCat())); |
| | |
| | | FileRelate fileRelate = new FileRelate(); |
| | | fileRelate.setId(utilsClient.getNewTimeId()); |
| | | fileRelate.setFileId(fileInfo.getId()); |
| | | fileRelate.setMainId(fileInfo.getMainId()); |
| | | fileRelate.setOwnerId(fileInfo.getOwnerId()); |
| | | fileRelate.setOwnerCat(fileInfo.getOwnerCat()); |
| | | fileRelate.setOwnerType(fileInfo.getOwnerType()); |
| | |
| | | fileRelate.setUpdateTime(nowDate); |
| | | mapper.insert(fileRelate); |
| | | } catch (Exception e) { |
| | | log.error("service方法[FileRelateService.uploadFile]调用异常:"+e, e); |
| | | log.error("service方法[FileRelateService.uploadFile]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("FileRelateService.uploadFile", e); |
| | | } |
| | | } |