|
|
@@ -1,13 +1,18 @@
|
|
|
package restcontroller.webmanage.users;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.mysql.cj.x.protobuf.MysqlxCrud;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
import common.annotation.API;
|
|
|
import common.data.Row;
|
|
|
import common.data.Rows;
|
|
|
+import common.data.SQLFactory;
|
|
|
+import common.data.UpdateSQL;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
+import static restcontroller.webmanage.sale.enterprise.enterprise.validatePhoneNumber;
|
|
|
+
|
|
|
/**
|
|
|
* 营销宝,我的,游客
|
|
|
*/
|
|
|
@@ -25,12 +30,52 @@ public class visitors extends Controller {
|
|
|
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("store_history",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"));
|
|
|
+ //预约
|
|
|
+ row.put("count_appointment", 0);
|
|
|
+ //地址
|
|
|
+ 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"));
|
|
|
|
|
|
+ row.putAll(getUser(userid));
|
|
|
+ row.put("headpic", getHeadPic(userid));
|
|
|
|
|
|
return getSucReturnObject().setData(row).toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "更新游客信息", apiversion = R.ID20240511151602.v1.class)
|
|
|
+ public String updatevisitorsInfo() throws YosException {
|
|
|
+ String phonenumber=content.getStringValue("phonenumber");
|
|
|
+
|
|
|
+ if(!content.getStringValue("phonenumber").isEmpty()){
|
|
|
+ boolean isValidPhoneNumber = validatePhoneNumber(phonenumber);
|
|
|
+ if (!isValidPhoneNumber) {
|
|
|
+ return getErrReturnObject().setErrMsg("请输入正确的手机号").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dbConnect.runSqlQuery("select *from sys_users where phonenumber='" + phonenumber + "' and userid!='" + userid + "'").isNotEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("存在重复的手机号信息").toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_users");
|
|
|
+ updateSQL.setUniqueid(userid);
|
|
|
+ updateSQL.setValue("name", content.getStringValue("name"));
|
|
|
+ updateSQL.setValue("phonenumber", content.getStringValue("phonenumber"));
|
|
|
+ updateSQL.setValue("email", content.getStringValue("email"));
|
|
|
+ updateSQL.setValue("address", content.getStringValue("address"));
|
|
|
+ updateSQL.update();
|
|
|
+
|
|
|
+
|
|
|
+ return visitorsInfo();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|