java 图片八分标
public void import6(){ TagImgFilter filter = new TagImgFilter(); filter.setEq_orgId("c1fa7ba875fa4c9a899e2787eb79e802"); filter.setEq_setId("69f98b9be4174842a101b211ae0058c5"); filter.setEq_typeId("0835426e62e24b309272cd73f58d0fee"); filter.setNull_tagJson(false);// 是否要有标注的,true是没标注 List<TagImg> imgList = tagImgService.selectAll(filter); System.out.println(imgList.size()); int countadd = 0; for (TagImg tagimg : imgList) { countadd++; System.out.println(countadd); JSONArray array=JSONArray.parseArray(tagimg.getTagJson());//得到原来大框的json JSONObject jsonObj = array.getJSONObject(0); JSONArray arrayNew=new JSONArray(); int j = 0; for(int i=1;i<=8;i++){ JSONObject obj = new JSONObject(); if(i%2!=0){//单数1、3、5、7 obj.put("x", jsonObj.getDouble("x")); obj.put("y", jsonObj.getDouble("y")+(jsonObj.getDouble("height")/4)*j); }else{//双数2、4、6、8 obj.put("x", jsonObj.getDouble("x")+jsonObj.getDouble("width")/2); obj.put("y", jsonObj.getDouble("y")+(jsonObj.getDouble("height")/4)*j); j++; } obj.put("width", jsonObj.getDouble("width")/2); obj.put("height",jsonObj.getDouble("height")/4); obj.put("mark", i); arrayNew.add(obj); } System.out.println(arrayNew); tagimg.setTagJson(arrayNew.toString());// 带了标注 tagImgService.save(tagimg); } /*if(countadd==1){ break; }*/ }