refactor(flyer): 修改飞手表单和实体类中的擅长任务类型字段
- 将 GdFlyerAddParam 中的 skilledTaskType 字段从 String 类型改为 List<List<String>> 类型
- 在 GdFlyerEntity 实体类中为 skilledTaskType 字段添加 GenericListTypeHandler 类型处理器
- 更新 GdFlyerMapper.xml 映射文件中 skilled_task_type 的类型处理器配置
- 修改 GdFlyerPageParam 查询参数类中的 skilledTaskType 类型定义
- 在 GdFlyerVO 视图对象中配置相应的类型处理器和字段类型
- 调整 GdTaskResultController 控制器中 list 方法的参数和注解
- 更新 GdTaskResultMapper 数据访问层的查询方法签名和 SQL 映射
- 修改 Attach 相关实体类和接口中的 resultType 字段类型为 List<List<String>>
- 完善资源服务中的附件类型处理逻辑和类型转换
| | |
| | | import org.springblade.core.tenant.mp.TenantEntity; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.util.StringUtils; |
| | | import org.sxkj.common.handler.GenericListTypeHandler; |
| | | import org.sxkj.common.utils.file.FileNameHarsher; |
| | | |
| | | import java.util.List; |
| | |
| | | private String patrolTaskId; |
| | | |
| | | @ApiModelProperty(value = "附件类型: 1=巡查类文档,2=巡检类文档,3=安保类文档,4=文旅类文档,5=采集数据类文档") |
| | | private String resultType; |
| | | @TableField(typeHandler = GenericListTypeHandler.class) |
| | | private List<List<String>> resultType; |
| | | |
| | | @ApiModelProperty(value = "设备SN") |
| | | private String deviceSn; |
| | |
| | | * @throws IOException |
| | | */ |
| | | @PostMapping(value = SAVE_ATTACH_FILE_2, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | BladeFile saveAttachFile(@RequestPart MultipartFile file, @RequestParam String fileName, @RequestParam String type) throws IOException; |
| | | BladeFile saveAttachFile(@RequestPart MultipartFile file, @RequestParam String fileName, @RequestParam List<List<String>> type) throws IOException; |
| | | |
| | | /** |
| | | * 附件上传 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BladeFile saveAttachFile(MultipartFile file, String fileName, String type) throws IOException { |
| | | public BladeFile saveAttachFile(MultipartFile file, String fileName, List<List<String>> type) throws IOException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class AttachDto { |
| | |
| | | private String originalName; |
| | | |
| | | @ApiModelProperty(value = "附件类型: 1=巡查类文档,2=巡检类文档,3=安保类文档,4=文旅类文档,5=采集数据类文档") |
| | | private Integer resultType; |
| | | private List<List<String>> resultType; |
| | | |
| | | @ApiModelProperty(value = "附件大小") |
| | | private Long attachSize; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | @PostMapping("/put-file-attach-by-name") |
| | | @ApiOperation(value = "上传文件并保存至附件表", notes = "上传文件并保存至附件表-存储桶对象名称") |
| | | public R<BladeFile> putFileAttach(@RequestParam String fileName, |
| | | @RequestParam String resultType, |
| | | @RequestParam List<List<String>> resultType, |
| | | @RequestParam MultipartFile file) { |
| | | BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); |
| | | Long attachId = buildAttach(fileName, resultType, file.getSize(), bladeFile); |
| | |
| | | private BladeFile getBladeFile(@RequestParam MultipartFile file) throws IOException { |
| | | String fileName = file.getOriginalFilename(); |
| | | BladeFile bladeFile = ossBuilder.template("estack").putFile(fileName, file.getInputStream()); |
| | | Long attachId = buildAttach(fileName, "", file.getSize(), bladeFile); |
| | | Long attachId = buildAttach(fileName, null, file.getSize(), bladeFile); |
| | | bladeFile.setAttachId(attachId); |
| | | return bladeFile; |
| | | } |
| | |
| | | * @param bladeFile 对象存储文件 |
| | | * @return attachId |
| | | */ |
| | | private Long buildAttach(String fileName, String resultType, Long fileSize, BladeFile bladeFile) { |
| | | private Long buildAttach(String fileName, List<List<String>> resultType, Long fileSize, BladeFile bladeFile) { |
| | | String fileExtension = FileUtil.getFileExtension(fileName); |
| | | Attach attach = new Attach(); |
| | | attach.setDomainUrl(bladeFile.getDomain()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BladeFile saveAttachFile(MultipartFile file, String fileName, String type) throws IOException { |
| | | public BladeFile saveAttachFile(MultipartFile file, String fileName, List<List<String>> type) throws IOException { |
| | | BladeFile bladeFile = ossBuilder.template().putFile(pojo.getBucket(),fileName, file.getInputStream()); |
| | | Long attachId = buildAttach(fileName, file.getSize(), bladeFile, type); |
| | | bladeFile.setAttachId(attachId); |
| | |
| | | return bladeFile; |
| | | } |
| | | |
| | | private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile, String type) { |
| | | private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile, List<List<String>> type) { |
| | | String fileExtension = FileUtil.getFileExtension(fileName); |
| | | Attach attach = new Attach(); |
| | | attach.setDomainUrl(bladeFile.getDomain()); |
| | |
| | | saveAttachFile(new MockMultipartFile( mediaFile.getName(), |
| | | mediaFile.getName(), |
| | | "application/octet-stream", |
| | | new FileInputStream(mediaFile)), name, Attach.RESULT_TYPE_VEDIO_SHOW); |
| | | new FileInputStream(mediaFile)), name, null); |
| | | log.info("第{}个视频保存入库完成...", (i + 1)); |
| | | |
| | | } |
| | |
| | | <result column="original_name" property="originalName"/> |
| | | <result column="extension" property="extension"/> |
| | | <result column="attach_size" property="attachSize"/> |
| | | <result column="result_type" property="resultType" typeHandler="org.sxkj.common.handler.GenericListTypeHandler"/> |
| | | </resultMap> |
| | | |
| | | <!--自定义分页查询--> |
| | | <select id="selectAttachPage" resultType="org.sxkj.resource.vo.AttachVO"> |
| | | <select id="selectAttachPage" resultMap="attachResultMap" > |
| | | select |
| | | ba.*, |
| | | bd.dept_name, |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "附件类型: 1=巡查类文档,2=巡检类文档,3=安保类文档,4=文旅类文档,5=采集数据类文档") |
| | | private Integer resultType; |
| | | private List<List<String>> resultType; |
| | | /** |
| | | * 附件原名 |
| | | */ |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | import org.sxkj.common.handler.GenericListTypeHandler; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | * 擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类) |
| | | */ |
| | | @ApiModelProperty(value = "擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类)") |
| | | private String skilledTaskType; |
| | | @TableField(typeHandler = GenericListTypeHandler.class) |
| | | private List<List<String>> skilledTaskType; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | <result column="project_experience" property="projectExperience"/> |
| | | <result column="technical_strength" property="technicalStrength"/> |
| | | <result column="skilled_uav_type" property="skilledUavType"/> |
| | | <result column="skilled_task_type" property="skilledTaskType"/> |
| | | <result column="skilled_task_type" property="skilledTaskType" typeHandler="org.sxkj.common.handler.GenericListTypeHandler"/> |
| | | <result column="area_code" property="areaCode"/> |
| | | <result column="flyer_address" property="flyerAddress"/> |
| | | <result column="certification" property="certification" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> |
| | |
| | | <result column="project_experience" property="projectExperience"/> |
| | | <result column="technical_strength" property="technicalStrength"/> |
| | | <result column="skilled_uav_type" property="skilledUavType"/> |
| | | <result column="skilled_task_type" property="skilledTaskType"/> |
| | | <result column="skilled_task_type" property="skilledTaskType" typeHandler="org.sxkj.common.handler.GenericListTypeHandler"/> |
| | | <result column="area_code" property="areaCode"/> |
| | | <result column="flyer_address" property="flyerAddress"/> |
| | | <result column="certification" property="certification" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> |
| | |
| | | * 擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类) |
| | | */ |
| | | @ApiModelProperty(value = "擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类)") |
| | | private String skilledTaskType; |
| | | private List<List<String>> skilledTaskType; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | * 擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类) |
| | | */ |
| | | @ApiModelProperty(value = "擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类)") |
| | | private String skilledTaskType; |
| | | private List<List<String>> skilledTaskType; |
| | | // 经度 |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | |
| | | */ |
| | | package org.sxkj.gd.flyer.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import org.sxkj.common.handler.GenericListTypeHandler; |
| | | |
| | | /** |
| | | * 飞手表 视图实体类 |
| | |
| | | * 擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类) |
| | | */ |
| | | @ApiModelProperty(value = "擅长任务类型(0:巡查类 1:安保类 2:文旅类 3:采集数据类)") |
| | | private String skilledTaskType; |
| | | @TableField(typeHandler = GenericListTypeHandler.class) |
| | | private List<List<String>> skilledTaskType; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | |
| | | */ |
| | | @ApiModelProperty(value = "飞手资质证书地址列表") |
| | | private List<String> certification; |
| | | |
| | | |
| | | /** |
| | | * 区域匹配标识(0:未匹配 1:匹配) |
| | | */ |
| | |
| | | } |
| | | /** |
| | | * 成果表 列表 |
| | | * |
| | | * @param patrolTaskId 巡查任务ID |
| | | * @param attachmentTypes 附件类型列表:1媒体文件;2ai文件;3主视频;(可选,不传则查询全部,多个用逗号分隔) |
| | | * @return 成果列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "列表", notes = "传入patrolTaskId") |
| | | public R<List<GdTaskResultVO>> list(@ApiParam(value = "巡查任务ID", required = true) @RequestParam Long patrolTaskId) { |
| | | return R.data(gdTaskResultService.listByPatrolTaskId(patrolTaskId)); |
| | | @ApiOperation(value = "列表", notes = "传入patrolTaskId和attachmentTypes") |
| | | public R<List<GdTaskResultVO>> list( |
| | | @ApiParam(value = "巡查任务ID", required = true) @RequestParam Long patrolTaskId, |
| | | @ApiParam(value = "附件类型:1媒体文件;2ai文件;3主视频;多个用逗号分隔") @RequestParam(required = false) List<Integer> attachmentTypes) { |
| | | return R.data(gdTaskResultService.listByPatrolTaskId(patrolTaskId, attachmentTypes)); |
| | | } |
| | | // /** |
| | | // * 成果表 分页 |
| | |
| | | */ |
| | | List<GdTaskResultVO> selectGdTaskResultPage(IPage page, GdTaskResultVO gdTaskResult); |
| | | |
| | | List<GdTaskResultVO> selectGdTaskResultListByPatrolTaskId(@Param("patrolTaskId") Long patrolTaskId); |
| | | /** |
| | | * 根据巡查任务ID查询成果列表 |
| | | * |
| | | * @param patrolTaskId 巡查任务ID |
| | | * @param attachmentTypes 附件类型列表(可选,为null或空时查询全部) |
| | | * @return 成果列表 |
| | | */ |
| | | List<GdTaskResultVO> selectGdTaskResultListByPatrolTaskId( |
| | | @Param("patrolTaskId") Long patrolTaskId, |
| | | @Param("attachmentTypes") List<Integer> attachmentTypes); |
| | | |
| | | |
| | | /** |
| | |
| | | <if test="gdTaskResult.createUser != null"> |
| | | AND tr.create_user = #{gdTaskResult.createUser} |
| | | </if> |
| | | <if test="gdTaskResult.attachmentType != null"> |
| | | AND tr.attachment_type = #{gdTaskResult.attachmentType} |
| | | </if> |
| | | ORDER BY tr.create_time DESC |
| | | </select> |
| | | |
| | |
| | | WHERE |
| | | tr.is_deleted = 0 |
| | | AND tr.patrol_task_id = #{patrolTaskId} |
| | | <if test="attachmentTypes != null and attachmentTypes.size() > 0"> |
| | | AND tr.attachment_type IN |
| | | <foreach collection="attachmentTypes" item="type" open="(" separator="," close=")"> |
| | | #{type} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | */ |
| | | IPage<GdTaskResultVO> selectGdTaskResultPage(IPage<GdTaskResultVO> page, GdTaskResultVO gdTaskResult); |
| | | |
| | | List<GdTaskResultVO> listByPatrolTaskId(Long patrolTaskId); |
| | | /** |
| | | * 根据巡查任务ID查询成果列表 |
| | | * |
| | | * @param patrolTaskId 巡查任务ID |
| | | * @param attachmentTypes 附件类型列表(可选,为null或空时查询全部) |
| | | * @return 成果列表 |
| | | */ |
| | | List<GdTaskResultVO> listByPatrolTaskId(Long patrolTaskId, List<Integer> attachmentTypes); |
| | | |
| | | |
| | | /** |
| | |
| | | attach.setOriginalName(bladeFile.getOriginalName()); |
| | | attach.setAttachSize(reportFile.length()); |
| | | attach.setExtension(FileUtil.getFileExtension(reportFile.getName())); |
| | | attach.setResultType(JSON.toJSONString(resultType)); |
| | | attach.setResultType(resultType); |
| | | attach.setPatrolTaskId(String.valueOf(taskEntity != null ? taskEntity.getId() : null)); |
| | | Long createUser = taskEntity != null ? taskEntity.getCreateUser() : null; |
| | | Long updateUser = taskEntity != null ? taskEntity.getUpdateUser() : null; |
| | |
| | | return page.setRecords(baseMapper.selectGdTaskResultPage(page, gdTaskResult)); |
| | | } |
| | | |
| | | /** |
| | | * 根据巡查任务ID查询成果列表 |
| | | * |
| | | * @param patrolTaskId 巡查任务ID |
| | | * @param attachmentTypes 附件类型列表(可选,为null或空时查询全部) |
| | | * @return 成果列表 |
| | | */ |
| | | @Override |
| | | public List<GdTaskResultVO> listByPatrolTaskId(Long patrolTaskId) { |
| | | List<GdTaskResultVO> gdTaskResultVOS = baseMapper.selectGdTaskResultListByPatrolTaskId(patrolTaskId); |
| | | public List<GdTaskResultVO> listByPatrolTaskId(Long patrolTaskId, List<Integer> attachmentTypes) { |
| | | // 步骤1:查询成果列表 |
| | | List<GdTaskResultVO> gdTaskResultVOS = baseMapper.selectGdTaskResultListByPatrolTaskId(patrolTaskId, attachmentTypes); |
| | | // 步骤2:处理URL转义字符 |
| | | for (GdTaskResultVO gdTaskResultVO : gdTaskResultVOS) { |
| | | gdTaskResultVO.setResultUrl(unescapeUrl(gdTaskResultVO.getResultUrl())); |
| | | } |
| | |
| | | if (existingDept != null) { |
| | | return updateById(dept); |
| | | } |
| | | return save(dept); |
| | | |
| | | } |
| | | return false; |
| | | return save(dept); |
| | | } |
| | | |
| | | @Override |