佐证材料改为由c端提交,后端只接收字符串
This commit is contained in:
parent
46e92f405b
commit
9fe7ed4ef6
@ -45,8 +45,8 @@ public class SnsUserReportController extends BaseControllerImpl {
|
||||
*/
|
||||
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
||||
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
||||
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
||||
return snsUserReportService.submitReport(snsUserReport,files);
|
||||
public CommonResult submitReport(@Validated @RequestBody SnsUserReport snsUserReport) {
|
||||
return snsUserReportService.submitReport(snsUserReport);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -45,8 +45,8 @@ public class SnsUserReportMobileController extends BaseControllerImpl {
|
||||
*/
|
||||
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
||||
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
||||
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
||||
return snsUserReportService.submitReport(snsUserReport,files);
|
||||
public CommonResult submitReport(@Validated @RequestBody SnsUserReport snsUserReport) {
|
||||
return snsUserReportService.submitReport(snsUserReport);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import java.util.List;
|
||||
public interface SnsUserReportService extends IBaseService<SnsUserReport> {
|
||||
Page<SnsUserReport> findPageSnsUserReport(int pageNo, int pageSize);
|
||||
|
||||
CommonResult submitReport(SnsUserReport snsUserReport, List<MultipartFile> files);
|
||||
CommonResult submitReport(SnsUserReport snsUserReport);
|
||||
|
||||
CommonResult dealReport(SnsUserReport snsUserReport);
|
||||
}
|
||||
|
||||
@ -90,41 +90,51 @@ public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMappe
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public CommonResult submitReport(SnsUserReport snsUserReport,List<MultipartFile> files) {
|
||||
public CommonResult submitReport(SnsUserReport snsUserReport) {
|
||||
|
||||
if(files.isEmpty()){
|
||||
// if(files.isEmpty()){
|
||||
// return CommonResult.failed("举报佐证材料不能为空");
|
||||
// }
|
||||
|
||||
// if(files.size()>limtFiels){
|
||||
// return CommonResult.failed("文件数量不能超过3个");
|
||||
// }
|
||||
// List<ReportImageData> reportImageDatas = new ArrayList<>();
|
||||
// int i=1;//佐证材料编号
|
||||
// for(MultipartFile file:files){
|
||||
// int index=0;
|
||||
// while (index<3){
|
||||
// try {
|
||||
// CommonResult commonResult= shopService.uploadFile(file);
|
||||
// Map<String, Object> data = (Map<String, Object>) commonResult.getData();
|
||||
// ReportImageData reportImageData=new ReportImageData();
|
||||
// if(ObjectUtil.isNotEmpty(data.get("url"))){
|
||||
// reportImageData.setUrl(String.valueOf(data.get("url")));
|
||||
// reportImageData.setDescription("举报佐证材料"+i);
|
||||
// reportImageDatas.add(reportImageData);
|
||||
// i++;
|
||||
// }
|
||||
// break;
|
||||
// }catch (Exception e){
|
||||
// index++;
|
||||
// if(index==3){
|
||||
// throw new ApiException(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//Gson gson = new Gson();
|
||||
//String evedenceImageDatas= gson.toJson(reportImageDatas);
|
||||
|
||||
if(StringUtils.isEmpty(snsUserReport.getEvidenceImages())){
|
||||
return CommonResult.failed("举报佐证材料不能为空");
|
||||
}
|
||||
|
||||
if(files.size()>limtFiels){
|
||||
return CommonResult.failed("文件数量不能超过3个");
|
||||
Gson gson=new Gson();
|
||||
List<ReportImageData> reportImageData= gson.fromJson(snsUserReport.getEvidenceImages(), new TypeToken<List<ReportImageData>>(){}.getType());
|
||||
String evedenceImageDatas= gson.toJson(reportImageData);
|
||||
if(!checkoutImageUrl(reportImageData)){
|
||||
return CommonResult.failed("处理佐证材料格式不正确");
|
||||
}
|
||||
List<ReportImageData> reportImageDatas = new ArrayList<>();
|
||||
int i=1;//佐证材料编号
|
||||
for(MultipartFile file:files){
|
||||
int index=0;
|
||||
while (index<3){
|
||||
try {
|
||||
CommonResult commonResult= shopService.uploadFile(file);
|
||||
Map<String, Object> data = (Map<String, Object>) commonResult.getData();
|
||||
ReportImageData reportImageData=new ReportImageData();
|
||||
if(ObjectUtil.isNotEmpty(data.get("url"))){
|
||||
reportImageData.setUrl(String.valueOf(data.get("url")));
|
||||
reportImageData.setDescription("举报佐证材料"+i);
|
||||
reportImageDatas.add(reportImageData);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}catch (Exception e){
|
||||
index++;
|
||||
if(index==3){
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
String evedenceImageDatas= gson.toJson(reportImageDatas);
|
||||
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
assert userDto != null;
|
||||
@ -251,6 +261,7 @@ public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMappe
|
||||
for(String domain:domains){//校验https地址
|
||||
if(reportImageData.getUrl().contains(domain)){
|
||||
flag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user