Răsfoiți Sursa

20190102识别图管理

suochencheng 7 ani în urmă
părinte
comite
23d8d01fa8
55 a modificat fișierele cu 426 adăugiri și 84 ștergeri
  1. 37 0
      log.txt
  2. 71 0
      src/main/java/com/izouma/awesomeadmin/model/VuforiaTarget.java
  3. 5 1
      src/main/java/com/izouma/awesomeadmin/service/VuforiaImageInfoService.java
  4. 64 4
      src/main/java/com/izouma/awesomeadmin/service/impl/VuforiaImageInfoServiceImpl.java
  5. 24 0
      src/main/java/com/izouma/awesomeadmin/vuforia/DeleteTarget.java
  6. 97 4
      src/main/java/com/izouma/awesomeadmin/vuforia/VuforiaUtil.java
  7. 61 56
      src/main/java/com/izouma/awesomeadmin/web/VuforiaImageInfoController.java
  8. 13 5
      src/main/vue/src/components/VuforiaImageInfo.vue
  9. 14 4
      src/main/vue/src/components/VuforiaImageInfos.vue
  10. 8 3
      src/main/vue/src/pages/VuforiaImageInfo.vue
  11. 9 4
      src/main/vue/src/pages/VuforiaImageInfos.vue
  12. 1 1
      src/main/webapp/WEB-INF/html/admin.html
  13. 1 1
      src/main/webapp/WEB-INF/html/loginAdmin.html
  14. 0 0
      src/main/webapp/static/js/21.086cc785a3b470339c35.js
  15. 0 0
      src/main/webapp/static/js/22.7da53de2e213be07f214.js
  16. 0 0
      src/main/webapp/static/js/23.8d187990f448d6f48a4c.js
  17. 0 0
      src/main/webapp/static/js/24.2438e0b4ccc5568715b8.js
  18. 0 0
      src/main/webapp/static/js/25.5fb700b08a0877440593.js
  19. 0 0
      src/main/webapp/static/js/26.b5fe423b3c16ed41cf27.js
  20. 0 0
      src/main/webapp/static/js/27.5b55df645a7d0d7f60af.js
  21. 0 0
      src/main/webapp/static/js/28.38f546a173a7d6ef39f1.js
  22. 0 0
      src/main/webapp/static/js/29.22a97493903971d34666.js
  23. 0 0
      src/main/webapp/static/js/30.19e0a8bdc2dc078523a2.js
  24. 0 0
      src/main/webapp/static/js/31.c7a94cb986ef379e2d86.js
  25. 0 0
      src/main/webapp/static/js/32.46264a24f69079fc2526.js
  26. 0 0
      src/main/webapp/static/js/33.1786477b948415455d6c.js
  27. 0 0
      src/main/webapp/static/js/34.2b953a54aa9fa24921a7.js
  28. 0 0
      src/main/webapp/static/js/35.444d017f53ef1f93f9b0.js
  29. 0 0
      src/main/webapp/static/js/36.3abc3886147e7fd17908.js
  30. 0 0
      src/main/webapp/static/js/37.9b8083d5385c6704ab8d.js
  31. 0 0
      src/main/webapp/static/js/37.ae929f8d43fdee3a2080.js
  32. 0 0
      src/main/webapp/static/js/55.6983f73c27006008dec0.js
  33. 0 0
      src/main/webapp/static/js/56.e4452ef09a2b624ff074.js
  34. 0 0
      src/main/webapp/static/js/57.ba4acc50c81ef7581439.js
  35. 0 0
      src/main/webapp/static/js/58.eb38c9ca25c5c3402e2f.js
  36. 0 0
      src/main/webapp/static/js/59.8d5902b233e551d960e1.js
  37. 0 0
      src/main/webapp/static/js/60.5f9b7a50a1f056a089b3.js
  38. 0 0
      src/main/webapp/static/js/61.eb4f057b4ec7388c4ae4.js
  39. 0 0
      src/main/webapp/static/js/62.da6081b62568d63fa941.js
  40. 0 0
      src/main/webapp/static/js/63.1759c519a1abe730ea31.js
  41. 0 0
      src/main/webapp/static/js/64.b26ee0628d61c9865ff4.js
  42. 0 0
      src/main/webapp/static/js/65.91a5ce5edb88c4534173.js
  43. 0 0
      src/main/webapp/static/js/66.5ff5c813897f13f3233a.js
  44. 0 0
      src/main/webapp/static/js/67.693fd7516cdb38f4eb9a.js
  45. 0 0
      src/main/webapp/static/js/68.535a5cc70e2e840321ba.js
  46. 0 0
      src/main/webapp/static/js/69.88ce0b888c1d832680dd.js
  47. 0 0
      src/main/webapp/static/js/7.cd0dccd62db355e48f43.js
  48. 0 0
      src/main/webapp/static/js/70.2e7df97468ff7ff45ffc.js
  49. 0 0
      src/main/webapp/static/js/71.0b765e29dd525e0bc46d.js
  50. 0 0
      src/main/webapp/static/js/72.4021fcfdb01ebe241f95.js
  51. 0 0
      src/main/webapp/static/js/72.d4c3c93d2437c9dff376.js
  52. 0 0
      src/main/webapp/static/js/admin.00a9852ea8d0bdb19362.js
  53. 0 0
      src/main/webapp/static/js/manifest.14228c000857a7011b18.js
  54. 0 0
      src/main/webapp/static/js/manifest.6f19a3433eca47fa8152.js
  55. 21 1
      src/test/java/VuforialUtilTest.java

+ 37 - 0
log.txt

@@ -81,3 +81,40 @@ java.io.IOException: Attempted read from closed stream.
 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
 [2018-12-29 15:15:26] [WARN ] - Bad pool size config, start 3 < min 5. Using 5 as start.
+[2019-01-02 16:39:27] [WARN ] - Bad pool size config, start 3 < min 5. Using 5 as start.
+[2019-01-02 17:12:39] [WARN ] - Bad pool size config, start 3 < min 5. Using 5 as start.
+[2019-01-02 17:14:37] [ERROR] - getTarget 获取识别图异常
+org.json.JSONException: JSONObject["target_record"] not a string.
+	at org.json.JSONObject.getString(JSONObject.java:721)
+	at com.izouma.awesomeadmin.vuforia.VuforiaUtil.getTarget(VuforiaUtil.java:216)
+	at VuforialUtilTest.GetTargetTest(VuforialUtilTest.java:45)
+	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
+	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+	at java.lang.reflect.Method.invoke(Method.java:498)
+	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
+	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
+	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
+	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
+	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
+	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
+	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
+	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
+	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
+	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
+	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
+	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
+	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
+	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
+	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
+	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
+	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
+	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
+	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
+	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
+	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
+	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
+	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
+	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
+[2019-01-02 17:14:54] [WARN ] - Bad pool size config, start 3 < min 5. Using 5 as start.
+[2019-01-02 17:44:01] [WARN ] - Bad pool size config, start 3 < min 5. Using 5 as start.

+ 71 - 0
src/main/java/com/izouma/awesomeadmin/model/VuforiaTarget.java

@@ -0,0 +1,71 @@
+package com.izouma.awesomeadmin.model;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+
+@JsonAutoDetect
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class VuforiaTarget {
+
+    private String targetId;
+
+    private Boolean activeFlag;
+
+    private String name;
+
+    private Double width;
+
+    private Integer trackingRating;
+
+    private String recoRating;
+
+    public String getTargetId() {
+        return targetId;
+    }
+
+    public void setTargetId(String targetId) {
+        this.targetId = targetId;
+    }
+
+    public Boolean getActiveFlag() {
+        return activeFlag;
+    }
+
+    public void setActiveFlag(Boolean activeFlag) {
+        this.activeFlag = activeFlag;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Double getWidth() {
+        return width;
+    }
+
+    public void setWidth(Double width) {
+        this.width = width;
+    }
+
+    public Integer getTrackingRating() {
+        return trackingRating;
+    }
+
+    public void setTrackingRating(Integer trackingRating) {
+        this.trackingRating = trackingRating;
+    }
+
+    public String getRecoRating() {
+        return recoRating;
+    }
+
+    public void setRecoRating(String recoRating) {
+        this.recoRating = recoRating;
+    }
+}
+

+ 5 - 1
src/main/java/com/izouma/awesomeadmin/service/VuforiaImageInfoService.java

@@ -2,7 +2,9 @@ package com.izouma.awesomeadmin.service;
 
 import java.util.*;
 import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.VuforiaImageInfo;
+import com.izouma.awesomeadmin.model.VuforiaTarget;
 
 
 /**
@@ -20,8 +22,10 @@ public interface VuforiaImageInfoService{
 
     boolean createVuforiaImageInfo(VuforiaImageInfo record);
 
-    boolean deleteVuforiaImageInfo(VuforiaImageInfo record);
+    Result deleteVuforiaImageInfo(VuforiaImageInfo record);
 
     boolean updateVuforiaImageInfo(VuforiaImageInfo record);
+
+    VuforiaTarget getVuforiaTarget(String id);
 }
 

+ 64 - 4
src/main/java/com/izouma/awesomeadmin/service/impl/VuforiaImageInfoServiceImpl.java

@@ -3,7 +3,9 @@ package com.izouma.awesomeadmin.service.impl;
 import java.util.*;
 
 import com.izouma.awesomeadmin.dao.VuforiaImageGroupMapper;
+import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.VuforiaImageGroup;
+import com.izouma.awesomeadmin.model.VuforiaTarget;
 import com.izouma.awesomeadmin.vuforia.VuforiaUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
@@ -74,6 +76,38 @@ public class VuforiaImageInfoServiceImpl implements VuforiaImageInfoService {
         return null;
     }
 
+    @Override
+    public VuforiaTarget getVuforiaTarget(String id) {
+
+        logger.info("getVuforiaTarget");
+        try {
+
+            VuforiaImageInfo vuforiaImageInfo = vuforiaImageInfoMapper.selectByPrimaryKey(Integer.valueOf(id));
+
+            if (StringUtils.isNotEmpty(vuforiaImageInfo.getVuforiaImageGroupId())) {
+                VuforiaImageGroup vuforiaImageGroup = vuforiaImageGroupMapper.selectByPrimaryKey(Integer.valueOf(vuforiaImageInfo.getVuforiaImageGroupId()));
+
+                if (vuforiaImageGroup != null) {
+
+                    String accessKey = vuforiaImageGroup.getAccessKey();
+                    String secretKey = vuforiaImageGroup.getSecretKey();
+                    String targetId = vuforiaImageInfo.getTargetId();
+
+                    if (StringUtils.isNotEmpty(accessKey) && StringUtils.isNotEmpty(secretKey) && StringUtils.isNotEmpty(targetId)) {
+                        return VuforiaUtil.getTarget(targetId, accessKey, secretKey);
+                    }
+
+
+                }
+            }
+
+        } catch (Exception e) {
+            logger.error("getVuforiaTarget", e);
+        }
+
+        return null;
+    }
+
     @Override
     public VuforiaImageInfo getVuforiaImageInfo(VuforiaImageInfo record) {
 
@@ -132,21 +166,47 @@ public class VuforiaImageInfoServiceImpl implements VuforiaImageInfoService {
     }
 
     @Override
-    public boolean deleteVuforiaImageInfo(VuforiaImageInfo record) {
+    public Result deleteVuforiaImageInfo(VuforiaImageInfo record) {
 
         logger.info("deleteVuforiaImageInfo");
         try {
 
+            VuforiaImageInfo vuforiaImageInfo = vuforiaImageInfoMapper.selectByPrimaryKey(record.getId());
+
+            if (StringUtils.isNotEmpty(vuforiaImageInfo.getVuforiaImageGroupId())) {
+                VuforiaImageGroup vuforiaImageGroup = vuforiaImageGroupMapper.selectByPrimaryKey(Integer.valueOf(vuforiaImageInfo.getVuforiaImageGroupId()));
+
+                if (vuforiaImageGroup != null) {
+
+                    String accessKey = vuforiaImageGroup.getAccessKey();
+                    String secretKey = vuforiaImageGroup.getSecretKey();
+                    String targetId = vuforiaImageInfo.getTargetId();
+
+                    if (StringUtils.isNotEmpty(accessKey) && StringUtils.isNotEmpty(secretKey) && StringUtils.isNotEmpty(targetId)) {
+                        String result_code = VuforiaUtil.deleteTarget(targetId, accessKey, secretKey);
+                        if (!"Success".equals(result_code) && !"UnknownTarget".equals(result_code)) {
+                            return new Result(false, "删除失败:" + result_code + ",请稍后再试!");
+                        }
+
+                    }
+
+
+                }
+            }
+
+
             int updates = vuforiaImageInfoMapper.delete(record);
 
             if (updates > 0) {
-                return true;
+
+
+                return new Result(true, "删除成功");
             }
         } catch (Exception e) {
             logger.error("deleteVuforiaImageInfo", e);
         }
 
-        return false;
+        return new Result(false, "删除异常");
     }
 
     @Override
@@ -189,7 +249,7 @@ public class VuforiaImageInfoServiceImpl implements VuforiaImageInfoService {
                         if (StringUtils.isNotEmpty(accessKey) && StringUtils.isNotEmpty(secretKey) && StringUtils.isNotEmpty(targetId)) {
 
                             if (StringUtils.isNotEmpty(targetName) || StringUtils.isNotEmpty(imageUrl)) {
-                                VuforiaUtil.updateTarget(targetId, targetName, 0, imageUrl, accessKey, secretKey);
+                                VuforiaUtil.updateTarget(targetId, targetName, 0, imageUrl, accessKey, secretKey, null);
                             }
 
 

+ 24 - 0
src/main/java/com/izouma/awesomeadmin/vuforia/DeleteTarget.java

@@ -119,4 +119,28 @@ public class DeleteTarget implements TargetStatusListener {
 		DeleteTarget d = new DeleteTarget();
 		d.deactivateThenDeleteTarget();
 	}
+
+	public String getAccessKey() {
+		return accessKey;
+	}
+
+	public void setAccessKey(String accessKey) {
+		this.accessKey = accessKey;
+	}
+
+	public String getSecretKey() {
+		return secretKey;
+	}
+
+	public void setSecretKey(String secretKey) {
+		this.secretKey = secretKey;
+	}
+
+	public String getTargetId() {
+		return targetId;
+	}
+
+	public void setTargetId(String targetId) {
+		this.targetId = targetId;
+	}
 }

+ 97 - 4
src/main/java/com/izouma/awesomeadmin/vuforia/VuforiaUtil.java

@@ -2,6 +2,7 @@ package com.izouma.awesomeadmin.vuforia;
 
 import com.google.gson.Gson;
 import com.izouma.awesomeadmin.dto.wx.TemplateMessage;
+import com.izouma.awesomeadmin.model.VuforiaTarget;
 import com.izouma.awesomeadmin.util.MbappUtil;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.FileUtils;
@@ -10,9 +11,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.ParseException;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.methods.*;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.impl.cookie.DateUtils;
@@ -95,7 +94,7 @@ public class VuforiaUtil {
     }
 
 
-    public static String updateTarget(String targetId, String targetName, double width, String imageUrl, String accessKey, String secretKey) {
+    public static String updateTarget(String targetId, String targetName, double width, String imageUrl, String accessKey, String secretKey, Boolean b) {
 
         try {
             HttpPut putRequest = new HttpPut();
@@ -118,6 +117,11 @@ public class VuforiaUtil {
                 requestBody.put("image", Base64.encodeBase64String(image)); // Mandatory
             }
 
+            if (b != null) {
+                requestBody.put("active_flag", b);// add a JSON field for the active_flag
+            }
+
+
             putRequest.setEntity(new StringEntity(requestBody.toString()));
             //setHeaders(putRequest); // Must be done after setting the body
 
@@ -142,6 +146,95 @@ public class VuforiaUtil {
         return null;
     }
 
+    /**
+     * 删除
+     *
+     * @param targetId
+     * @param accessKey
+     * @param secretKey
+     */
+    public static String deleteTarget(String targetId, String accessKey, String secretKey) {
+
+        try {
+
+
+            HttpDelete deleteRequest = new HttpDelete();
+            HttpClient client = new DefaultHttpClient();
+            deleteRequest.setURI(new URI(VUFORIA_URL + "/targets/" + targetId));
+
+            SignatureBuilder sb = new SignatureBuilder();
+            deleteRequest.setHeader(new BasicHeader("Date", DateUtils.formatDate(new Date()).replaceFirst("[+]00:00$", "")));
+            deleteRequest.setHeader("Authorization", "VWS " + accessKey + ":" + sb.tmsSignature(deleteRequest, secretKey));
+
+            HttpResponse response = client.execute(deleteRequest);
+            String resultStr = EntityUtils.toString(response.getEntity());
+            System.out.println(resultStr);
+
+            JSONObject jobj = new JSONObject(resultStr);
+
+            String result_code = jobj.has("result_code") ? jobj.getString("result_code") : "";
+
+            return result_code;
+
+        } catch (Exception e) {
+            logger.error("deleteTarget 删除识别图异常", e);
+        }
+        return null;
+    }
+
+    /**
+     * 获取基本信息
+     *
+     * @param targetId
+     * @param accessKey
+     * @param secretKey
+     * @return
+     */
+    public static VuforiaTarget getTarget(String targetId, String accessKey, String secretKey) {
+
+        try {
+
+
+            HttpGet getRequest = new HttpGet();
+            HttpClient client = new DefaultHttpClient();
+            getRequest.setURI(new URI(VUFORIA_URL + "/targets/" + targetId));
+
+            SignatureBuilder sb = new SignatureBuilder();
+            getRequest.setHeader(new BasicHeader("Date", DateUtils.formatDate(new Date()).replaceFirst("[+]00:00$", "")));
+            getRequest.setHeader("Authorization", "VWS " + accessKey + ":" + sb.tmsSignature(getRequest, secretKey));
+
+            HttpResponse response = client.execute(getRequest);
+            String resultStr = EntityUtils.toString(response.getEntity());
+            System.out.println(resultStr);
+
+            JSONObject jobj = new JSONObject(resultStr);
+
+            String result_code = jobj.has("result_code") ? jobj.getString("result_code") : "";
+
+            if (StringUtils.isNotEmpty(result_code)) {
+                if ("Success".equals(result_code)) {
+                    JSONObject job = jobj.getJSONObject("target_record");
+
+                    VuforiaTarget vuforiaTarget = new VuforiaTarget();
+
+                    vuforiaTarget.setTargetId(job.getString("target_id"));
+                    vuforiaTarget.setActiveFlag(job.getBoolean("active_flag"));
+                    vuforiaTarget.setName(job.getString("name"));
+                    vuforiaTarget.setWidth(job.getDouble("width"));
+                    vuforiaTarget.setTrackingRating(job.getInt("tracking_rating"));
+                    vuforiaTarget.setRecoRating(job.getString("reco_rating"));
+
+                    return vuforiaTarget;
+
+                }
+            }
+
+        } catch (Exception e) {
+            logger.error("getTarget 获取识别图异常", e);
+        }
+        return null;
+    }
+
 
     public static byte[] readImg(String urlOrPath) {
 

+ 61 - 56
src/main/java/com/izouma/awesomeadmin/web/VuforiaImageInfoController.java

@@ -2,6 +2,7 @@ package com.izouma.awesomeadmin.web;
 
 import java.util.*;
 
+import com.izouma.awesomeadmin.model.VuforiaTarget;
 import com.izouma.awesomeadmin.util.ExportExcelUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresAuthentication;
@@ -18,8 +19,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 /**
-*  controller类
-*/
+ * controller类
+ */
 @Controller
 @RequestMapping("/vuforiaImageInfo")
 public class VuforiaImageInfoController {
@@ -28,8 +29,8 @@ public class VuforiaImageInfoController {
     private VuforiaImageInfoService vuforiaImageInfoService;
 
     /**
-    * <p>获取全部记录。</p>
-    */
+     * <p>获取全部记录。</p>
+     */
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
     public Result all(VuforiaImageInfo record) {
@@ -38,8 +39,8 @@ public class VuforiaImageInfoController {
     }
 
     /**
-    * <p>根据Id。</p>
-    */
+     * <p>根据Id。</p>
+     */
     @RequestMapping(value = "/getVuforiaImageInfo", method = RequestMethod.GET)
     @ResponseBody
     public Result getVuforiaImageInfo(@RequestParam(required = false, value = "id") String id) {
@@ -48,8 +49,8 @@ public class VuforiaImageInfoController {
     }
 
     /**
-    * <p>根据条件获取。</p>
-    */
+     * <p>根据条件获取。</p>
+     */
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @ResponseBody
     public Result getOne(VuforiaImageInfo record) {
@@ -57,16 +58,23 @@ public class VuforiaImageInfoController {
         return new Result(true, data);
     }
 
+    @RequestMapping(value = "/getTarget", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getTarget(@RequestParam(required = false, value = "id") String id) {
+        VuforiaTarget data = vuforiaImageInfoService.getVuforiaTarget(id);
+        return new Result(true, data);
+    }
+
 
     /**
-    * <p>分页查询。</p>
-    */
+     * <p>分页查询。</p>
+     */
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @ResponseBody
     public Result page(Page page, VuforiaImageInfo record) {
         Map<String, Object> result = new HashMap<>();
 
-        List<VuforiaImageInfo> pp =vuforiaImageInfoService.getVuforiaImageInfoByPage(page, record);
+        List<VuforiaImageInfo> pp = vuforiaImageInfoService.getVuforiaImageInfoByPage(page, record);
 
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
@@ -75,96 +83,93 @@ public class VuforiaImageInfoController {
 
 
     /**
-    * <p>保存。</p>
-    */
+     * <p>保存。</p>
+     */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ResponseBody
     public Result save(VuforiaImageInfo record) {
         boolean num = vuforiaImageInfoService.createVuforiaImageInfo(record);
         if (num) {
-        return new Result(true, record.getId());
+            return new Result(true, record.getId());
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>更新信息。</p>
-    */
+     * <p>更新信息。</p>
+     */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
     public Result updateVuforiaImageInfo(VuforiaImageInfo record) {
         boolean num = vuforiaImageInfoService.updateVuforiaImageInfo(record);
         if (num) {
-        return new Result(true, "保存成功");
+            return new Result(true, "保存成功");
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>删除。</p>
-    */
+     * <p>删除。</p>
+     */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @ResponseBody
     public Result deleteVuforiaImageInfo(VuforiaImageInfo record) {
 
-        boolean num = vuforiaImageInfoService.deleteVuforiaImageInfo(record);
-        if (num) {
-        return new Result(true, "删除成功");
-        }
-        return new Result(false, "删除异常");
+        return vuforiaImageInfoService.deleteVuforiaImageInfo(record);
     }
 
     /**
-    * 导出Excel
-    * @param request
-    * @param response
-    * @param record
-    * @throws Exception
-    */
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
     @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
     @ResponseBody
     public void exportExcel(HttpServletRequest request, HttpServletResponse response, VuforiaImageInfo record) throws Exception {
 
-    List<VuforiaImageInfo> vuforiaImageInfos = vuforiaImageInfoService.getVuforiaImageInfoList(record);
+        List<VuforiaImageInfo> vuforiaImageInfos = vuforiaImageInfoService.getVuforiaImageInfoList(record);
 
 
         String sheetName = "vuforia_image_info";
         String titleName = "识别图信息数据表";
         String fileName = "识别图信息表";
         int columnNumber = 20;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "ID" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "所属图集ID" ,   "识别图名称" ,   "识别图类型ID" ,   "区域标记编号" ,   "所属地标ID" ,   "AR内容组ID" ,   "坐标X" ,   "坐标Y" ,   "坐标Z" ,   "角度" ,   "备注1" ,   "备注2" ,   "备注3" ,   "识别图"  };
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"ID", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "所属图集ID", "识别图名称", "识别图类型ID", "区域标记编号", "所属地标ID", "AR内容组ID", "坐标X", "坐标Y", "坐标Z", "角度", "备注1", "备注2", "备注3", "识别图"};
         String[][] dataList = new String[vuforiaImageInfos.size()][20];
 
         for (int i = 0; i < vuforiaImageInfos.size(); i++) {
 
-                        dataList[i][0] = String.valueOf(vuforiaImageInfos.get(i).getId());
-                        dataList[i][1] = String.valueOf(vuforiaImageInfos.get(i).getDelFlag());
-                        dataList[i][2] = String.valueOf(vuforiaImageInfos.get(i).getUpdateTime());
-                        dataList[i][3] = String.valueOf(vuforiaImageInfos.get(i).getUpdateUser());
-                        dataList[i][4] = String.valueOf(vuforiaImageInfos.get(i).getCreateTime());
-                        dataList[i][5] = String.valueOf(vuforiaImageInfos.get(i).getCreateUser());
-                        dataList[i][6] = String.valueOf(vuforiaImageInfos.get(i).getVuforiaImageGroupId());
-                        dataList[i][7] = String.valueOf(vuforiaImageInfos.get(i).getName());
-                        dataList[i][8] = String.valueOf(vuforiaImageInfos.get(i).getVuforiaImageTypeId());
-                        dataList[i][9] = String.valueOf(vuforiaImageInfos.get(i).getAreaMarking());
-                        dataList[i][10] = String.valueOf(vuforiaImageInfos.get(i).getLandMarkId());
-                        dataList[i][11] = String.valueOf(vuforiaImageInfos.get(i).getArContentGroupId());
-                        dataList[i][12] = String.valueOf(vuforiaImageInfos.get(i).getPosX());
-                        dataList[i][13] = String.valueOf(vuforiaImageInfos.get(i).getPosY());
-                        dataList[i][14] = String.valueOf(vuforiaImageInfos.get(i).getPosZ());
-                        dataList[i][15] = String.valueOf(vuforiaImageInfos.get(i).getAngle());
-                        dataList[i][16] = String.valueOf(vuforiaImageInfos.get(i).getRemark1());
-                        dataList[i][17] = String.valueOf(vuforiaImageInfos.get(i).getRemark2());
-                        dataList[i][18] = String.valueOf(vuforiaImageInfos.get(i).getRemark3());
-                        dataList[i][19] = String.valueOf(vuforiaImageInfos.get(i).getVuforiaImage());
-                    }
+            dataList[i][0] = String.valueOf(vuforiaImageInfos.get(i).getId());
+            dataList[i][1] = String.valueOf(vuforiaImageInfos.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(vuforiaImageInfos.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(vuforiaImageInfos.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(vuforiaImageInfos.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(vuforiaImageInfos.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(vuforiaImageInfos.get(i).getVuforiaImageGroupId());
+            dataList[i][7] = String.valueOf(vuforiaImageInfos.get(i).getName());
+            dataList[i][8] = String.valueOf(vuforiaImageInfos.get(i).getVuforiaImageTypeId());
+            dataList[i][9] = String.valueOf(vuforiaImageInfos.get(i).getAreaMarking());
+            dataList[i][10] = String.valueOf(vuforiaImageInfos.get(i).getLandMarkId());
+            dataList[i][11] = String.valueOf(vuforiaImageInfos.get(i).getArContentGroupId());
+            dataList[i][12] = String.valueOf(vuforiaImageInfos.get(i).getPosX());
+            dataList[i][13] = String.valueOf(vuforiaImageInfos.get(i).getPosY());
+            dataList[i][14] = String.valueOf(vuforiaImageInfos.get(i).getPosZ());
+            dataList[i][15] = String.valueOf(vuforiaImageInfos.get(i).getAngle());
+            dataList[i][16] = String.valueOf(vuforiaImageInfos.get(i).getRemark1());
+            dataList[i][17] = String.valueOf(vuforiaImageInfos.get(i).getRemark2());
+            dataList[i][18] = String.valueOf(vuforiaImageInfos.get(i).getRemark3());
+            dataList[i][19] = String.valueOf(vuforiaImageInfos.get(i).getVuforiaImage());
+        }
 
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
-        columnNumber, columnWidth, columnName, dataList, response);
+                columnNumber, columnWidth, columnName, dataList, response);
 
 
-        }
     }
+}
 

+ 13 - 5
src/main/vue/src/components/VuforiaImageInfo.vue

@@ -1,5 +1,5 @@
 <template>
-    <div>
+    <div  v-loading="loading">
         <el-form :model="formData" :rules="rules" ref="form" label-width="100px" label-position="right" size="small" style="max-width: 500px;">
             <div style="height:50vh;overflow:auto;padding:0 10px">
                 <el-form-item prop="vuforiaImageGroupId" label="所属图集ID">
@@ -188,6 +188,7 @@ export default {
             landMarkIdOptions: [],
             subColumn: '',
             subValue: '',
+            loading:false
         }
     },
     methods: {
@@ -220,14 +221,21 @@ export default {
         },
         onDelete() {
             this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                this.loading=true
                 return this.$http.post({
                     url: '/vuforiaImageInfo/del',
                     data: { id: this.formData.id }
                 })
-            }).then(() => {
-                this.$message.success('删除成功');
-                this.$emit('hide')
-                this.$emit('update')
+            }).then(res => {
+                this.loading=false
+                if (res.success) {
+                    this.$message.success('删除成功');
+                    this.$emit('hide')
+                    this.$emit('update')
+                } else {
+                    this.$message.error(res.error);
+                }
+
             }).catch(action => {
                 if (action === 'cancel') {
                     this.$message.info('删除取消');

+ 14 - 4
src/main/vue/src/components/VuforiaImageInfos.vue

@@ -1,5 +1,5 @@
 <template>
-    <div>
+    <div v-loading="loading">
         <div class="filters-container">
 
             <el-input placeholder="关键字" size="small" v-model="filter1" clearable class="filter-item"></el-input>
@@ -204,6 +204,7 @@ export default {
     },
     data() {
         return {
+            loading: false,
             VuforiaImageInfoShow: false,
             editVuforiaImageInfo: {},
             totalNumber: 0,
@@ -524,14 +525,23 @@ export default {
         },
         deleteRow(row) {
             this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                this.loading = true
                 return this.$http.post({
                     url: '/vuforiaImageInfo/del',
                     data: { id: row.id }
                 })
-            }).then(() => {
-                this.$message.success('删除成功');
-                this.getData();
+            }).then(res => {
+                this.loading = false
+                if (res.success) {
+                    this.$message.success('删除成功');
+                    this.getData();
+
+                } else {
+                    this.$message.error(res.error);
+                }
+
             }).catch(action => {
+                this.loading = false
                 if (action === 'cancel') {
                     this.$message.info('删除取消');
                 } else {

+ 8 - 3
src/main/vue/src/pages/VuforiaImageInfo.vue

@@ -197,9 +197,14 @@ export default {
                     url: '/vuforiaImageInfo/del',
                     data: { id: this.formData.id }
                 })
-            }).then(() => {
-                this.$message.success('删除成功');
-                this.$router.go(-1);
+            }).then(res => {
+                if (res.success) {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+
+                } else {
+                    this.$message.error(res.error);
+                }
             }).catch(action => {
                 if (action === 'cancel') {
                     this.$message.info('删除取消');

+ 9 - 4
src/main/vue/src/pages/VuforiaImageInfos.vue

@@ -46,7 +46,7 @@
             </el-table-column>
 
             <el-table-column v-if="isColumnShow('vuforiaImage')" prop="vuforiaImage" label="识别图" min-width="100">
-                <template slot-scope="{row}"  v-if="row.vuforiaImage">
+                <template slot-scope="{row}" v-if="row.vuforiaImage">
                     <img :src="row.vuforiaImage" @click="showImg(row.vuforiaImage)" style="width: 100px;height: 100px;vertical-align: middle;" />
                 </template>
 
@@ -510,9 +510,14 @@ export default {
                     url: '/vuforiaImageInfo/del',
                     data: { id: row.id }
                 })
-            }).then(() => {
-                this.$message.success('删除成功');
-                this.getData();
+            }).then(res => {
+                if (res.success) {
+                    this.$message.success('删除成功');
+                    this.getData();
+
+                } else {
+                    this.$message.error(res.error);
+                }
             }).catch(action => {
                 if (action === 'cancel') {
                     this.$message.info('删除取消');

+ 1 - 1
src/main/webapp/WEB-INF/html/admin.html

@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=origin><title>管理后台</title><link rel=icon href=/static/favicon.ico><script src=/static/polyfill.min.js></script><script src=/static/fontawesome-v5.2.0.js></script><link href=/static/css/admin.a99382f8104ef0229e42fbe0f11ef186.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.14228c000857a7011b18.js></script><script type=text/javascript src=/static/js/vendor.631c08d5fc0f22d7ee46.js></script><script type=text/javascript src=/static/js/admin.400e69a4b3157702c220.js></script></body></html>
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=origin><title>管理后台</title><link rel=icon href=/static/favicon.ico><script src=/static/polyfill.min.js></script><script src=/static/fontawesome-v5.2.0.js></script><link href=/static/css/admin.a99382f8104ef0229e42fbe0f11ef186.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.6f19a3433eca47fa8152.js></script><script type=text/javascript src=/static/js/vendor.631c08d5fc0f22d7ee46.js></script><script type=text/javascript src=/static/js/admin.00a9852ea8d0bdb19362.js></script></body></html>

+ 1 - 1
src/main/webapp/WEB-INF/html/loginAdmin.html

@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=origin><title>管理后台</title><link rel=icon href=/static/favicon.ico><script src=/static/polyfill.min.js></script><link href=/static/css/loginAdmin.a1de29a9f9c1d5b671b1965892c17dd1.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.14228c000857a7011b18.js></script><script type=text/javascript src=/static/js/vendor.631c08d5fc0f22d7ee46.js></script><script type=text/javascript src=/static/js/loginAdmin.c9cb308e894a7cd72b31.js></script></body></html>
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=referrer content=origin><title>管理后台</title><link rel=icon href=/static/favicon.ico><script src=/static/polyfill.min.js></script><link href=/static/css/loginAdmin.a1de29a9f9c1d5b671b1965892c17dd1.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.6f19a3433eca47fa8152.js></script><script type=text/javascript src=/static/js/vendor.631c08d5fc0f22d7ee46.js></script><script type=text/javascript src=/static/js/loginAdmin.c9cb308e894a7cd72b31.js></script></body></html>

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/21.086cc785a3b470339c35.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/22.7da53de2e213be07f214.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/23.8d187990f448d6f48a4c.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/24.2438e0b4ccc5568715b8.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/25.5fb700b08a0877440593.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/26.b5fe423b3c16ed41cf27.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/27.5b55df645a7d0d7f60af.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/28.38f546a173a7d6ef39f1.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/29.22a97493903971d34666.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/30.19e0a8bdc2dc078523a2.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/31.c7a94cb986ef379e2d86.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/32.46264a24f69079fc2526.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/33.1786477b948415455d6c.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/34.2b953a54aa9fa24921a7.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/35.444d017f53ef1f93f9b0.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/36.3abc3886147e7fd17908.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/37.9b8083d5385c6704ab8d.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/37.ae929f8d43fdee3a2080.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/55.6983f73c27006008dec0.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/56.e4452ef09a2b624ff074.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/57.ba4acc50c81ef7581439.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/58.eb38c9ca25c5c3402e2f.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/59.8d5902b233e551d960e1.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/60.5f9b7a50a1f056a089b3.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/61.eb4f057b4ec7388c4ae4.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/62.da6081b62568d63fa941.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/63.1759c519a1abe730ea31.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/64.b26ee0628d61c9865ff4.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/65.91a5ce5edb88c4534173.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/66.5ff5c813897f13f3233a.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/67.693fd7516cdb38f4eb9a.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/68.535a5cc70e2e840321ba.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/69.88ce0b888c1d832680dd.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/7.cd0dccd62db355e48f43.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/70.2e7df97468ff7ff45ffc.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/71.0b765e29dd525e0bc46d.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/72.4021fcfdb01ebe241f95.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/72.d4c3c93d2437c9dff376.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/admin.00a9852ea8d0bdb19362.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/manifest.14228c000857a7011b18.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/main/webapp/static/js/manifest.6f19a3433eca47fa8152.js


+ 21 - 1
src/test/java/VuforialUtilTest.java

@@ -1,3 +1,4 @@
+import com.izouma.awesomeadmin.model.VuforiaTarget;
 import com.izouma.awesomeadmin.service.UserInfoService;
 import com.izouma.awesomeadmin.vuforia.VuforiaUtil;
 import org.junit.Test;
@@ -31,7 +32,26 @@ public class VuforialUtilTest {
         String accessKey = "391531184ed5cf0d998a91f193eddd57cff3b074";
         String secretKey = "21f5b1d95a537e501ed62baad256f44f2b1ea022";
         String targetId = "8761cf50dc9b4e198b608c3cac8d6f27";
-        String result_code = VuforiaUtil.updateTarget(targetId, targetName, width, null, accessKey, secretKey);
+        String result_code = VuforiaUtil.updateTarget(targetId, targetName, width, null, accessKey, secretKey, null);
+        System.out.println(result_code);
+    }
+
+
+    @Test
+    public void GetTargetTest() {
+        String accessKey = "391531184ed5cf0d998a91f193eddd57cff3b074";
+        String secretKey = "21f5b1d95a537e501ed62baad256f44f2b1ea022";
+        String targetId = "8761cf50dc9b4e198b608c3cac8d6f27";
+        VuforiaTarget result_code = VuforiaUtil.getTarget(targetId, accessKey, secretKey);
+        System.out.println(result_code);
+    }
+
+    @Test
+    public void DeleteTargetTest() {
+        String accessKey = "391531184ed5cf0d998a91f193eddd57cff3b074";
+        String secretKey = "21f5b1d95a537e501ed62baad256f44f2b1ea022";
+        String targetId = "8761cf50dc9b4e198b608c3cac8d6f27";
+        String result_code = VuforiaUtil.deleteTarget(targetId, accessKey, secretKey);
         System.out.println(result_code);
     }
 

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff