瀏覽代碼

名片信息

eganwu 1 年之前
父節點
當前提交
25823a46b0
共有 1 個文件被更改,包括 30 次插入11 次删除
  1. 30 11
      src/custom/restcontroller/webmanage/users/visitors.java

+ 30 - 11
src/custom/restcontroller/webmanage/users/visitors.java

@@ -93,35 +93,54 @@ public class visitors extends Controller {
 
     @API(title = "名片信息", apiversion = R.ID20240514161502.v1.class)
     public String cardInfo() throws YosException {
-        Long userid = content.getLongValue("userid");
-        Row row = getUser(userid);
-        Row enterpriseRow = getEnterpriseHr(userid);
-        Long sys_enterpriseid = 0L;
+        Long tempuserid = content.getLongValue("userid");
+
+        //插入浏览记录
+        InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_datacollect");
+        insertSQL.setUniqueid(createTableID("sys_datacollect"));
+        insertSQL.setSiteid(siteid);
+        insertSQL.setValue("userid", userid);
+        insertSQL.setValue("ownertable", "sys_user");
+        insertSQL.setValue("ownerid", tempuserid);
+        insertSQL.setValue("type", 3);
+        insertSQL.insert();
+
+
+        Row row = getUser(tempuserid);
+        Row enterpriseRow = getEnterpriseHr(tempuserid);
         String enterprisename = "";
         if (!enterpriseRow.isEmpty()) {
-            sys_enterpriseid = enterpriseRow.getLong("sys_enterpriseid");
             enterprisename = enterpriseRow.getString("enterprisename");
         }
         row.put("enterprisename", enterprisename);
-        row.put("headpic", getHeadPic(userid));
+        row.put("headpic", getHeadPic(tempuserid));
         //查询角色
         Rows rolenameRows = dbConnect.runSqlQuery("select rolename from sys_userrole t1 " +
                 "inner join sys_role t2 ON t2.roleid=t1.roleid and t2.siteid=t1.siteid " +
-                "WHERE t1.userid=" + userid + " and t1.siteid='" + siteid + "'");
+                "WHERE t1.userid=" + tempuserid + " and t1.siteid='" + siteid + "'");
         row.put("rolenames", StringUtils.join(rolenameRows.toArray("rolename"), ","));
 
-        Rows attinfoRows = Attachment.get(this, "sys_user", userid);
+        Rows attinfoRows = Attachment.get(this, "sys_user", tempuserid);
         row.put("attinfos", attinfoRows);
 
         //标签
-        ArrayList<String> tagList = DataTag.queryTag(this, "sys_user", userid, false);
+        ArrayList<String> tagList = DataTag.queryTag(this, "sys_user", tempuserid, false);
         //系统标签
-        tagList.addAll(DataTag.queryTag(this, "sys_user", userid, true));
+        tagList.addAll(DataTag.queryTag(this, "sys_user", tempuserid, true));
         row.put("tag", tagList);
 
-        Rows rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=2 and ownertable='sys_user' and ownerid='"+userid+"'");
+        Rows rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=2 and ownertable='sys_user' and ownerid='" + tempuserid + "'");
         row.put("count_like", rows.get(0).getLong("count"));
 
+        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE  siteid='" + siteid + "' and type=3 and ownertable='sys_user' and ownerid='" + tempuserid + "'");
+        row.put("count_read", rows.get(0).getLong("count"));
+
+        rows= dbConnect.runSqlQuery("SELECT userid,max(createdate) createdate from sys_datacollect WHERE  siteid='" + siteid + "' and type=3 and ownertable='sys_user' and ownerid='" + tempuserid + "' GROUP  BY userid LIMIT 3");
+
+        for (Row readrow:rows) {
+            readrow.put("headpic",getHeadPic(readrow.getLong("userid")));
+        }
+        row.put("readusers", rows);
 
         return getSucReturnObject().setData(row).toString();
     }