Compare commits
2 Commits
14f4f50e18
...
240c5a5888
| Author | SHA1 | Date | |
|---|---|---|---|
| 240c5a5888 | |||
| 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import com.suisung.mall.sns.service.SnsUserReportService;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -30,10 +29,6 @@ import java.util.*;
|
|||||||
@Service
|
@Service
|
||||||
@lombok.extern.slf4j.Slf4j
|
@lombok.extern.slf4j.Slf4j
|
||||||
public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMapper, SnsUserReport> implements SnsUserReportService {
|
public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMapper, SnsUserReport> implements SnsUserReportService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ShopService shopService;
|
|
||||||
|
|
||||||
private final static Set<Integer> processingStatusList= Collections.unmodifiableSet(new HashSet<>(
|
private final static Set<Integer> processingStatusList= Collections.unmodifiableSet(new HashSet<>(
|
||||||
Arrays.asList(1,2,3)
|
Arrays.asList(1,2,3)
|
||||||
));
|
));
|
||||||
@ -90,41 +85,54 @@ 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("举报佐证材料不能为空");
|
||||||
}
|
}
|
||||||
|
Gson gson=new Gson();
|
||||||
if(files.size()>limtFiels){
|
List<ReportImageData> reportImageData= gson.fromJson(snsUserReport.getEvidenceImages(), new TypeToken<List<ReportImageData>>(){}.getType());
|
||||||
return CommonResult.failed("文件数量不能超过3个");
|
if(reportImageData.size()>limtFiels){
|
||||||
|
return CommonResult.failed("佐证材料不能超过3个");
|
||||||
}
|
}
|
||||||
List<ReportImageData> reportImageDatas = new ArrayList<>();
|
String evedenceImageDatas= gson.toJson(reportImageData);
|
||||||
int i=1;//佐证材料编号
|
if(!checkoutImageUrl(reportImageData)){
|
||||||
for(MultipartFile file:files){
|
return CommonResult.failed("处理佐证材料格式不正确");
|
||||||
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();
|
UserDto userDto= ContextUtil.getCurrentUser();
|
||||||
assert userDto != null;
|
assert userDto != null;
|
||||||
@ -251,6 +259,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