|
@@ -0,0 +1,82 @@
|
|
|
+package com.cnd3b.restcontroller.customer.activity;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.cnd3b.common.Controller;
|
|
|
+import com.cnd3b.common.D3bException;
|
|
|
+import com.cnd3b.common.data.Row;
|
|
|
+import com.cnd3b.common.data.Rows;
|
|
|
+import com.cnd3b.common.parameter.parameter;
|
|
|
+import com.cnd3b.restcontroller.publicmethod.users.Users;
|
|
|
+import p2.pao.PaoRemote;
|
|
|
+import p2.pao.PaoSetRemote;
|
|
|
+import p2.util.P2Exception;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 历史注册信息导入
|
|
|
+ */
|
|
|
+public class SignupUpload extends Controller {
|
|
|
+ public SignupUpload(JSONObject content) {
|
|
|
+ super(content);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 访客登记注册
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws D3bException
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String upload() throws D3bException, P2Exception {
|
|
|
+ long tactivityid = content.getLong("tactivityid");//活动ID
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t1.name,t1.idcard,t1.phonenumber,t1.address,t1.compname,t1.id,isnull(max(t2.tenterprise_userid),0) as tenterprise_userid from signupload t1 " +
|
|
|
+ "left join tenterprise_users t2 on t1.phonenumber=t2.fphonenumber " +
|
|
|
+ "where t1.status=1 and t1.tactivityid='" + tactivityid + "' group by t1.name,t1.idcard,t1.phonenumber,t1.address,t1.compname,t1.id ");
|
|
|
+ for (Row row : rows) {
|
|
|
+ String name = row.getString("name");
|
|
|
+ String idcard = row.getString("idcard");
|
|
|
+ String phonenumber = row.getString("phonenumber");
|
|
|
+ String address = row.getString("address");
|
|
|
+ String compname = row.getString("compname");
|
|
|
+ long tenterprise_userid = row.getLong("tenterprise_userid");
|
|
|
+ int id = row.getInteger("id");
|
|
|
+ if (tenterprise_userid == 0) {
|
|
|
+ //如果该手机号没有对应的账号,则生成账号信息
|
|
|
+ PaoSetRemote tagentsSet = getP2ServerSystemPaoSet("tagents");
|
|
|
+ PaoRemote tagents = tagentsSet.addAtEnd();
|
|
|
+ tagents.setValue("siteid", siteid, 11L);//企业ID
|
|
|
+ tagents.setValue("createdate", getDateTime(), 11L);//录入时间
|
|
|
+ tagents.setValue("fphonenumber", phonenumber, 11L);
|
|
|
+ tagents.setValue("fjoindate", getDateTime(), 11L);
|
|
|
+ tagents.setValue("fcontact", name, 11L);
|
|
|
+ tagents.setValue("faddress", address, 11L);
|
|
|
+ tagents.setValue("ftype", "个人", 11L);
|
|
|
+ tagentsSet.save();
|
|
|
+ tenterprise_userid = getMainUser(tagents.getUniqueIDValue()).getLong("tenterprise_userid");
|
|
|
+ }
|
|
|
+ PaoSetRemote tscanningSet = getP2ServerSystemPaoSet("tactivitysignup", "siteid='" + siteid + "' and tactivityid ='" + tactivityid + "' and tenterprise_userid='" + tenterprise_userid + "'");
|
|
|
+ PaoRemote tscanning = null;
|
|
|
+ if (tscanningSet.isEmpty()) {
|
|
|
+ tscanning = tscanningSet.addAtEnd();
|
|
|
+ tscanning.setValue("tenterprise_userid", tenterprise_userid, 11L);
|
|
|
+ tscanning.setValue("siteid", siteid, 11L);
|
|
|
+ tscanning.setValue("createdate", sysdate, 11L);
|
|
|
+ tscanning.setValue("tactivityid", tactivityid, 11L);
|
|
|
+ } else {
|
|
|
+ tscanning = tscanningSet.getPao(0);
|
|
|
+ }
|
|
|
+ tscanning.setValue("fname", name, 11L);
|
|
|
+ tscanning.setValue("fidcard", idcard, 11L);
|
|
|
+ tscanning.setValue("fphonenumber", phonenumber, 11L);
|
|
|
+ //tscanning.setValue("findustry", findustry, 11L);
|
|
|
+ tscanning.setValue("fcompname", compname, 11L);
|
|
|
+ //tscanning.setValue("frole", frole, 11L);
|
|
|
+ tscanning.setValue("faddress", address, 11L);
|
|
|
+ //tscanning.setValue("fchannel", fchannel, 11L);
|
|
|
+ tscanning.setValue("fquestionnaire", "[]", 11L);
|
|
|
+ tscanningSet.save();
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate("update signupload set status=10 where id='" + id + "'");
|
|
|
+ }
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+}
|