diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrTaskchildDubiousFileController.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrTaskchildDubiousFileController.java index 469738ac..28a63487 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrTaskchildDubiousFileController.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrTaskchildDubiousFileController.java @@ -68,13 +68,9 @@ public class OcrTaskchildDubiousFileController { QueryWrapper dubiouswrapper = new QueryWrapper<>(); dubiouswrapper.eq("userid",userToken.getUserid()); List list = ocrTaskchildDubiousFileService.list(dubiouswrapper); - - - -// for (OcrTaskchildDubiousFile ocrtaskchilddubiousfile:list){ -// ocrtaskchilddubiousfile.getPictureId() -// } - + if(list.size()==0){ + return ResultVoUtil.success(); + } IPage iPage = new Page<>(Integer.valueOf(pageNo),Integer.valueOf(pageSize)); QueryWrapper wrapper = new QueryWrapper<>(); @@ -139,7 +135,7 @@ public class OcrTaskchildDubiousFileController { * @return */ @RequestMapping(value = "/dubiousfileyd", method = RequestMethod.GET) - public ResultVo dubiousfileyd(HttpServletRequest request, @RequestParam(value = "taskchildid", required = true) String taskchildid) { + public ResultVo dubiousfileyd(HttpServletRequest request, @RequestParam(value = "pictureid", required = true) String pictureid) { String tenantId = request.getHeader("X-Tenant-Id"); if(StringUtils.isBlank(tenantId)){ @@ -150,35 +146,57 @@ public class OcrTaskchildDubiousFileController { UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request)); List list=new ArrayList<>(); - String[] taskchildid1 = taskchildid.toString().split(","); + String[] taskchildid1 = pictureid.toString().split(","); for (String asd:taskchildid1){ QueryWrapper filewrapper = new QueryWrapper<>(); - filewrapper.eq("taskchild_id",asd).eq("userid",userToken.getUserid()); + filewrapper.eq("picture_id",asd).eq("userid",userToken.getUserid()); OcrTaskchildDubiousFile one1 = ocrTaskchildDubiousFileService.getOne(filewrapper); - if(!asd.equals(one1.getTaskchildId())){ + if (null==one1){ OcrTaskchildDubiousFile ocrtaskchilddubiousfile=new OcrTaskchildDubiousFile(); - ocrtaskchilddubiousfile.setTaskchildId(Long.parseLong(asd)); + ocrtaskchilddubiousfile.setPictureId(Long.parseLong(asd)); ocrtaskchilddubiousfile.setTenantid(Long.parseLong(tenantId)); ocrtaskchilddubiousfile.setUserid(Long.parseLong(userToken.getUserid())); ocrtaskchilddubiousfile.setCreatedate(System.currentTimeMillis()); + QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("ID",asd); + wrapper.eq("PICTUREID",asd); OcrTaskchildPicture one = ocrtaskchildpictureservice.getOne(wrapper); - ocrtaskchilddubiousfile.setPictureId(one.getPictureid()); + ocrtaskchilddubiousfile.setTaskchildId(one.getId()); UpdateWrapper updatewrapper = new UpdateWrapper<>(); - updatewrapper.eq("ID", one.getPictureid()).set("suspiciousfile","1"); + updatewrapper.eq("ID", asd).set("suspiciousfile","1"); ocrpictureservice.update(updatewrapper); list.add(ocrtaskchilddubiousfile); + }else { + if (!asd.equals(one1.getPictureId().toString())) { + OcrTaskchildDubiousFile ocrtaskchilddubiousfile=new OcrTaskchildDubiousFile(); + ocrtaskchilddubiousfile.setPictureId(Long.parseLong(asd)); + ocrtaskchilddubiousfile.setTenantid(Long.parseLong(tenantId)); + ocrtaskchilddubiousfile.setUserid(Long.parseLong(userToken.getUserid())); + ocrtaskchilddubiousfile.setCreatedate(System.currentTimeMillis()); + + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("PICTUREID",asd); + OcrTaskchildPicture one = ocrtaskchildpictureservice.getOne(wrapper); + ocrtaskchilddubiousfile.setTaskchildId(one.getId()); + + UpdateWrapper updatewrapper = new UpdateWrapper<>(); + updatewrapper.eq("ID", asd).set("suspiciousfile","1"); + + ocrpictureservice.update(updatewrapper); + + list.add(ocrtaskchilddubiousfile); + } } } - return ocrTaskchildDubiousFileService.saveBatch(list)?ResultVoUtil.success():ResultVoUtil.error(); + return ocrTaskchildDubiousFileService.saveBatch(list)?ResultVoUtil.success():ResultVoUtil.error("当前图片已添加过了"); } }