%@page import="ce.com.basic.entity.GroupConfigExpand"%>
<%@page import="ce.com.basic.dao.GroupConfigExpandDB"%>
<%@page pageEncoding="utf-8" import="esnai.logic.EsnaiLoginCookie,esnai.logic.EsnaiLoginKey,esnai.logic.group.*,esnai.logic.platform.Laws,esnai.logic.platform.Order,esnai.logic.platform.OrderDAO,esnai.logic.template.TemplateHelper,esnai.util.ErrorList,esnai.util.SafeRequest,esnai.util.StrFunc,org.json.JSONArray,java.text.SimpleDateFormat"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Calendar" %>
<%
TemplateHelper th = new TemplateHelper(application.getRealPath("/template"));
th.put("indexpage",true);
GroupDAO gdao = new GroupDAO();
GroupBulletinDAO gbdao = new GroupBulletinDAO();
GroupMemberDAO gmdao = new GroupMemberDAO();
OrderDAO odao = new OrderDAO();
SafeRequest sr = new SafeRequest(request);
GroupMember gm = null;
Group g = null;
String pagetitle = "继续教育培训";
/*
GroupMember : gm
Group : group
GroupAdmin : ga
GroupMemberExtInfo : gmeiinc_support
StrFunc : class
*/
Laws laws = Laws.getInstance();
th.put("laws", laws); //法规库
String pageinc;
String inc_head = "";
String inc_announce = "";
String inc_flow = "";
String inc_tinfo = "";
String inc_support = "";
String inc_resources = "";
String inc_links = "";
String inc_other = "";
EsnaiLoginCookie elc = new EsnaiLoginCookie(request,response);
int i;
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yy.MM.dd");
java.io.File tf = null;
String groupcode = sr.getParameter("code");
groupcode = StrFunc.removehtmltags(groupcode);
ErrorList el = new ErrorList();
if (elc.isLogin())
{
EsnaiLoginKey elk = elc.get();
th.put("elk",elk);
gm = gmdao.getGroupMemberByUserID(elk.getUserID());
if (gm != null)
{
if (!gm.getGroupCode().equals(groupcode))
{
%>
<%-- --%>
<%
//return;
}else{
th.put("gm",gm);
}
//groupcode = gm.getGroupCode();
}
GroupAdminDAO gadao = new GroupAdminDAO();
GroupAdmin ga = gadao.getGroupAdmin(elk.getUserID());
if (ga != null)
{
th.put("ga",ga);
}
}
else if ("cpvcasfzy".equals(groupcode)) //中注协非执业统一登录入口
{
// response.sendRedirect("/c/cpvcas/");
// return;
}
if (groupcode == null)
{
el.add("参数错误,点此进入平台首页>。");
}
else
{
if ("accmicroclass".equals(groupcode)) //中注协非执业统一登录入口
{
response.sendRedirect("//site.ce.esnai.net/?groupcode=accmicroclass");
return;
}
if ("accanhui".equals(groupcode) && !elc.isLogin()) //安徽财政平台入口
{
response.sendRedirect("http://39.145.0.238:8801/web");
return;
}
g = gdao.getGroup(groupcode);
if (g == null)
{
el.add("项目没有找到:" + groupcode);
}
else
{
pagetitle = g.getPageTitle();
if (StrFunc.getString(g.getEntrance()).length() > 0)
{
if (sr.getParameter("entranceRedirect") == null)
{
response.sendRedirect(g.getEntrance());
return;
}
}
}
}
GroupConfigExpandDB groupConfigExpandDB = new GroupConfigExpandDB();
GroupConfigExpand configExpand = groupConfigExpandDB.getObjectByGroupCode(groupcode);
if(configExpand != null ){
if(configExpand.getnewStudy() == 1){
response.sendRedirect("https://study.esnai.net/c/default/index.jsp?groupcode=" + groupcode);
return;
}
if(configExpand.getnewStudy() == 2){
response.sendRedirect("https://site.ce.esnai.net/?groupcode=" + groupcode);
return;
}
if(configExpand.getnewStudy() == 3 || configExpand.getnewStudy() == 4){
response.sendRedirect("https://ce.esnai.net/" + groupcode + "/index.do" );
return;
}
}
esnai.logic.admin.HtmlTemplateDAO htdao = new esnai.logic.admin.HtmlTemplateDAO();
GroupTrainingDAO gtdao = new GroupTrainingDAO();
if (!el.hasErrors())
{
th.put("groupcode", groupcode);
th.put("g",g);
th.put("pagetitle",pagetitle);
ArrayList gbs = null;
if ("accsuqian".equals(groupcode))
{
gbs = gbdao.getGroupTopValidBulletins(groupcode,8);
}else if ("cpachengxin0".equals(groupcode))
{
gbs = gbdao.getGroupTopValidBulletins(groupcode,8);
}
else
{
gbs = gbdao.getGroupTopValidBulletins(groupcode,5);
}
th.put("bulletins",gbs);
th.put("StrFunc", esnai.util.StrFunc.class);
GroupMemberExtInfo gmei = new GroupMemberExtInfo(g.getExtDefination());
th.put("gmei",gmei); //数据定义
int types[] = GroupMemberType.getMemberTypes();
StringBuffer membertypeoptions = new StringBuffer();
for (i=0;i");
membertypeoptions.append(GroupMemberType.getMemberTypeDescription(types[i]));
membertypeoptions.append("\n");
}
th.put("membertypeoptions",membertypeoptions.toString());//成都财政需要显示会员类型
GroupTemplate gtemplate = new GroupTemplate(groupcode);
inc_head = gtemplate.getTemplate("head");
th.put("inc_head",inc_head);
inc_support = gtemplate.getTemplate("support");
if (inc_support != null)
{
inc_support = inc_support.replace("", "");
}
th.put("inc_support",inc_support);
inc_resources = gtemplate.getTemplate("resources");
//兼容问题
if (inc_resources != null)
{
inc_resources = inc_resources.replace("", "$!laws.getLawInfo()");
}
th.put("inc_resources",inc_resources);
inc_links = gtemplate.getTemplate("links");
th.put("inc_links",inc_links);
inc_other = gtemplate.getTemplate("other");
th.put("inc_other",inc_other);
inc_announce = gtemplate.getTemplate("announce");
th.put("inc_announce",inc_announce);
inc_flow = gtemplate.getTemplate("flow");
th.put("inc_flow",inc_flow);
inc_tinfo = gtemplate.getTemplate("tinfo");
th.put("inc_tinfo",inc_tinfo);
String inc_help = gtemplate.getTemplate("help");
th.put("inc_help",inc_help);
ArrayList gts = (ArrayList)gtdao.getGroupActiveTrainings(g.getGroupCode());
///-----------定制功能-----------
if ("accmianyang".equals(groupcode))
{
GroupCountyDAO gcdao = new GroupCountyDAO();
ArrayList gcs = gcdao.getGroupCounties("accmianyang", "四川", "绵阳市",true);
ArrayList tgc = new ArrayList();
for (i=0;i gcs = gcdao.getGroupCities("cpazhejiang2", "浙江");
ArrayList tgc = new ArrayList();
for (i=0;i gcs = gcdao.getGroupCities("cpvzhejiang", "浙江");
ArrayList tgc = new ArrayList();
for (i=0;i gcs = gcdao.getGroupCounties("accchengdu", "四川", "成都市",true);
ArrayList tgc = new ArrayList();
for (i=0;i gcs = gcdao.getGroupCities("accxinjiang", "新疆",true);
ArrayList tgc = new ArrayList();
for (i=0;i 1)
{
gts.remove(1);
}
if (gts.size() == 1)
{
gts.get(0).setTrainingName("会计领军人才培训课程");
gts.get(0).setTrainingShortName("会计领军人才培训课程");
}
}
}
/* else if ("cpalj".equals(groupcode))
{
//匿名时只显示一个培训
if (gm == null) //匿名
{
while (gts.size() > 1)
{
gts.remove(1);
}
if (gts.size() == 1)
{
gts.get(0).setTrainingName("注册会计师领军人才培训课程");
gts.get(0).setTrainingShortName("注册会计师领军人才培训课程");
}
}
} */
else if ("acczkjs".equals(groupcode))
{
//匿名时只显示一个培训
if (gm == null) //匿名
{
while (gts.size() > 1)
{
gts.remove(1);
}
if (gts.size() == 1)
{
gts.get(0).setTrainingName("总会计师领军人才培训课程");
gts.get(0).setTrainingShortName("总会计师领军人才培训课程");
}
}
}else if ("accchengdezfkj".equals(groupcode))
{
GroupCountyDAO gcdao = new GroupCountyDAO();
ArrayList gcs = gcdao.getGroupCounties(g.getGroupCode(),g.getProvince(),g.getCity());
th.put("gcs",gcs);
}else if ("accsichuanjiguan".equals(groupcode))
{
//20190704 事务处理 ID=258365 caliber accsichuanji 没有当年度培训则弹出框选择
if(gm!=null){
if(!gm.getTrainingIDs().contains("2971")){
th.put("choosetraining","true");
}
}
}else if ("accsc".equals(groupcode))
{
boolean isSelectedNowYear = false;
String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
ArrayList groupTrainingsByYear = gtdao.getGroupTrainingsByYear(groupcode, year);
for (GroupTraining groupTraining : groupTrainingsByYear) {
if (groupTraining.getStatus() != 1) {
continue;
}
if (!groupTraining.getTrainingName().contains(year)) {
continue;
}
if(gm!=null) {
if (gm.getTrainingIDs().contains(String.valueOf(groupTraining.getTrainingID()))) {
isSelectedNowYear = true;
break;
}
}
}
if (gm == null) {
th.put("choosetraining", false);
} else {
th.put("choosetraining",!isSelectedNowYear);
}
}else if ("accshanxi01".equals(groupcode)){
if(gm!=null){
if(gm.getTrainingIDs().contains("4365")){
th.put("choosetraining","true");
}
}
}
if ((gm != null) && (gm.getGroupCode().equals("cpazyhubei"))) //湖北执业会员
{
if (gm.getTrainingID() == 2252) //补2016年
{
//检查是否完成
Order ot = odao.getUserTrainingOrder(gm.getUserID(), 2252);
if (ot != null)
{
if (ot.getScore() >= 60)
{
gm.addTrainingID(""+2301);
gm.setTrainingID(2301);
gmdao.updateGroupMemberTrainingID(gm.getID(), 2301, gm.getTrainingIDs());
}
}
}
}
//20180807 增加广安 用户登录默认带出 2018培训(2461)
if ((gm != null) && (gm.getGroupCode().equals("accguangan")) && (!gm.getTrainingIDs().contains("2461"))) //湖北执业会员
{
gm.addTrainingID(""+2461);
gm.setTrainingID(2461);
gmdao.updateGroupMemberTrainingID(gm.getID(), 2461, gm.getTrainingIDs());
}
//20180930 增加accguangdong 用户登录默认带出 2018培训(2600)
/* if ((gm != null) && (gm.getGroupCode().equals("accguangdong")) && (!gm.getTrainingIDs().contains("2600"))) //湖北执业会员
{
gm.addTrainingID(""+2600);
gm.setTrainingID(2600);
gmdao.updateGroupMemberTrainingID(gm.getID(), 2600, gm.getTrainingIDs());
} */
///-----------定制功能结束-----------
th.put("gts",gts);
ArrayList os = new ArrayList();
for (i=0;i 0) && (tcenter == null)) //开启了缺省页面,并且培训中心尚未进入过,则进入缺省页
{
//缺省页的内容补充
//焦点图
String filepath = "/templates/group/" + groupcode + "_focustemplate.jsp";
java.io.File f = new java.io.File(application.getRealPath(filepath));
String focuscontent = "";
if (f.exists())
{
focuscontent = htdao.getContent(f.getAbsolutePath());
}
th.put("focuscontent", focuscontent);
//法规库
JSONArray plaws = esnai.logic.shiye.Shiye.getLaws(groupcode, g.getProvince());
th.put("plaws", plaws);
//视野资讯
//esnai.logic.cache.MemCache mc = esnai.logic.cache.MemCache.getInstance();
//mc.delete("shiye_zhuanti");
th.put("news33",esnai.logic.shiye.Shiye.getNews("33"));
th.put("news39",esnai.logic.shiye.Shiye.getNews("39"));
//专题
th.put("zhuanti",esnai.logic.shiye.Shiye.getZhuanti());
th.put("zhuantinew",esnai.logic.shiye.Shiye.getZhuantinew());
if (g.getDefaultPage() == 2) //包含自定义新闻列表
{
esnai.logic.news.NewsDAO ndao = new esnai.logic.news.NewsDAO();
ArrayList newslist = ndao.getNewsListWithoutContent(7, 28, 5, groupcode);
th.put("groupnews",newslist);
}
if (defaulttemplatefile == null)
{
if (g.hasDefaultTemplate())
{
out.print(th.toString(g.getDefaultTemplate()));
}
else
{
out.print(th.toString("/c/default/default.html"));
}
}
else
{
out.print(th.toString(defaulttemplatefile));
}
}
else
{
if (("accchengdu".equals(g.getGroupCode())) || ("accsichuan".equals(g.getGroupCode())) || ("accyunnan222".equals(g.getGroupCode())) || ("accdazhou".equals(g.getGroupCode()))|| ("accguangan".equals(g.getGroupCode())))
{
//法规库
JSONArray plaws = esnai.logic.shiye.Shiye.getLaws(groupcode, g.getProvince());
th.put("plaws", plaws);
//视野资讯
th.put("news33",esnai.logic.shiye.Shiye.getNews("33"));
th.put("news39",esnai.logic.shiye.Shiye.getNews("39"));
}
if (templatefile == null)
{
if (g.hasIndexTemplate())
{
out.print(th.toString(g.getIndexTemplate()));
showext = true;
}
else
{
out.print(th.toString("/c/default/index.html"));
showext = true;
}
}
else
{
out.print(th.toString(templatefile));
showext = true;
}
}
}
if (el.hasErrors())
{
out.print(el.toString());
}
if (showext)
{
if (groupcode.equals("accdongying") ){
%>
<%
}else if (groupcode.equals("accjining") ){
%>
<%
}else if (groupcode.equals("accsc") ){
%>
<%
}else if (groupcode.equals("comynxf") ){
%>
<%
}else if (groupcode.equals("cpacyshanghai") ){
%>
<%
}
else{
%>
<%
}
}
%>