佐证材料改为由c端提交,后端只接收字符串
This commit is contained in:
parent
14f4f50e18
commit
8aaf818329
@ -45,8 +45,8 @@ public class SnsUserReportController extends BaseControllerImpl {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
||||||
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
||||||
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
public CommonResult submitReport(@Validated @RequestBody SnsUserReport snsUserReport) {
|
||||||
return snsUserReportService.submitReport(snsUserReport,files);
|
return snsUserReportService.submitReport(snsUserReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -45,8 +45,8 @@ public class SnsUserReportMobileController extends BaseControllerImpl {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
||||||
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
||||||
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
public CommonResult submitReport(@Validated @RequestBody SnsUserReport snsUserReport) {
|
||||||
return snsUserReportService.submitReport(snsUserReport,files);
|
return snsUserReportService.submitReport(snsUserReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
public interface SnsUserReportService extends IBaseService<SnsUserReport> {
|
public interface SnsUserReportService extends IBaseService<SnsUserReport> {
|
||||||
Page<SnsUserReport> findPageSnsUserReport(int pageNo, int pageSize);
|
Page<SnsUserReport> findPageSnsUserReport(int pageNo, int pageSize);
|
||||||
|
|
||||||
CommonResult submitReport(SnsUserReport snsUserReport, List<MultipartFile> files);
|
CommonResult submitReport(SnsUserReport snsUserReport);
|
||||||
|
|
||||||
CommonResult dealReport(SnsUserReport snsUserReport);
|
CommonResult dealReport(SnsUserReport snsUserReport);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,41 +90,51 @@ public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMappe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = RuntimeException.class)
|
@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("举报佐证材料不能为空");
|
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();
|
Gson gson=new Gson();
|
||||||
String evedenceImageDatas= gson.toJson(reportImageDatas);
|
List<ReportImageData> reportImageData= gson.fromJson(snsUserReport.getEvidenceImages(), new TypeToken<List<ReportImageData>>(){}.getType());
|
||||||
|
String evedenceImageDatas= gson.toJson(reportImageData);
|
||||||
|
if(!checkoutImageUrl(reportImageData)){
|
||||||
|
return CommonResult.failed("处理佐证材料格式不正确");
|
||||||
|
}
|
||||||
|
|
||||||
UserDto userDto= ContextUtil.getCurrentUser();
|
UserDto userDto= ContextUtil.getCurrentUser();
|
||||||
assert userDto != null;
|
assert userDto != null;
|
||||||
@ -251,6 +261,7 @@ public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMappe
|
|||||||
for(String domain:domains){//校验https地址
|
for(String domain:domains){//校验https地址
|
||||||
if(reportImageData.getUrl().contains(domain)){
|
if(reportImageData.getUrl().contains(domain)){
|
||||||
flag=true;
|
flag=true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!flag){
|
if(!flag){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user