?? customeraction.java
字號:
forward = "userLogin";
}
return mapping.findForward(forward);
}
/**
* 顯示客戶的詳細;
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException
*/
public ActionForward showDetail(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
String id = request.getParameter("id");
Customer customer = customerMgr.getCustomerById(Integer.parseInt(id));
CustomerForm customerForm = new CustomerForm();
try {
BeanUtils.copyProperties(customerForm, customer);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
request.setAttribute("customer", customerForm);
return mapping.findForward("customerDetail");
}
/**
* 顯示出被凍結的客戶;
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException
*/
public ActionForward listDeleteData(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
User user = SessionMgr.getCustSession(request);
String forward = "listDeleteData";
List<CustomerVo> customers = null;
customers = customerMgr.getCustomerByDelete();
System.out.println("一共有幾個選項:" + customers.size());
String currentPage = request.getParameter("currentPage");
XPage xpage = new XPage(request.getContextPath()
+ "/customer.do?method=listDeleteData", customers.size(), 1, 8,
customers);
if (currentPage != null && !currentPage.equals("")) {
xpage.setCurrentItems(Integer.parseInt(currentPage));
} else {
xpage.setCurrentItems(1);
}
xpage.setPageBar();
request.setAttribute("xpage", xpage);
return mapping.findForward(forward);
}
// ------------------------------------更新后------------------------------------//
/**
*
* 搜索客戶相關項
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException拋出應用異常
*/
public ActionForward correlation(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
CustomerForm cForm = (CustomerForm) form;
// String customerId = request.getParameter("customerId");
String customerId = cForm.getCustomerId();
String forward = "customerCorrelation";// 跳轉到客戶相關項
if (!StringTool.isNotBlank(customerId)) { // 若傳入的參數為空
throw new IllegalParameterException(
Constants.ILLEALPARAMGOGALEXCEPTION);
}
try {
// 搜索出相應客戶
Customer customer = customerMgr.getCustomerById(Integer
.parseInt(customerId));
CustomerVo customerVo = new CustomerVo();
BeanUtils.copyProperties(customerVo, customer);
// 2009-02-24 add
if (cForm.getDelRights() == null || cForm.getModifyRights() == null
|| "".equals(cForm.getDelRights())
|| "".equals(cForm.getModifyRights())) {
//查找
User user = SessionMgr.getCustSession(request);
Rights rights = SessionMgr.getJspRightsControl(request)
.get("1").getRightsMap().get("104");
String userIds = authorizationMgr.findUserDataRange(rights
.getId(), user);
if (!authorizationMgr.isRights(user.getId(), userIds)) {
return mapping.findForward("noRights");
} else {
// 刪除(數據范圍)
Rights delRights = SessionMgr.getJspRightsControl(request).get("1")
.getRightsMap().get("103");
String delUserIds = authorizationMgr.findUserDataRange(delRights
.getId(), user);
logger.debug("delUserIds : " + delUserIds);
// 修改(數據范圍)
Rights modifyRights = SessionMgr.getJspRightsControl(request).get("1")
.getRightsMap().get("102");
String modifyUserIds = authorizationMgr.findUserDataRange(modifyRights
.getId(), user);
if(authorizationMgr.isRights(user.getId(), delUserIds)){
customerVo.setDelRights("y");
}
if(authorizationMgr.isRights(user.getId(), modifyUserIds)){
customerVo.setModifyRights("y");
}
}
} else {
customerVo.setDelRights(cForm.getDelRights());
customerVo.setModifyRights(cForm.getModifyRights());
}
// end
request.setAttribute("customerVo", customerVo);
// 根據修改人的ID查找上次修改人
User modifyMan = customerMgr.getCustomerDao().getUserById(
customerVo.getModifyManId());
request.setAttribute("modifyUser", new UserVo(modifyMan.getId(),
modifyMan.getFamilyName()));
// 搜索相關聯系人
List contacts = relationManage.getEntities(
ClassCodeMgr.CUSTOMER_CONTACTINT, ClassCodeMgr.CUSTOMERINT,
Integer.parseInt(customerId));
List<ContactVo> contactVoList = relationManage
.contactsToContactVos(contacts);
request.setAttribute("contacts", contactVoList);
request.setAttribute("contactSize", contactVoList.size());
// 搜索業務機會
List busiOpports = relationManage.getEntities(
ClassCodeMgr.BUSINESS_OPPORTINT, ClassCodeMgr.CUSTOMERINT,
Integer.parseInt(customerId));
List<BusinessOpportunityVo> busiOpportList = relationManage
.busiOpportToBusiOpportVos(busiOpports);
request.setAttribute("busiOpports", busiOpportList);
request.setAttribute("busiOpportSize", busiOpportList.size());
logger.debug("業務機會。。。");
// 搜索未處理的任務
List<ActivityTaskVo> imCompletedRasks = relationManage
.getActivityRasksByRelation(
CorrelationConstant.CUSTOMERRELATION, Integer
.parseInt(customerId), 1);
request.setAttribute("imCompletedRasks", imCompletedRasks);
request
.setAttribute("imCompletedRaskSize", imCompletedRasks
.size());
logger.debug("未處理的任務。。。" + imCompletedRasks);
// 搜索未處理的事件
List<EventVo> imCompletedEvents = relationManage
.getEventByRelation(CorrelationConstant.CUSTOMERRELATION,
Integer.parseInt(customerId), true);
request.setAttribute("imCompletedEvents", imCompletedEvents);
request.setAttribute("imCompletedEventSize", imCompletedEvents
.size());
logger.debug("未處理的事件。。。" + imCompletedEvents);
// 搜索任務歷史---已經完成的任務
List<ActivityTaskVo> completedRasks = relationManage
.getActivityRasksByRelation(
CorrelationConstant.CUSTOMERRELATION, Integer
.parseInt(customerId),
Constants.RASKEXECUTEED);
request.setAttribute("completedRasks", completedRasks);
request.setAttribute("completedRaskSize", completedRasks.size());
logger.debug("已處理的任務。。。" + completedRasks);
// 搜索歷史事件----過期事件
List<EventVo> completedEvents = relationManage.getEventByRelation(
CorrelationConstant.CUSTOMERRELATION, Integer
.parseInt(customerId), false);
request.setAttribute("completedEvents", completedEvents);
request.setAttribute("completedEventSize", completedEvents.size());
logger.debug("已過期的事件。。。" + completedEvents);
} catch (Exception e) {
e.printStackTrace();
throw new ApplicationException(Constants.WITHOUTDATA);
}
return mapping.findForward(forward);
}
public CustomerMgr getCustomerMgr() {
return customerMgr;
}
/**
* 創建聯系人
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException
*/
public ActionForward createContact(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
String customerId = request.getParameter("customerId");
if (!StringTool.isNotBlank(customerId)) { // 若傳入的參數為空
throw new IllegalParameterException(
Constants.ILLEALPARAMGOGALEXCEPTION);
}
try {
// 搜索出相應客戶
Customer c = customerMgr.getCustomerById(Integer
.parseInt(customerId));
request.setAttribute("customerVo", new CustomerVo(c.getId(), c
.getCustomerName()));
} catch (Exception e) {
e.printStackTrace();
throw new ApplicationException(Constants.WITHOUTDATA);
}
return mapping.findForward("newContact");
}
/**
* 新建任務
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException
* 2008-11-07 by 張明強 copied liu's
*/
public ActionForward createNewTask(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
String customerId = request.getParameter("customerId");
logger.error("參數為。。。" + customerId);
if (!StringTool.isNotBlank(customerId)) {
logger.debug("the param you input is illegal");
request.setAttribute(Constants.ERRMSG, Constants.INPUTBANK);
throw new IllegalParameterException(
"the param you input is illegal");
}
try {
Customer customer = customerMgr.getCustomerById(Integer
.parseInt(customerId));
logger.error("有到這里嗎。。。" + customer);
request.setAttribute("CorrelationVo", new CorrelationVo(customer
.getId(), customer.getCustomerName()));
// 保存客戶相關項編碼
request.setAttribute("customerRelation",
CorrelationConstant.CUSTOMERRELATION);
ConfigMgr configMgr = ConfigMgr.getInstance();// 取出相關項類;
Map<String, String> correlationsMap = configMgr
.getAllCorrelations();// 獲取相關項對應的鍵值對;
if (correlationsMap != null && correlationsMap.size() > 0) {
request.setAttribute("correlationsMap", correlationsMap);// 把鍵值對存放到request范圍內;
}
} catch (Exception e) {
request.setAttribute(Constants.ERRMSG, Constants.WITHOUTDATA);
throw new IllegalParameterException(
"the param you input is illegal");
}
return mapping.findForward("toAddTask");// 轉發到添加任務活動的頁面;
}
/**
* 新建事件
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException
* 2008-11-07 by 張明強 copied liu's
*/
public ActionForward createNewEvent(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
String customerId = request.getParameter("customerId");
logger.error("參數為。。。" + customerId);
if (!StringTool.isNotBlank(customerId)) {
logger.debug("the param you input is illegal");
request.setAttribute(Constants.ERRMSG, Constants.INPUTBANK);
throw new IllegalParameterException(
"the param you input is illegal");
}
try {
Customer customer = customerMgr.getCustomerById(Integer
.parseInt(customerId));
logger.error("有到這里嗎。。。" + customer);
request.setAttribute("CorrelationVo", new CorrelationVo(customer
.getId(), customer.getCustomerName()));
// 保存客戶相關項編碼
request.setAttribute("customerRelation",
CorrelationConstant.CUSTOMERRELATION);
ConfigMgr configMgr = ConfigMgr.getInstance();// 取出相關項類;
Map<String, String> correlationsMap = configMgr
.getAllCorrelations();// 獲取相關項對應的鍵值對;
if (correlationsMap != null && correlationsMap.size() > 0) {
request.setAttribute("correlationsMap", correlationsMap);// 把鍵值對存放到request范圍內;
}
} catch (Exception e) {
request.setAttribute(Constants.ERRMSG, Constants.WITHOUTDATA);
throw new IllegalParameterException(
"the param you input is illegal");
}
return mapping.findForward("toAddEvent");// 轉發到添加任務活動的頁面;
}
/**
* 新建業務機會
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ApplicationException
*/
public ActionForward newBusiOpport(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ApplicationException {
String customerId = request.getParameter("customerId");
logger.error("參數為。。。" + customerId);
if (!StringTool.isNotBlank(customerId)) {
logger.debug("the param you input is illegal");
request.setAttribute(Constants.ERRMSG, Constants.INPUTBANK);
throw new IllegalParameterException(
"the param you input is illegal");
}
try {
Customer customer = customerMgr.getCustomerById(Integer
.parseInt(customerId));
logger.error("有到這里嗎。。。" + customer);
request.setAttribute("customerVo", new CustomerVo(customer.getId(),
customer.getCustomerName()));
} catch (Exception e) {
request.setAttribute(Constants.ERRMSG, Constants.WITHOUTDATA);
throw new IllegalParameterException(
"the param you input is illegal");
}
return new ActionForward("/busiOpport/newBusiOpport.jsp");// 防止重定向
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -