Compare commits
No commits in common. "240c5a58883c8b45041e078166424f3bfe6c6504" and "14f4f50e189073c86bd4edc39733f50ad114097e" have entirely different histories.
240c5a5888
...
14f4f50e18
@ -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 @RequestBody SnsUserReport snsUserReport) {
|
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
||||||
return snsUserReportService.submitReport(snsUserReport);
|
return snsUserReportService.submitReport(snsUserReport,files);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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 @RequestBody SnsUserReport snsUserReport) {
|
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
||||||
return snsUserReportService.submitReport(snsUserReport);
|
return snsUserReportService.submitReport(snsUserReport,files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
CommonResult submitReport(SnsUserReport snsUserReport, List<MultipartFile> files);
|
||||||
|
|
||||||
CommonResult dealReport(SnsUserReport snsUserReport);
|
CommonResult dealReport(SnsUserReport snsUserReport);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ 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.*;
|
||||||
|
|
||||||
@ -29,6 +30,10 @@ 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)
|
||||||
));
|
));
|
||||||
@ -85,54 +90,41 @@ public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMappe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = RuntimeException.class)
|
@Transactional(rollbackFor = RuntimeException.class)
|
||||||
public CommonResult submitReport(SnsUserReport snsUserReport) {
|
public CommonResult submitReport(SnsUserReport snsUserReport,List<MultipartFile> files) {
|
||||||
|
|
||||||
// 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();
|
|
||||||
List<ReportImageData> reportImageData= gson.fromJson(snsUserReport.getEvidenceImages(), new TypeToken<List<ReportImageData>>(){}.getType());
|
if(files.size()>limtFiels){
|
||||||
if(reportImageData.size()>limtFiels){
|
return CommonResult.failed("文件数量不能超过3个");
|
||||||
return CommonResult.failed("佐证材料不能超过3个");
|
|
||||||
}
|
}
|
||||||
String evedenceImageDatas= gson.toJson(reportImageData);
|
List<ReportImageData> reportImageDatas = new ArrayList<>();
|
||||||
if(!checkoutImageUrl(reportImageData)){
|
int i=1;//佐证材料编号
|
||||||
return CommonResult.failed("处理佐证材料格式不正确");
|
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();
|
UserDto userDto= ContextUtil.getCurrentUser();
|
||||||
assert userDto != null;
|
assert userDto != null;
|
||||||
@ -259,7 +251,6 @@ 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