eganwu 1 год назад
Родитель
Сommit
7fdf37d3cb

+ 6 - 0
src/custom/beans/time/Time.java

@@ -13,4 +13,10 @@ public class Time {
         Date date = new Date();
         return simpleDateFormat.format(date);
     }
+    public static String getDate_Str() {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Etc/GMT-8"));
+        Date date = new Date();
+        return simpleDateFormat.format(date);
+    }
 }

+ 4 - 0
src/custom/restcontroller/R.java

@@ -6539,6 +6539,10 @@ public class R {
         }
     }
 
+    public static class ID2024060710172602 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 21 - 0
src/custom/restcontroller/common/signin/signin.java

@@ -1,5 +1,6 @@
 package restcontroller.common.signin;
 
+import beans.time.Time;
 import beans.user.User;
 import com.alibaba.fastjson.JSONObject;
 import common.Controller;
@@ -7,6 +8,7 @@ import common.YosException;
 import common.annotation.API;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
+import common.data.InsertSQL;
 import common.data.Row;
 import common.data.Rows;
 import common.data.SQLFactory;
@@ -87,5 +89,24 @@ public class signin extends Controller {
         return getSucReturnObject().setData(signinRows).toString();
     }
 
+    @API(title = "签到", apiversion = R.ID2024060710172602.v1.class)
+    public String signinV2() throws YosException {
+
+        InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_signin");
+        insertSQL.setSiteid(siteid);
+        insertSQL.setUniqueid(createTableID("sys_signin"));
+        insertSQL.setValue("userid", userid);
+        insertSQL.setValue("name", username);
+        insertSQL.setValue("depname", getDepartment(userid).getString("depname"));
+        insertSQL.setValue("type", "签到");
+        insertSQL.setValue("sys_enterpriseid", sys_enterpriseid);
+        insertSQL.setValue("signindate", Time.getDate_Str());
+        insertSQL.setValue("signintime", Time.getDateTime_Str());
+        insertSQL.setWhere("not exists(select 1 from  sys_signin where type='签到' and userid=" + userid + " and signindate='" + Time.getDate_Str() + "' and siteid='" + siteid + "')");
+        insertSQL.insert();
+
+        return getSucReturnObject().toString();
+    }
+
 
 }

+ 31 - 33
src/custom/restcontroller/webmanage/users/visitors.java

@@ -34,36 +34,36 @@ public class visitors extends Controller {
     @API(title = "【游客,工作台】个人信息", apiversion = R.ID20240510104102.v1.class)
     public String visitorsInfo() throws YosException {
         Row row = new Row();
-        //统计我的访问店铺数量
-        Rows rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_store_history WHERE userid=" + userid + " and siteid='" + siteid + "'");
-        row.put("count_historystore", rows.get(0).getLong("count"));
-        //预约
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_appointment WHERE createuserid=" + userid + " and siteid='" + siteid + "'");
-        row.put("count_appointment",  rows.get(0).getLong("count"));
-        //地址
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_enterprise_contacts WHERE createuserid=" + userid + " and siteid='" + siteid + "' and deleted=0");
-        row.put("count_address", rows.get(0).getLong("count"));
-        //收藏
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE userid=" + userid + " and siteid='" + siteid + "' and type=1");
-        row.put("count_collect", rows.get(0).getLong("count"));
-        //订单
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_custorder WHERE createuserid=" + userid + " and siteid='" + siteid + "' and deleted=0");
-        row.put("count_order", rows.get(0).getLong("count"));
-        //  通讯录
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_phonebook WHERE sys_phonebookgroupid in (SELECT sys_phonebookgroupid from sys_phonebookgroup WHERE classid=1) and siteid='"+siteid+"'");
-        row.put("count_addressbook",  rows.get(0).getLong("count"));
-        //考试成绩
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sat_courseware_test WHERE userid=" + userid + " and siteid='" + siteid + "' ");
-        row.put("count_coursewaretest", rows.get(0).getLong("count"));
-        //  问卷调查
-        row.put("count_questions", 0);
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_feedback WHERE changeuserid=" + userid + " and siteid='" + siteid + "' ");
-        // 意见反馈
-        row.put("count_feedback",  rows.get(0).getLong("count"));
-
-        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_awardmx WHERE createuserid=" + userid + " and siteid='" + siteid + "' ");
-        // 中奖明细
-        row.put("count_awardmx",  rows.get(0).getLong("count"));
+//        //统计我的访问店铺数量
+//        Rows rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_store_history WHERE userid=" + userid + " and siteid='" + siteid + "'");
+//        row.put("count_historystore", rows.get(0).getLong("count"));
+//        //预约
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_appointment WHERE createuserid=" + userid + " and siteid='" + siteid + "'");
+//        row.put("count_appointment",  rows.get(0).getLong("count"));
+//        //地址
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_enterprise_contacts WHERE createuserid=" + userid + " and siteid='" + siteid + "' and deleted=0");
+//        row.put("count_address", rows.get(0).getLong("count"));
+//        //收藏
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_datacollect WHERE userid=" + userid + " and siteid='" + siteid + "' and type=1");
+//        row.put("count_collect", rows.get(0).getLong("count"));
+//        //订单
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_custorder WHERE createuserid=" + userid + " and siteid='" + siteid + "' and deleted=0");
+//        row.put("count_order", rows.get(0).getLong("count"));
+//        //  通讯录
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sys_phonebook WHERE sys_phonebookgroupid in (SELECT sys_phonebookgroupid from sys_phonebookgroup WHERE classid=1) and siteid='"+siteid+"'");
+//        row.put("count_addressbook",  rows.get(0).getLong("count"));
+//        //考试成绩
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sat_courseware_test WHERE userid=" + userid + " and siteid='" + siteid + "' ");
+//        row.put("count_coursewaretest", rows.get(0).getLong("count"));
+//        //  问卷调查
+//        row.put("count_questions", 0);
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_feedback WHERE changeuserid=" + userid + " and siteid='" + siteid + "' ");
+//        // 意见反馈
+//        row.put("count_feedback",  rows.get(0).getLong("count"));
+//
+//        rows = dbConnect.runSqlQuery("SELECT count(*) count from sa_awardmx WHERE createuserid=" + userid + " and siteid='" + siteid + "' ");
+//        // 中奖明细
+//        row.put("count_awardmx",  rows.get(0).getLong("count"));
 
         row.putAll(getUser(userid));
         row.put("headpic", getHeadPic(userid));
@@ -79,9 +79,7 @@ public class visitors extends Controller {
         long days = ChronoUnit.DAYS.between(startDate, endDate);
         row.put("joindays", days);
         //签到时间
-        Rows signRows = dbConnect.runSqlQuery("SELECT count(DISTINCT t1.sat_sharematerialid) count from sat_sharematerial_read t1 " +
-                "inner join sat_sharematerial t2 ON t2.sat_sharematerialid=t1.sat_sharematerialid " +
-                "WHERE t2.classid=1 and t1.createuserid=" + userid + " and t1.type=0 and t1.siteid='" + siteid + "'");
+        Rows signRows = dbConnect.runSqlQuery("SELECT count(*) count from sys_signin WHERE type='签到' and siteid='" + siteid + "' and  userid='" + userid + "'");
         row.put("signdays", signRows.get(0).getLong("count"));
 
         Rows storerows = dbConnect.runSqlQuery("SELECT t1.*from sa_store t1 \n" +