hyx_2024-10-12_xgfPerson
shanao 2024-09-08 22:06:08 +08:00
parent a5b76b25df
commit 5197b10d4e
4 changed files with 49 additions and 20 deletions

View File

@ -140,7 +140,7 @@ public class AccidentRecordsController extends BaseController {
* @return
*/
@RequestMapping("/import/photos")
public Map<String, Object> importPhotos(@RequestParam("file") MultipartFile file) {
public Map<String, Object> importPhotos(@RequestParam MultipartFile file) {
if (file == null || file.isEmpty()) {
throw new RuntimeException("文件不能为空");
}
@ -150,6 +150,23 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
*
*
* @param path
* @return
*/
@RequestMapping("/delete/photos/{path}")
public Map<String, Object> deletePhotos(@PathVariable("path") String path) {
if (StrUtil.isEmpty(path)) {
throw new RuntimeException("路径不能为空");
}
accidentRecordsService.deletePhotos(path);
Map<String, Object> result = new HashMap<>();
result.put("result", "success"); // 路径
return result;
}
/**
*
*

View File

@ -77,4 +77,11 @@ public interface AccidentRecordsService {
* @param response
*/
void viewPhotos(String path, HttpServletResponse response);
/**
*
*
* @param path
*/
void deletePhotos(String path);
}

View File

@ -179,4 +179,9 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
}
ServletUtil.write(response, FileUtil.touch(path));
}
@Override
public void deletePhotos(String path) {
FileUtil.del("./image/" + path);
}
}

View File

@ -34,26 +34,26 @@
<select id="getById" resultType="com.zcloud.entity.PageData">
select id,
incident_number,
incident_name,
incident_type,
incident_level,
incident_number as incidentNumber,
incident_name as incidentName,
incident_type as incidentName,
incident_level as incidentLevel,
CORP_NAME as companyName,
incident_nature,
`location`,
incident_date,
direct_loss,
injured,
fatalities,
seriously_injured,
cause,
summary,
photos,
analysis,
suggestions,
measures,
ar.creator,
report_date
incident_nature as incidentNature,
`location` as location,
incident_date as incidentDate,
direct_loss as directLoss,
injured as injured,
fatalities as fatalities,
seriously_injured as seriouslyInjured,
cause as cause,
summary as summary,
photos as photos,
analysis as analysis,
suggestions as suggestions,
measures as measures,
ar.creator as creator,
report_date as reportDate
from accident_records as ar
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
where ar.id = #{id}