📄 actionent_record_following.java.svn-base
字号:
{
db.beginTransaction();
DAOBase.update(db,cEnEnt_Record_Following);
db.commit();
}
catch(Exception ex)
{
db.rollback();
throw ex;
}
levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
"修改成功.",
"openTop(\"GDPE.follow.ActionEnt_Record_Following.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_Record_Following cEnEnt_Record_Following = (EnEnt_Record_Following)DAOBase.findByPK(new DbAccess(),EnEnt_Record_Following.class.getName(),id);
request.setAttribute("cEnEnt_Record_Following",cEnEnt_Record_Following);
request.setAttribute("doType","view");
return this.getTargetPage("detail");
}
public String delete(HttpServletRequest request, HttpServletResponse response) throws Exception
{
String id = request.getParameter("id");
DbAccess db = new DbAccess();
HttpSession session = request.getSession(false);
UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
String operatorId = userInfor.getId();//当前操作员ID
boolean IsAdmin = false;
//判断当前操作员角色是否为管理员
EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
.findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
"chAuditorCode='" + operatorId + "'", "");
for (int i = 0; i < cEnAuditorRole.length; i++) {
if (cEnAuditorRole[i].getChRoleCode().equals("0000"))
IsAdmin = true;
}
EnEnt_Plan_Following aEnEnt_Plan_Following[]=null;
try
{
db.beginTransaction();
StringTokenizer st = new StringTokenizer(id, ",");
while (st.hasMoreElements()) {
String index = (String) st.nextElement();
EnEnt_Record_Following cEnEnt_Record_Following = (EnEnt_Record_Following) DAOBase
.findByPK(new DbAccess(),
EnEnt_Record_Following.class.getName(),
index);
String collectUserId = cEnEnt_Record_Following
.getChCommitCode();//记录收藏者ID
if (!IsAdmin && !collectUserId.equals(operatorId))
continue;
DAOBase.delete(db, EnEnt_Record_Following.class.getName(),
index);
String where =" iFollowId ="+index;
aEnEnt_Plan_Following = (EnEnt_Plan_Following [])(DAOBase.findByCondition(db, EnEnt_Plan_Following.class.getName(), where, ""));
for(int i2=0;i2<aEnEnt_Plan_Following.length;i2++) {
DAOBase.delete(db,EnEnt_Plan_Following.class.getName(),aEnEnt_Plan_Following[i2].getId()+"");
}
}
// DAOBase.delete(db,EnEnt_Record_Following.class.getName(),id);
db.commit();
}
catch(Exception ex)
{
db.rollback();
throw ex;
}
levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
"删除成功.",
"openTop(\"GDPE.follow.ActionEnt_Record_Following.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 chCustomerName = request.getParameter("chCustomerName");
String chEnterpriseName = request
.getParameter("chEnterpriseName");
String chSeatCode = request.getParameter("chSeatCode");
//String chCommitName = request.getParameter("chCommitName");
HttpSession session = request.getSession(false);
UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
String chCommitName = request.getParameter("chCommitName");
String chStation = request.getParameter("chStation");
String chFollowResult = request.getParameter("chFollowResult");
String chCommitCode = userInfor.getId();
String chCommitName2 = userInfor.getName();// 带上自己的工号
String idstr = userInfor.getId();
boolean isAdmin = false;
// EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
// .findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
// "chAuditorCode='" + idstr + "'", "");
String flag = "";
// for (int i = 0; i < cEnAuditorRole.length; i++) {
// if (cEnAuditorRole[i].getChRoleCode().equals("0000"))
flag = checkFlag(idstr);
//}
//String flag = checkFlag(idstr);
// System.out.println("---2-------"+chStation+chFollowResult);
EnEnt_Record_Following aEnEnt_Record_Following[]=null;
EnEnt_Record_Following searchContract = new EnEnt_Record_Following();
searchContract.setChCustomerName(chCustomerName);
searchContract.setChEnterpriseName(chEnterpriseName);
searchContract.setChSeatCode(chSeatCode);
searchContract.setChStation(chStation);
searchContract.setChFollowResult(chFollowResult);
if(flag.equals("isAdmin")){
searchContract.setChCommitName(chCommitName);
aEnEnt_Record_Following = (EnEnt_Record_Following[]) (GDPE.follow.DAOFollow
.searcheEnContract(db, searchContract,startTime,endTime));
//request.setAttribute("aEnEnt_Record_Following",
// aEnEnt_Record_Following);
//request.setAttribute("doType", "search");
//return this.getTargetPage("summary");
}else if (flag.equals("isStation")) {
EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
EnAuditor.class.getName(), idstr);
String chStationCode = cEnAuditor.getChDeptCode();
searchContract.setChCommitName(chCommitName);
searchContract.setChStationCode(chStationCode);
// searchContract.setChAreacode(chStationCode);
// searchContract.setChCommitCode(idstr);
//System.out.println("---2-------"+chCommitName);
aEnEnt_Record_Following = (EnEnt_Record_Following[]) (GDPE.follow.DAOFollow.searcheEnContract2(db, searchContract,startTime,endTime,chStationCode,idstr));
}else {
searchContract.setChCustomerName(chCustomerName);
searchContract.setChSeatCode(chSeatCode);
searchContract.setChEnterpriseName(chEnterpriseName);
searchContract.setChCommitCode(chCommitCode);//如果不是系统管理员只能查自己的客户
searchContract.setChCommitName(chCommitName2);
aEnEnt_Record_Following = (EnEnt_Record_Following[]) (GDPE.follow.DAOFollow
.searcheEnContract(db, searchContract,startTime,endTime));
}
if(aEnEnt_Record_Following.length!=0) {
for(int i=0; i<aEnEnt_Record_Following.length;i++) {
aEnEnt_Record_Following[i] = GDPE.follow.ActionEnt_Record_Following.viewInfo(aEnEnt_Record_Following[i]);
}
}
//request.setAttribute("aEnEnt_Record_Following", aEnEnt_Record_Following);
request.setAttribute("aEnEnt_Record_Following",
aEnEnt_Record_Following);
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;
}
public String adminorauditor(HttpServletRequest request, HttpServletResponse response) throws Exception{
User user = (User)UserInfo.getInstance(request);
String idstr = user.getId();
String flag=checkFlag1(idstr);
if (flag.equals("isAdmin")) {
levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
"我是管理人员.",
"openTop(\"GDPE.follow.plan.ActionEnt_Plan_Following.do?doType=hebingDay\");");
msg.save(request);
return this.getTargetPage("Message");
}else if(flag.trim().equals("kefu")){
levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
"我是客服人员.",
"openTop(\"GDPE.follow.ActionEnt_Record_Following.do?doType=summary\");");
msg.save(request);
return this.getTargetPage("Message");
}else {
levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
"我是市场开发人员.",
"openTop(\"GDPE.follow.ActionEnt_Record_Following.do?doType=summary\");");
msg.save(request);
return this.getTargetPage("Message");
}
}
public static EnEnt_Record_Following viewInfo(
EnEnt_Record_Following cEnEnt_Record_Following)
throws Exception {
int enid = cEnEnt_Record_Following.getId();
java.util.Calendar c1 = Calendar.getInstance(java.util.Locale.CHINA);
java.util.Calendar c2 = Calendar.getInstance(java.util.Locale.CHINA);
java.util.Date d1 = new java.util.Date(System.currentTimeMillis());
c1.setTime(d1);
c2.setTime(d1);
c1.set(Calendar.DATE, 1);
c2.roll(Calendar.MONTH, 1);
c2.set(Calendar.DATE, 0);
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd",
Locale.SIMPLIFIED_CHINESE);
java.sql.Date d2 = new java.sql.Date(c1.getTimeInMillis());
java.sql.Date d3 = new java.sql.Date(c2.getTimeInMillis());
String s1 = sf.format(d2);
String s2 = sf.format(d3);
String where = " Ent_Plan_Following.IFOLLOWID = '" + enid + "' and dtTrackingDate between to_date('"+s1+"','yyyyMMdd') and to_date('"+s2+"','yyyyMMdd')";
EnEnt_Plan_Following[] aEnEnt_Plan_Following = (EnEnt_Plan_Following[]) (DAOBase
.findByCondition(new DbAccess(), EnEnt_Plan_Following.class
.getName(), where, ""));
//StringBuffer linkman = new StringBuffer();
//StringBuffer num = new StringBuffer();
if(aEnEnt_Plan_Following!=null) {
int max=0;
int a;
for (int i = 0; i < aEnEnt_Plan_Following.length; i++) {
if (!aEnEnt_Plan_Following[i].getDtTrackingDate().equals("")) {
if (aEnEnt_Plan_Following[i].getDtTrackingDate().startsWith("1900")) {
aEnEnt_Plan_Following[i].setDtTrackingDate("");
} else {
String year = aEnEnt_Plan_Following[i].getDtTrackingDate()
.substring(0, 4);
String month = aEnEnt_Plan_Following[i].getDtTrackingDate()
.substring(5, 7);
String day = aEnEnt_Plan_Following[i].getDtTrackingDate()
.substring(8, 10);
aEnEnt_Plan_Following[i].setDtTrackingDate(year+ month+ day);
}
}
if (aEnEnt_Plan_Following[i].getDtTrackingDate().equals("")) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -