| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package com.cnd3b.restcontroller.customer.usercenter.usermsg;
- 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.data.SQLFactory;
- import com.cnd3b.common.parameter.parameter;
- import p2.pao.PaoRemote;
- import p2.pao.PaoSetRemote;
- import p2.util.P2Exception;
- import java.util.Date;
- public class usermsg extends Controller {
- public usermsg(JSONObject content) {
- super(content);
- }
- /**
- * 个人信息详情查询
- *
- * @return
- */
- public String query_usermsg() {
- SQLFactory sqlFactory = new SQLFactory(this, "用户信息查询");
- sqlFactory.addParameter("siteid", siteid);
- sqlFactory.addParameter("userid", userid);
- sqlFactory.addParameter("tagentsid", tagentsid);
- Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
- for (Row row : rows) {
- SQLFactory sqlFactory2 = new SQLFactory(this, "用户版本授权情况查询");
- sqlFactory2.addParameter("siteid", siteid);
- sqlFactory2.addParameter("tagentsid", tagentsid);
- Rows rows2 = dbConnect.runSqlQuery(sqlFactory2.getSQL());
- if (rows2.isEmpty()) {
- row.put("fappmodel", "");
- row.put("fauthenddate", "");
- } else {
- row.put("fappmodel", rows2.get(0).getString("fappmodel"));
- row.put("fauthenddate", rows2.get(0).getString("fauthenddate"));
- }
- row.put("attinfos", getAttachmentUrl("tenterprise_users", String.valueOf(userid), "headportrait"));
- }
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 个人信息修改
- *
- * @return
- */
- public String update_usermsg() throws D3bException, P2Exception {
- String fname = content.getString("fname", "tenterprise_users.fname", "账号名");//姓名
- String fsex = content.getString("fsex");//性别
- String frole = content.getString("frole", "tenterprise_users.frole", "身份/职位");//身份职位
- Date fbirthdate = content.getDate("fbirthdate");//出生日期
- String femail = content.getString("femail", "tenterprise_users.femail", "邮箱");//邮箱
- String fwechatno = content.getString("fwechatno", "tenterprise_users.fwechatno", "微信");//微信号
- String faddress = content.getString("faddress", "tenterprise_users.faddress", "地址");//地址
- PaoSetRemote tenterprise_usersSet = getP2ServerSystemPaoSet("tenterprise_users", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and tenterprise_userid='" + userid + "'");
- if (!tenterprise_usersSet.isEmpty()) {
- PaoRemote pao = tenterprise_usersSet.getPao(0);
- pao.setValue("fname", fname, 11L);
- pao.setValue("fsex", fsex, 11L);
- pao.setValue("fbirthdate", fbirthdate, 11L);
- pao.setValue("femail", femail, 11L);
- pao.setValue("fwechatno", fwechatno, 11L);
- pao.setValue("changeby", username, 11L);
- pao.setValue("changedate", getDateTime(), 11L);
- pao.setValue("faddress", (faddress == null || faddress.equalsIgnoreCase("null")) ? "" : faddress, 11L);
- pao.setValue("frole", frole, 11L);
- tenterprise_usersSet.save();
- //修改账号姓名等缓存信息
- Row row = parameter.userIdList.get(userid);
- row.put("fname", fname);
- parameter.userIdList.put(userid, row);
- dbConnect.runSqlUpdate("update tagents set faddress='" + faddress + "' where siteid='" + siteid + "' and tagentsid=" + tagentsid + " and ftype='个人'");
- } else {
- throw new D3bException("找不到账号信息");
- }
- return query_usermsg();
- }
- }
|