📄 actionent_customer_linkman.java.svn-base
字号:
package GDPE.customer.linkman;
import levin.UserInfo;
import levin.base.*;
import levin.util.*;
import java.util.*;
import javax.servlet.http.*;
import portal.sa.auditor.EnAuditor;
import portal.sa.auditorrole.EnAuditorRole;
import GDPE.customer.enterprise.DAOCustomer;
import GDPE.customer.enterprise.EnEnt_Customer_Enterprise;
public class ActionENT_CUSTOMER_LINKMAN extends Service {
public ActionENT_CUSTOMER_LINKMAN() {
}
public String execute(HttpServletRequest request,
HttpServletResponse response) throws Exception {
throw new Exception("Error on doType=" + request.getParameter("doType")
+ ".");
}
public String summary(HttpServletRequest request,
HttpServletResponse response) throws Exception {
HttpSession session = request.getSession(false);
UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
String idstr = userInfor.getId();
String flag = "";
String chStationCode;
flag = checkFlag(idstr);
EnENT_CUSTOMER_LINKMAN[] aEnENT_CUSTOMER_LINKMAN;
if (flag.equals("isAdmin")) {
aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOBase
.findAll(new DbAccess(), EnENT_CUSTOMER_LINKMAN.class
.getName()));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals("")) {
aEnENT_CUSTOMER_LINKMAN[i]
.setDtBirthday(aEnENT_CUSTOMER_LINKMAN[i]
.getDtBirthday().substring(0, 10));
}
}
} else if (flag.equals("isStation")) {
EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
EnAuditor.class.getName(), idstr);
chStationCode = cEnAuditor.getChDeptCode();
String where = "chStationCode = '" + chStationCode + "'";
String order = "id desc";
aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOBase
.findByCondition(new DbAccess(),
EnENT_CUSTOMER_LINKMAN.class.getName(), where,
order));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals("")) {
aEnENT_CUSTOMER_LINKMAN[i]
.setDtBirthday(aEnENT_CUSTOMER_LINKMAN[i]
.getDtBirthday().substring(0, 10));
}
}
} else {
String where = "chCommitCode = '" + userInfor.getId() + "'";
String order = "id desc";
aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOBase
.findByCondition(new DbAccess(),
EnENT_CUSTOMER_LINKMAN.class.getName(), where,
order));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals(""))
aEnENT_CUSTOMER_LINKMAN[i]
.setDtBirthday(aEnENT_CUSTOMER_LINKMAN[i]
.getDtBirthday().substring(0, 10));
}
}
request
.setAttribute("aEnENT_CUSTOMER_LINKMAN",
aEnENT_CUSTOMER_LINKMAN);
request.setAttribute("chooseType", "checkbox");
return this.getTargetPage("summary");
}
public String addQuery(HttpServletRequest request,
HttpServletResponse response) throws Exception {
EnENT_CUSTOMER_LINKMAN cEnENT_CUSTOMER_LINKMAN = new EnENT_CUSTOMER_LINKMAN();
request
.setAttribute("cEnENT_CUSTOMER_LINKMAN",
cEnENT_CUSTOMER_LINKMAN);
request.setAttribute("doType", "add");
return this.getTargetPage("detail");
}
public String add(HttpServletRequest request, HttpServletResponse response)
throws Exception {
EnENT_CUSTOMER_LINKMAN cEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN) request
.getAttribute("cEnENT_CUSTOMER_LINKMAN");
DbAccess db = new DbAccess();
try {
db.beginTransaction();
DAOBase.insert(db, cEnENT_CUSTOMER_LINKMAN);
db.commit();
} catch (Exception ex) {
db.rollback();
throw ex;
}
levin.iMessage msg = levin.iMessage
.getNewInstance(
"企业客户管理",
"新增成功.",
"openTop(\"GDPE.customer.linkman.ActionENT_CUSTOMER_LINKMAN.do?doType=summary\");");
msg.save(request);
return this.getTargetPage("Message");
}
public String modifyQuery(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String id = request.getParameter("id");
EnENT_CUSTOMER_LINKMAN cEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN) DAOBase
.findByPK(new DbAccess(), EnENT_CUSTOMER_LINKMAN.class
.getName(), id);
if (!cEnENT_CUSTOMER_LINKMAN.getDtBirthday().equals("")) {
String year = cEnENT_CUSTOMER_LINKMAN.getDtBirthday().substring(0,
4);
String month = cEnENT_CUSTOMER_LINKMAN.getDtBirthday().substring(5,
7);
String day = cEnENT_CUSTOMER_LINKMAN.getDtBirthday().substring(8,
10);
cEnENT_CUSTOMER_LINKMAN.setDtBirthday(year + month + day);
}
request
.setAttribute("cEnENT_CUSTOMER_LINKMAN",
cEnENT_CUSTOMER_LINKMAN);
request.setAttribute("doType", "modify");
return this.getTargetPage("detail");
}
public String modify(HttpServletRequest request,
HttpServletResponse response) throws Exception {
EnENT_CUSTOMER_LINKMAN cEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN) request
.getAttribute("cEnENT_CUSTOMER_LINKMAN");
//HttpSession session = request.getSession(false);
//UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
//String operatorId = userInfor.getId();// 当前操作员ID
// String flag = "";
// flag = checkFlag(operatorId);
//
// EnEnt_Customer_Enterprise cEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise) request
// .getAttribute("cEnEnt_Customer_Enterprise");
// String collectUserId = cEnEnt_Customer_Enterprise.getChCommitCode();
// if (flag.equals("isAdmin")||flag.equals("isStation")||collectUserId.equals(operatorId)) {
// DbAccess db = new DbAccess();
// try {
// db.beginTransaction();
// DAOBase.update(db, cEnENT_CUSTOMER_LINKMAN);
// db.commit();
// } catch (Exception ex) {
// db.rollback();
// throw ex;
// }
//
// } else {
// levin.iMessage msg = levin.iMessage.getNewInstance("企业客户管理联系人",
// "您无权修改其他人员的客户记录.", "closeSelf()");
// msg.save(request);
// return this.getTargetPage("Message");
// }
//
//
DbAccess db = new DbAccess();
try {
db.beginTransaction();
DAOBase.update(db, cEnENT_CUSTOMER_LINKMAN);
db.commit();
} catch (Exception ex) {
db.rollback();
throw ex;
}
levin.iMessage msg = levin.iMessage
.getNewInstance(
"企业客户管理联系人",
"修改成功.",
"openTop(\"GDPE.customer.linkman.ActionENT_CUSTOMER_LINKMAN.do?doType=summary\");");
msg.save(request);
return this.getTargetPage("Message");
}
public String view(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id = request.getParameter("id");
EnENT_CUSTOMER_LINKMAN cEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN) DAOBase
.findByPK(new DbAccess(), EnENT_CUSTOMER_LINKMAN.class
.getName(), id);
if (!cEnENT_CUSTOMER_LINKMAN.getDtBirthday().equals("")) {
String year = cEnENT_CUSTOMER_LINKMAN.getDtBirthday().substring(0,
4);
String month = cEnENT_CUSTOMER_LINKMAN.getDtBirthday().substring(5,
7);
String day = cEnENT_CUSTOMER_LINKMAN.getDtBirthday().substring(8,
10);
cEnENT_CUSTOMER_LINKMAN.setDtBirthday(year + month + day);
}
request
.setAttribute("cEnENT_CUSTOMER_LINKMAN",
cEnENT_CUSTOMER_LINKMAN);
request.setAttribute("doType", "view");
return this.getTargetPage("detail");
}
public String look(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id = request.getParameter("id");
String where = " Ent_Customer_Linkman.iCustomer_id = '" + id+" '";
//System.out.println("-----yy--"+id);
EnENT_CUSTOMER_LINKMAN[] aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOBase
.findByCondition(new DbAccess(), EnENT_CUSTOMER_LINKMAN.class
.getName(), where, ""));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals("")) {
String year = aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday()
.substring(0, 4);
String month = aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday()
.substring(5, 7);
String day = aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday()
.substring(8, 10);
aEnENT_CUSTOMER_LINKMAN[i].setDtBirthday(year + month + day);
}
}
request
.setAttribute("aEnENT_CUSTOMER_LINKMAN",
aEnENT_CUSTOMER_LINKMAN);
request.setAttribute("chooseType", "checkbox");
return this.getTargetPage("summary");
}
public String delete(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String id = request.getParameter("id");
DbAccess db = new DbAccess();
try {
db.beginTransaction();
StringTokenizer st = new StringTokenizer(id, ",");
while (st.hasMoreElements()) {
String index = (String) st.nextElement();
DAOBase.delete(db, EnENT_CUSTOMER_LINKMAN.class.getName(),
index);
}
db.commit();
} catch (Exception ex) {
db.rollback();
throw ex;
}
levin.iMessage msg = levin.iMessage
.getNewInstance(
"企业客户管理",
"删除成功.",
"openTop(\"GDPE.customer.linkman.ActionENT_CUSTOMER_LINKMAN.do?doType=summary\");");
msg.save(request);
return this.getTargetPage("Message");
}
public String search(HttpServletRequest request,
HttpServletResponse response) throws Exception {
levin.util.DbAccess db = new levin.util.DbAccess();
String chName = request.getParameter("CHNAME");
String chHome_Tel = request.getParameter("CHHOME_TEL");
String chPosition = request.getParameter("CHPOSITION");
HttpSession session = request.getSession(false);
UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
String chCommitCode = userInfor.getId();
String chCommitName = request.getParameter("chCommitName");// 带上自己的工号
String idstr = userInfor.getId();
String flag = checkFlag(idstr);
EnENT_CUSTOMER_LINKMAN searchLinkMan = new EnENT_CUSTOMER_LINKMAN();
searchLinkMan.setChName(chName);
searchLinkMan.setCHHOME_TEL(chHome_Tel);
searchLinkMan.setCHPOSITION(chPosition);
EnENT_CUSTOMER_LINKMAN aEnENT_CUSTOMER_LINKMAN[];
if (flag.equals("isAdmin")) {
aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOLinkMan
.searcheEnLinkMan(db, searchLinkMan));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals("")) {
aEnENT_CUSTOMER_LINKMAN[i]
.setDtBirthday(aEnENT_CUSTOMER_LINKMAN[i]
.getDtBirthday().substring(0, 10));
}
}
} else if (flag.equals("isStation")) {
EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
EnAuditor.class.getName(), idstr);
String chStationCode = cEnAuditor.getChDeptCode();
searchLinkMan.setChStationCode(chStationCode);
aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOLinkMan
.searcheEnLinkMan(db, searchLinkMan));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals("")) {
aEnENT_CUSTOMER_LINKMAN[i]
.setDtBirthday(aEnENT_CUSTOMER_LINKMAN[i]
.getDtBirthday().substring(0, 10));
}
}
} else {
searchLinkMan.setChCommitCode(chCommitCode);// 如果不是系统管理员只能查自己的客户
searchLinkMan.setChCommitName(chCommitName);
aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOLinkMan
.searcheEnLinkMan(db, searchLinkMan));
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
if (!aEnENT_CUSTOMER_LINKMAN[i].getDtBirthday().equals("")) {
aEnENT_CUSTOMER_LINKMAN[i]
.setDtBirthday(aEnENT_CUSTOMER_LINKMAN[i]
.getDtBirthday().substring(0, 10));
}
}
}
request
.setAttribute("aEnENT_CUSTOMER_LINKMAN",
aEnENT_CUSTOMER_LINKMAN);
request.setAttribute("doType", "search");
return this.getTargetPage("summary");
}
public String checkFlag(String chAuditorcode) throws Exception {
String flag = "";
EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
.findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
"chAuditorCode='" + chAuditorcode + "'", "");
for (int i = 0; i < cEnAuditorRole.length; i++) {
String src = cEnAuditorRole[i].getChRoleCode();
if (src.equals("0000")//系统管理员
||src.equals("0004")||src.equals("0006")//客户服务
) {//发展部主管
flag = "isAdmin";
break;
} else if (cEnAuditorRole[i].getChRoleCode().equals("0002")) {//登陆站长
flag = "isStation";
}
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -