|
|
@@ -1,15 +1,19 @@
|
|
|
package com.cnd3b.restcontroller.enterprise.tagents;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.cnd3b.common.Controller;
|
|
|
import com.cnd3b.common.D3bException;
|
|
|
import com.cnd3b.common.data.Rows;
|
|
|
import com.cnd3b.common.data.SQLFactory;
|
|
|
import com.cnd3b.common.data.db.DataPool;
|
|
|
+import org.omg.CORBA.OBJ_ADAPTER;
|
|
|
import p2.pao.PaoRemote;
|
|
|
import p2.pao.PaoSetRemote;
|
|
|
import p2.util.P2Exception;
|
|
|
|
|
|
+import java.util.Iterator;
|
|
|
+
|
|
|
public class tagents extends Controller {
|
|
|
public tagents(JSONObject content) {
|
|
|
super(content);
|
|
|
@@ -71,44 +75,6 @@ public class tagents extends Controller {
|
|
|
return getSucReturnObject().setDataByPaging(rows).setFinalDo(DataPool.defaultdatalife, 1);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 企业档案经销商选择列表查询
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String query_AgentsListselect() {
|
|
|
- /**
|
|
|
- * 过滤条件设置
|
|
|
- */
|
|
|
- StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
- if (content.containsKey("where")) {
|
|
|
- JSONObject whereObject = content.getJSONObject("where");
|
|
|
- if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
- where.append(" and(");
|
|
|
- where.append("t1.fagentshortname like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t1.fagentname like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t1.ftype like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append(")");
|
|
|
- }
|
|
|
- if (whereObject.containsKey("fsaler") && !"".equals(whereObject.getString("fsaler"))) {
|
|
|
- where.append(" and(");
|
|
|
- where.append("t2.fname like'%").append(whereObject.getString("fsaler")).append("%' ");
|
|
|
- where.append(")");
|
|
|
- }
|
|
|
- if (whereObject.containsKey("ftype") && !"".equals(whereObject.getString("ftype"))) {
|
|
|
- where.append(" and(");
|
|
|
- where.append("t1.ftype like'%").append(whereObject.getString("ftype")).append("%' ");
|
|
|
- where.append(")");
|
|
|
- }
|
|
|
- }
|
|
|
- SQLFactory sql = new SQLFactory(this, "经销商选择列表查询", pageSize, pageNumber, "t1.tagentsid");
|
|
|
- sql.addParameter("siteid", siteid);
|
|
|
- sql.addParameter_SQL("where", where);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sql.getSQL());
|
|
|
- return getSucReturnObject().setDataByPaging(rows).setFinalDo(0, 1);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 企业档案经销商主界面查询
|
|
|
*
|
|
|
@@ -123,88 +89,91 @@ public class tagents extends Controller {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 企业经销商档案新增、修改
|
|
|
+ * 商户信息调整申请
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public String insert_modify_enterpriseAgent() throws D3bException, P2Exception {
|
|
|
- long tagentsid = content.getLongValue("tagentsid");//经销商ID,新增时默认传0
|
|
|
- String fagentnum = content.getString("fagentnum", "tagents.fagentnum", "经销商编号");//经销商编号
|
|
|
- String fagentname = content.getString("fagentname", "tagents.fagentname", "经销商名称");//经销商名称
|
|
|
- String fagentshortname = content.getString("fagentshortname", "tagents.fagentshortname", "经销商简称");//经销商简称
|
|
|
- String faddress = content.getString("faddress", "tagents.faddress", "详细地址");//地址
|
|
|
- String fcontact = content.getString("fcontact", "tagents.fcontact", "联系人");//联系人
|
|
|
- String fbirthdate = nullToStr(content.getString("fbirthdate"));//生日
|
|
|
- String fphonenumber = content.getString("fphonenumber", "tagents.fphonenumber", "联系方式");//手机号
|
|
|
- String fwechatno = content.getString("fwechatno", "tagents.fwechatno", "微信号");//微信号
|
|
|
- String femail = content.getString("femail", "tagents.femail", "邮箱");//邮箱
|
|
|
- //String fbegdate = nullToStr(content.getString("fbegdate"));//启用时间
|
|
|
- String fprovince = content.getString("fprovince");//省
|
|
|
- String fcity = content.getString("fcity");//市
|
|
|
- String fcounty = content.getString("fcounty");//县
|
|
|
- String fdutyparagraph = content.getString("fdutyparagraph", "tagents.fdutyparagraph", "统一社会代码");//统一社会信用代码
|
|
|
- //String fenddate = nullToStr(content.getString("fenddate"));//到期时间
|
|
|
- String fjoindate = nullToStr(content.getString("fjoindate"));//加盟日期
|
|
|
- //String fpayment = content.getString("fpayment");//付费方式
|
|
|
- long fsaleruserid = content.getLong("fsaleruserid");//专属业务员ID
|
|
|
- int fteamsize = content.getIntValue("fteamsize");//团队人数
|
|
|
- String fcooperationstatus = content.getString("fcooperationstatus");//合作状态
|
|
|
- String ftype = content.getString("ftype");//经销商类型
|
|
|
-
|
|
|
- PaoSetRemote tagentsSet = getP2ServerSystemPaoSet("tagents", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "'");
|
|
|
- PaoRemote tagents = null;
|
|
|
- if (tagentsid <= 0 || tagentsSet.isEmpty()) {
|
|
|
- tagents = tagentsSet.addAtEnd();
|
|
|
- tagents.setValue("siteid", siteid, 11L);//企业ID
|
|
|
- tagents.setValue("createby", username, 11L);//录入人
|
|
|
- tagents.setValue("createdate", sysdate, 11L);//录入时间
|
|
|
-
|
|
|
- } else {
|
|
|
- tagents = tagentsSet.getPao(0);
|
|
|
- }
|
|
|
- tagents.setValue("fagentnum", fagentnum, 11L);
|
|
|
- tagents.setValue("fagentname", fagentname, 11L);
|
|
|
- tagents.setValue("fagentshortname", fagentshortname, 11L);
|
|
|
- tagents.setValue("faddress", faddress, 11L);
|
|
|
- tagents.setValue("fcontact", fcontact, 11L);
|
|
|
- tagents.setValue("fbirthdate", fbirthdate, 11L);
|
|
|
- tagents.setValue("fphonenumber", fphonenumber, 11L);
|
|
|
- tagents.setValue("fwechatno", fwechatno, 11L);
|
|
|
- tagents.setValue("femail", femail, 11L);
|
|
|
- //tagents.setValue("fbegdate", fbegdate, 11L);
|
|
|
- tagents.setValue("fprovince", fprovince, 11L);
|
|
|
- tagents.setValue("fcity", fcity, 11L);
|
|
|
- tagents.setValue("fcounty", fcounty, 11L);
|
|
|
- tagents.setValue("fdutyparagraph", fdutyparagraph, 11L);
|
|
|
- //tagents.setValue("fenddate", fenddate, 11L);
|
|
|
- tagents.setValue("fjoindate", fjoindate, 11L);
|
|
|
- //tagents.setValue("fpayment", fpayment, 11L);
|
|
|
- tagents.setValue("fsaleruserid", fsaleruserid, 11L);
|
|
|
- tagents.setValue("fteamsize", fteamsize, 11L);
|
|
|
- tagents.setValue("fcooperationstatus", fcooperationstatus, 11L);
|
|
|
- tagents.setValue("ftype", ftype, 11L);
|
|
|
-
|
|
|
- tagents.setValue("changeby", username, 11L);//修改人
|
|
|
- tagents.setValue("changedate", sysdate, 11L);//修改时间
|
|
|
-
|
|
|
+ public String modify_enterpriseAgent() throws D3bException, P2Exception {
|
|
|
+ long tagentsid = content.getLong("tagentsid");//经销商id
|
|
|
/**
|
|
|
- * 将手机号自动绑定到主账号中
|
|
|
+ * 只有个人才可进行商户认证
|
|
|
*/
|
|
|
- PaoSetRemote tenterprise_users = tagents.getPaoSet("$tenterprise_users", "tenterprise_users", "siteid='" + siteid + "' and tagentsid=" + tagents.getUniqueIDValue() + " and fisadministrator=1");
|
|
|
- if (!tenterprise_users.isEmpty()) {
|
|
|
- PaoRemote tenterprise_user = tenterprise_users.getPao(0);
|
|
|
- tenterprise_user.setValue("fname", fcontact, 11L);
|
|
|
- tenterprise_user.setValue("fphonenumber", fphonenumber, 11L);
|
|
|
- tenterprise_user.setValue("fbirthdate", fbirthdate, 11L);
|
|
|
- tenterprise_user.setValue("femail", femail, 11L);
|
|
|
- tenterprise_user.setValue("fwechatno", fwechatno, 11L);
|
|
|
+ JSONArray dataArray = content.getJSONArray("data");
|
|
|
+ for (Object o : dataArray) {
|
|
|
+ JSONObject fchangemsgObject = (JSONObject) o;
|
|
|
+ fchangemsgObject.checkStringLength("fagentnum", "tagents.fagentnum", "经销商编号");//经销商编号
|
|
|
+ fchangemsgObject.checkStringLength("fagentname", "tagents.fagentname", "经销商名称");//经销商名称
|
|
|
+ fchangemsgObject.checkStringLength("fagentshortname", "tagents.fagentshortname", "经销商简称");//经销商简称
|
|
|
+ fchangemsgObject.checkStringLength("fcontact", "tagents.fcontact", "联系人");//联系人
|
|
|
+ fchangemsgObject.checkStringLength("faddress", "tagents.faddress", "详细地址");//地址
|
|
|
+ fchangemsgObject.checkStringLength("fphonenumber", "tagents.fphonenumber", "联系方式");//手机号
|
|
|
+ fchangemsgObject.checkStringLength("fwechatno", "tagents.fwechatno", "微信号");//微信号
|
|
|
+ fchangemsgObject.checkStringLength("femail", "tagents.femail", "邮箱");//邮箱
|
|
|
+ fchangemsgObject.checkStringLength("fdutyparagraph", "tagents.fdutyparagraph", "统一社会代码");//统一社会信用代码
|
|
|
+ fchangemsgObject.checkStringLength("fbrand", "tagents.fbrand", "经营品牌");//统一社会信用代码
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate("update tagents_msgchangeapp set fstatus='作废' where siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and fstatus='申请'");
|
|
|
+
|
|
|
+ long tagents_msgchangappid = 0;
|
|
|
+ PaoSetRemote tagents_msgchangeappSet = getP2ServerSystemPaoSet("tagents_msgchangeapp");
|
|
|
+ PaoRemote tagents_msgchangeapp = tagents_msgchangeappSet.addAtEnd();
|
|
|
+ tagents_msgchangappid = tagents_msgchangeapp.getUniqueIDValue();
|
|
|
+ tagents_msgchangeapp.setValue("fchangemsg", fchangemsgObject.toJSONString(), 11L);
|
|
|
+ tagents_msgchangeapp.setValue("fstatus", "申请", 11L);
|
|
|
+ tagents_msgchangeapp.setValue("ftype", "普通修改", 11L);
|
|
|
+ tagents_msgchangeapp.setValue("siteid", siteid, 11L);
|
|
|
+ tagents_msgchangeapp.setValue("tagentsid", tagentsid, 11L);
|
|
|
+ tagents_msgchangeapp.setValue("tenterprise_userid", userid, 11L);
|
|
|
+ tagents_msgchangeapp.setValue("changeby", username, 11L);//修改人
|
|
|
+ tagents_msgchangeapp.setValue("changedate", sysdate, 11L);//修改时间
|
|
|
+ tagents_msgchangeappSet.save();
|
|
|
+
|
|
|
+ content.put("tagents_msgchangappid", tagents_msgchangappid);
|
|
|
+ check_enterpriseAgent();
|
|
|
}
|
|
|
- /**
|
|
|
- * 保存修改日志
|
|
|
- */
|
|
|
- saveDataLog(tagents);
|
|
|
- tagentsSet.save();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经销商信息修改审核
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws D3bException
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String check_enterpriseAgent() throws D3bException, P2Exception {
|
|
|
+ long tagents_msgchangappid = content.getLong("tagents_msgchangappid");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select ftype,fchangemsg,tagentsid from tagents_msgchangeapp where fstatus='申请'and siteid='" + siteid + "' and tagents_msgchangappid='" + tagents_msgchangappid + "'");
|
|
|
+ if (rows.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("找不到指定的申请").toString();
|
|
|
+ }
|
|
|
+ String ftype = rows.get(0).getString("ftype");
|
|
|
+ String fchangemsg = rows.get(0).getString("fchangemsg");
|
|
|
+ long tagentsid = rows.get(0).getLong("tagentsid");
|
|
|
|
|
|
+ PaoSetRemote tagentsSet = getP2ServerSystemPaoSet("tagents", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "'");
|
|
|
+ if (!tagentsSet.isEmpty()) {
|
|
|
+ PaoRemote tagents = tagentsSet.getPao(0);
|
|
|
+ JSONArray changemsgarray = JSONArray.parseArray(fchangemsg);
|
|
|
+ for (Object o : changemsgarray) {
|
|
|
+ JSONObject changemsgObject = (JSONObject) o;
|
|
|
+ Iterator it = changemsgObject.keySet().iterator();
|
|
|
+ while (it.hasNext()) {
|
|
|
+ String key = (String) it.next();
|
|
|
+ String value = changemsgObject.getString(key);
|
|
|
+ tagents.setValue(key, value, 11L);
|
|
|
+ }
|
|
|
+ if (ftype.equals("商户认证")) {
|
|
|
+ tagents.setValue("ftype", "普通商户", 11L);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PaoSetRemote tagents_msgchangeappSet = tagents.getPaoSet("$tagents_msgchangeapp", "tagents_msgchangeapp", "tagents_msgchangappid=" + tagents_msgchangappid);
|
|
|
+ tagents_msgchangeappSet.getPao(0).setValue("fstatus", "审核", 11L);
|
|
|
+ tagents_msgchangeappSet.getPao(0).setValue("checkby", username, 11L);
|
|
|
+ tagents_msgchangeappSet.getPao(0).setValue("checkdate", sysdate, 11L);
|
|
|
+ tagentsSet.save();
|
|
|
+ tagentsSet.close();
|
|
|
+ }
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
@@ -239,31 +208,5 @@ public class tagents extends Controller {
|
|
|
return getSucReturnObject().setData(rows).saveToDataPool().toString();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 企业档案经销商专属业务员选择查询
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String query_saleruserid() {
|
|
|
- SQLFactory sql = new SQLFactory(this, "经销商专属业务员选择查询");
|
|
|
- sql.addParameter("siteid", siteid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sql.getSQL());
|
|
|
- return getSucReturnObject().setData(rows).saveToDataPool().toString();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
- /**
|
|
|
- * 经销商类型选择
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String selectAgenttype() {
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "经销商类型选择");
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
- String result = rows.toJsonArray("ftype").toString();
|
|
|
- DataPool.put(content.toString(), result);
|
|
|
- return result;
|
|
|
- }
|
|
|
}
|