📄 actionent_customer_enterprise.java
字号:
HttpSession session = request.getSession(false);
UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
String idstr = userInfor.getId();
String flag = "";
String chStationCode;
EnEnt_Customer_Enterprise aEnEnt_Customer_Enterprise[];
flag = checkFlag(idstr);
if (flag.equals("isAdmin")) {
//aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
//.findAll(new DbAccess(), EnEnt_Customer_Enterprise.class
// .getName()));
aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise [])(DAOBase.findByCondition(new DbAccess(),
EnEnt_Customer_Enterprise.class.getName(), " rownum < 60", "id"));
for (int i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
if (!aEnEnt_Customer_Enterprise[i].getDtCommitTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtCommitTime(aEnEnt_Customer_Enterprise[i]
.getDtCommitTime().substring(0, 10));
if (!aEnEnt_Customer_Enterprise[i].getDtFoundTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtFoundTime(aEnEnt_Customer_Enterprise[i]
.getDtFoundTime().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 + "'" + " and rownum < 60 ";
// System.out.println("+------------>"+userInfor.);
String order = "id desc";
aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
.findByCondition(new DbAccess(),
EnEnt_Customer_Enterprise.class.getName(), where,
order));
for (int i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
if (!aEnEnt_Customer_Enterprise[i].getDtCommitTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtCommitTime(aEnEnt_Customer_Enterprise[i]
.getDtCommitTime().substring(0, 10));
if (!aEnEnt_Customer_Enterprise[i].getDtFoundTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtFoundTime(aEnEnt_Customer_Enterprise[i]
.getDtFoundTime().substring(0, 10));
}
} else {
String where = "chCommitCode = '" + userInfor.getId() + "'"+ " and rownum < 60 ";
// System.out.println("+------------>"+userInfor.);
String order = "id desc";
aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
.findByCondition(new DbAccess(),
EnEnt_Customer_Enterprise.class.getName(), where,
order));
for (int i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
if (!aEnEnt_Customer_Enterprise[i].getDtCommitTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtCommitTime(aEnEnt_Customer_Enterprise[i]
.getDtCommitTime().substring(0, 10));
if (!aEnEnt_Customer_Enterprise[i].getDtFoundTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtFoundTime(aEnEnt_Customer_Enterprise[i]
.getDtFoundTime().substring(0, 10));
}
}
request.setAttribute("doType", "choose");
request.setAttribute("chooseType", chooseType);
request.setAttribute("aEnEnt_Customer_Enterprise",
aEnEnt_Customer_Enterprise);
return this.getTargetPage("choose");
}
public String mailSend(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String title = request.getParameter("subject");
String content = request.getParameter("content");
String enterpriseid = request.getParameter("enterpriseid");
String head;
javax.mail.Address toAddrs;
javax.mail.internet.MimeMessage message;
head = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=GBK'><title>"
+ title + "</title></head><body>";
//String sql = "select * from mailConfig";
//DataSet ds = new DbAccess().executeQuery(sql);
Properties pro = System.getProperties();
// pro.put("mail.host",ds.getString(0, 0));
pro.put("mail.host", "mail.gdpe.cn");
pro.put("mail.port", "25");
pro.put("mail.transport.protocol", "smtp");
pro.put("mail.smtp.auth", "true");
// String user = ds.getString(0, 1);
// String password = ds.getString(0, 2);
// String fromEmail = ds.getString(0, 3);
String userAdd = request.getParameter("mailAddress");
String user = userAdd.substring(0,userAdd.indexOf("@gdpe.cn"));
//System.out.println("user-----"+user);
String password = request.getParameter("password");
String fromEmail = userAdd;
//System.out.println("-----"+user+password+fromEmail);
//System.out.println("fromEmail-----"+fromEmail);
javax.mail.Session session = Session.getInstance(pro,
new SmtpAuthentication(user, password));
message = new MimeMessage(session);
// MimeBodyPart bodypart = new MimeBodyPart();
// FileDataSource datasource= new FileDataSource ("E:\\工作职责.doc");
// bodypart.setDataHandler(new DataHandler(datasource));
// bodypart.setFileName(MimeUtility.encodeWord("工作职责.doc","gb2312", null));
// bodypart.setText("看看是不是内容");
// Multipart mp = new MimeMultipart();
try {
message.setFrom(new InternetAddress(fromEmail));
message.setSubject(title, "GBK");
message.setContent(head + content + "</body></html>",
"text/html;charset=GBK");
//mp.addBodyPart(bodypart);
//message.setContent(mp);
//message.setText(content);
//System.out.println("1次---1-------"+message.toString());
StringTokenizer st = new StringTokenizer(enterpriseid, ",");
while (st.hasMoreElements()) {
String index = (String) st.nextElement();
EnEnt_Customer_Enterprise cEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise) DAOBase
.findByPK(new DbAccess(),
EnEnt_Customer_Enterprise.class.getName(),
index);
if (!cEnEnt_Customer_Enterprise.getChEnterpriseEmail().equals(
"")) {
toAddrs = new InternetAddress(cEnEnt_Customer_Enterprise
.getChEnterpriseEmail());
//toAddrs = new InternetAddress("yym1202000@yahoo.com.cn");
//System.out.println("1次----------"+cEnEnt_Customer_Enterprise
// .getChEnterpriseEmail());
message.addRecipient(javax.mail.Message.RecipientType.TO,
toAddrs);
}
}
Transport.send(message);
} catch (MessagingException ex) {
ex.printStackTrace();
levin.iMessage msg = levin.iMessage.getNewInstance("邮件群发",
"邮件因网络连接故障发送失败.", "closeWindow()");
msg.save(request);
return this.getTargetPage("Message");
}
levin.iMessage msg = levin.iMessage.getNewInstance("邮件群发", "邮件已发送.",
"closeWindow()");
msg.save(request);
return this.getTargetPage("Message");
}
public String mailContent(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String enterpriseid = request.getParameter("enterpriseid");
request.setAttribute("enterpriseid", enterpriseid);
return this.getTargetPage("mailContent");
}
public String pubrespositry(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String where = "chCommitCode = '########'";
String order = "dtCommitTime desc";
EnEnt_Customer_Enterprise[] aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
.findByCondition(new DbAccess(),
EnEnt_Customer_Enterprise.class.getName(), where, order));
for (int i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
if (!aEnEnt_Customer_Enterprise[i].getDtCommitTime().equals(""))
aEnEnt_Customer_Enterprise[i]
.setDtCommitTime(aEnEnt_Customer_Enterprise[i]
.getDtCommitTime().substring(0, 10));
}
request.setAttribute("aEnEnt_Customer_Enterprise",
aEnEnt_Customer_Enterprise);
request.setAttribute("doType", "summary");
request.setAttribute("chooseType", "checkbox");
return this.getTargetPage("summary");
}
public String lookUp(HttpServletRequest request,
HttpServletResponse response) throws Exception {
levin.util.DbAccess db = new levin.util.DbAccess();
// String chCorporateName = request.getParameter("chCorporateName");
String chEnterpriseFullName = request
.getParameter("chEnterpriseFullName");
String chSeatCode = request.getParameter("chSeatCode");
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_Enterprise aEnEnt_Customer_Enterprise[];
if (flag.equals("isAdmin")) {
EnEnt_Customer_Enterprise searchContract = new EnEnt_Customer_Enterprise();
// searchContract.setChCorporateName(chCorporateName);
searchContract.setChEnterpriseFullName(chEnterpriseFullName);
searchContract.setChSeatCode(chSeatCode);
//searchContract.setChCommitName(chCommitName);
aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
.searcheEnContract(db, searchContract));
} else if (flag.equals("isStation")) {
EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
EnAuditor.class.getName(), idstr);
EnEnt_Customer_Enterprise searchContract = new EnEnt_Customer_Enterprise();
String chStationCode = cEnAuditor.getChDeptCode();
searchContract.setChEnterpriseFullName(chEnterpriseFullName);
searchContract.setChSeatCode(chSeatCode);
//searchContract.setChStationCode(chStationCode);
String startTime = null;
String endTime= null;
//searchContract.setChCommitCode(chCommitCode);// 如果不是系统管理员只能查自己的客户
//searchContract.setChCommitName(chCommitName);
//aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
// .searcheEnContract(db, searchContract));
aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
.searcheEnContract3(db, searchContract,startTime,endTime,chStationCode,idstr));
// String where = "chStationCode = '" + chStationCode + "'";
// // System.out.println("+------------>"+userInfor.);
// String order = "id desc";
// aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
// .findByCondition(new DbAccess(),
// EnEnt_Customer_Enterprise.class.getName(), where,
// order));
//
// for (int i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
// if (!aEnEnt_Customer_Enterprise[i].getDtCommitTime().equals(""))
// aEnEnt_Customer_Enterprise[i]
// .setDtCommitTime(aEnEnt_Customer_Enterprise[i]
// .getDtCommitTime().substring(0, 10));
// if (!aEnEnt_Customer_Enterprise[i].getDtFoundTime().equals(""))
// aEnEnt_Customer_Enterprise[i]
// .setDtFoundTime(aEnEnt_Customer_Enterprise[i]
// .getDtFoundTime().substring(0, 10));
// }
} else {
EnEnt_Customer_Enterprise searchContract = new EnEnt_Customer_Enterprise();
// searchContract.setChCorporateName(chCorporateName);
searchContract.setChEnterpriseFullName(chEnterpriseFullName);
searchContract.setChSeatCode(chSeatCode);
searchContract.setChCommitCode(chCommitCode);// 如果不是系统管理员只能查自己的客户
searchContract.setChCommitName(chCommitName);
aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
.searcheEnContract(db, searchContract));
}
request.setAttribute("aEnEnt_Customer_Enterprise",
aEnEnt_Customer_Enterprise);
request.setAttribute("doType", "choose");
return this.getTargetPage("choose");
}
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;
}
public static EnEnt_Customer_Enterprise viewInfo(
EnEnt_Customer_Enterprise cEnEnt_Customer_Enterprise)
throws Exception {
int enid = cEnEnt_Customer_Enterprise.getId();
String where = " Ent_Customer_Linkman.iCustomer_id = '" + enid + " '";
EnENT_CUSTOMER_LINKMAN[] aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOBase
.findByCondition(new DbAccess(), EnENT_CUSTOMER_LINKMAN.class
.getName(), where, ""));
StringBuffer linkman = new StringBuffer();
StringBuffer tel = new StringBuffer();
for (int i = 0; i < aEnENT_CUSTOMER_LINKMAN.length; i++) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -