Browse Source

添加sn参数

bridge 2 years ago
parent
commit
4ce9aa8182
3 changed files with 64 additions and 4 deletions
  1. 46 0
      .drone.yml
  2. 1 1
      Dockerfile
  3. 17 3
      src/main/java/com/lm/lib/controller/ShowDataController.java

+ 46 - 0
.drone.yml

@@ -0,0 +1,46 @@
+kind: pipeline
+name: default
+
+steps:
+  - name: restore-cache
+    image: drillster/drone-volume-cache
+    volumes:
+      - name: cache
+        path: /cache
+    settings:
+      restore: true
+      mount:
+        - .m2
+
+  - name: build
+    image: jaikuai/npm-mvn
+    pull: true
+    commands:
+      - mvn clean install -Dmaven.test.skip=true -Dmaven.repo.local=/drone/src/.m2/repository -Dmaven.compile.fork=true package
+
+  - name: rebuild-cache
+    image: drillster/drone-volume-cache
+    volumes:
+      - name: cache
+        path: /cache
+    settings:
+      rebuild: true
+      mount:
+        - .m2
+
+  - name: docker-big-screen
+    image: plugins/docker
+    settings:
+      tags:
+        - latest
+        - 1.0.${DRONE_BUILD_NUMBER}
+      registry: nas.fast-fun.cn:5000
+      insecure: true
+      dockerfile: Dockerfile
+      mirror: https://1u6db9h5.mirror.aliyuncs.com
+      repo: nas.fast-fun.cn:5000/zhl/big_screen
+
+volumes:
+  - name: cache
+    host:
+      path: /home/drone/cache

+ 1 - 1
Dockerfile

@@ -1,4 +1,4 @@
-FROM ff-registry:5000/java:8-jre-alpine as big_screen
+FROM jaikuai/java:8-jre-alpine
 
 ENV TZ="Asia/Shanghai"
 ADD ./target/big_screen-0.0.1-SNAPSHOT.jar /home/App.jar

+ 17 - 3
src/main/java/com/lm/lib/controller/ShowDataController.java

@@ -19,9 +19,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.io.IOException;
@@ -62,6 +60,22 @@ public class ShowDataController {
 //    StoreApi service = new StoreBindProxy();
 //    StoreClient storeClient = new StoreClient(service);
 
+
+    @ApiOperation(value = "get sn")
+    @GetMapping("getSn/{fid}/{sid}")
+    public Map<String, Object> getSnForId(@PathVariable String fid, @PathVariable String sid) throws IOException {
+        String sql = "select qrcode from py_battery where f_id=" + fid + " and s_id=" + sid;
+        List<Map<String, Object>> snData = moyuJdbcTemplate.queryForList(sql);
+        List<String> snList = new ArrayList();
+        snData.forEach(p -> snList.add(p.get("qrcode").toString()));
+        String snString = "\'" + String.join("\',\'", snList) + "\'";
+        Map res = new HashMap<String, String>();
+        res.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+        res.put("snString", snString);
+        res.put("snList", snList);
+        return res;
+    }
+
     @ApiOperation(value = "获取美团sn")
     @RequestMapping(value = "/getSn", method = RequestMethod.GET)
     public Map<String, Object> getSn() throws IOException {