TechnologyUseInfoAction.java
package com.mycim.webapp.actions.technology;
import com.fa.sesa.i18n.I18nUtils;
import com.mycim.framework.jdbc.Page;
import com.mycim.framework.utils.lang.collections.MapUtils;
import com.mycim.framework.utils.lang.time.DateUtils;
import com.mycim.webapp.WebUtils;
import com.mycim.webapp.actions.PrpSetupAction;
import com.mycim.webapp.forms.RecipeContextValueForm;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author liuji.li
* @version 6.0.0
* @date 2019/12/9
**/
public class TechnologyUseInfoAction extends PrpSetupAction {
@Override
public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
return mapping.getInputForward();
}
public Map queryTechnologyUseInfo(Map map) {
Page technologyUseInfoPage = prpService.queryTechnologyUseInfo(map);
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("data", technologyUseInfoPage.getResults());
dataMap.put("totalCount", technologyUseInfoPage.getTotalItems());
return dataMap;
}
public ActionForward exportTechnologyUseInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Map<String, Object> argMap = new HashMap<>();
argMap.put("technologyId", WebUtils.getParameter("technologyId", request));
argMap.put("subTechnologyId", WebUtils.getParameter("subTechnologyId", request));
argMap.put("productId", WebUtils.getParameter("productId", request));
argMap.put("processId", WebUtils.getParameter("processId", request));
argMap.put("showAll", WebUtils.getParameter("showAll", request));
Map dataMap = this.queryTechnologyUseInfo(argMap);
List<Map> technologyUseInfoList = (List<Map>) MapUtils.getObject(dataMap, "data");
String fileName = "TechnologyUseInfo" + DateUtils.getNowTime(DateUtils.DATE_FORMAT4NOSPLICING) + ".xlsx";
Map<String, Object> titles = WebUtils.getExportTitles(request);
if ("CN".equals(I18nUtils.getCurrentLanguage())) {
titles.put("title", "工艺平台使用信息");
titles.put("rowNum", "序号");
} else {
titles.put("title", "Technology Use Info");
titles.put("rowNum", "Seq");
}
// WebUtils.exportExcel(fileName, titles, technologyUseInfoList,
// TemplateLocation.PRODUCT_PROCESS_RECIPE_INFO, response);
return WebUtils.NULLActionForward;
}
public ActionForward qryActiveProcess(ActionMapping mapping, RecipeContextValueForm theForm,
HttpServletResponse response, HttpServletRequest request) {
String productId = WebUtils.getParameterNoTrim("productId", request);
String processId = WebUtils.getParameterNoTrim("processId", request);
String processVersion = WebUtils.getParameterNoTrim("processVersion", request);
processVersion = processVersion + "(ACTIVE)";
request.setAttribute("productId", productId);
request.setAttribute("processId", processId);
request.setAttribute("processVersion", processVersion);
return mapping.findForward("viewInit");
}
}