Kaynağa Gözat

添加人员照片

wangchangsheng 3 yıl önce
ebeveyn
işleme
75d1985cca

+ 32 - 31
src/main/java/com/gyee/viewticket/service/impl/ticket/EquoperationrecordServiceImpl.java

@@ -11,15 +11,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.InputStream;
+import java.util.*;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author admin
@@ -35,39 +32,43 @@ public class EquoperationrecordServiceImpl extends ServiceImpl<Equoperationrecor
     private ServerConfig serverConfig;
 
     @Override
-    public IPage<Map> getEquoperationrecordPageList(Page page, String startTime, String endTime, String wtid,String type) {
-        IPage<Map> list =  equoperationrecordMapper.selectEquoperationrecordPageList(page,startTime,endTime,wtid,type);
+    public IPage<Map> getEquoperationrecordPageList(Page page, String startTime, String endTime, String wtid, String type) {
+        IPage<Map> list = equoperationrecordMapper.selectEquoperationrecordPageList(page, startTime, endTime, wtid, type);
         return list;
     }
 
     @Override
-    public List<Map> getEquoperationrecordTope(String stId) throws Exception{
-        String url = serverConfig.getUrl()+"/img/";
-        log.info(url);
+    public List<Map> getEquoperationrecordTope(String stId) throws Exception {
+
+
+
+        String url = serverConfig.getUrl() + "/img/";
         List<Map> maps = new ArrayList<>();
-       List<Map> list =  equoperationrecordMapper.selectEquoperationrecordTop4(stId);
-        for (Map e: list) {
+        List<Map> list = equoperationrecordMapper.selectEquoperationrecordTop4(stId);
+        for (Map e : list) {
             Map map = new HashMap();
-            map.put("id",e.get("id"));
-            map.put("starttime",e.get("starttime"));
-            map.put("endtime",e.get("endtime"));
-            map.put("type",e.get("type"));
-            map.put("tolocdes",e.get("tolocdes"));
-            map.put("problem",e.get("problem"));
-            map.put("solveway",e.get("solveway"));
-            if(null == e.get("labornum") || "".equals(e.get("labornum"))){
-                map.put("imgurl","");
+            map.put("id", e.get("id"));
+            map.put("starttime", e.get("starttime"));
+            map.put("endtime", e.get("endtime"));
+            map.put("type", e.get("type"));
+            map.put("tolocdes", e.get("tolocdes"));
+            map.put("problem", e.get("problem"));
+            map.put("solveway", e.get("solveway"));
+
+            String labornum = e.get("labornum").toString().toLowerCase();
+            InputStream inputStream = this.getClass().getResourceAsStream("/static/img/"+labornum+".jpg");
+            if (null != inputStream){
+                map.put("imgurl", url + labornum + ".jpg");
             }else {
-                String labornum = e.get("labornum").toString().toLowerCase();
-                map.put("imgurl",url+labornum+".jpg");
+                map.put("imgurl", url +"null.jpg");
             }
-            map.put("labornum",e.get("labornum"));
-            map.put("laborname",e.get("laborname"));
-            map.put("jobcode",e.get("jobcode"));
-            map.put("employeetype",e.get("employeetype"));
-            map.put("ticketnum",e.get("ticketnum"));
-            map.put("wfshortname",e.get("wfshortname"));
-            map.put("wfname",e.get("wfname"));
+            map.put("labornum", e.get("labornum"));
+            map.put("laborname", e.get("laborname"));
+            map.put("jobcode", e.get("jobcode"));
+            map.put("employeetype", e.get("employeetype"));
+            map.put("ticketnum", e.get("ticketnum"));
+            map.put("wfshortname", e.get("wfshortname"));
+            map.put("wfname", e.get("wfname"));
             maps.add(map);
         }
         return maps;

BIN
src/main/resources/static/img/null.jpg