package com.yc.action.conmmons;
|
|
import com.yc.multiData.SpObserver;
|
import com.yc.service.commons.SqlQueryIfc;
|
import com.yc.service.impl.DBHelper;
|
import com.yc.service.panel.SystemSettingsDao;
|
import com.yc.utils.ResponseUtils;
|
import com.yc.utils.SessionKey;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
import java.util.List;
|
import java.util.Map;
|
|
|
|
/**
|
*
|
* @author heqing.hbs@gmail.com
|
* @updatedBy
|
* @updateTime 2011-5-26 下午05:15:34
|
*/
|
@Controller
|
public class GformAction{
|
|
@Autowired
|
SqlQueryIfc sqlQueryIfc;
|
@Autowired
|
SystemSettingsDao sDao;
|
|
//检查功能号是否存折函数
|
@RequestMapping("/existsFormid.do")
|
public void repace(HttpServletRequest request,HttpServletResponse response) throws IOException{
|
String str_formid = request.getParameter("formid");
|
String flg = request.getParameter("flg");
|
String str_doc = str_formid.replaceAll("[^a-zA-Z].+$", "");
|
if(StringUtils.isBlank(str_formid))return;
|
Map<String, Object> map=null;
|
Map<String, Object> dMap=null;
|
boolean bol=("".equals(str_doc)?false:true);
|
int formId = -1;
|
try{
|
formId = Integer.parseInt(str_formid);
|
}catch(Exception e){
|
map=sqlQueryIfc.queryForMap("select formid,codeFlag from gdoctype where codeFlag=?",str_doc);
|
if (map==null||map.size()<1) {return;}
|
formId=DBHelper.getValueInt(map, "formid");
|
}
|
List<Map<String,Object>> list =null;
|
//----开发者用户增加判断是否有打开功能号权限 by danaus 2022/4/23 10:25
|
String noTdeveSql="";
|
if(!"DeveloperUser".equalsIgnoreCase(request.getSession().getAttribute(SessionKey.USERTYPE)+"")){
|
noTdeveSql=" and exists(select top 1 formid from gform where formid="+formId+" and isnull(isAuthorizedForDeveloperUser,0)=0)";
|
}
|
//-----
|
try{
|
SpObserver.setDBtoInstance("_"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
|
if(flg!=null){
|
list=sqlQueryIfc.queryForList("select menuname,formtype,query_string from _sysmenu where formid=? and actived=1 "+noTdeveSql, formId);
|
}else{
|
list=sqlQueryIfc.queryForList("select menuname,formtype,query_string from _sysmenu where formid=? "+noTdeveSql, formId);
|
}
|
if(bol){
|
Map<String, Object> hmap = sDao.getFormIdInTable(DBHelper.getValueInt(map, "formid"));
|
dMap=sqlQueryIfc.queryForMap("select doccode as query_string from "+DBHelper.getValue(hmap, "hdtable")+" where doccode=?", str_formid);
|
}
|
}finally{
|
SpObserver.setDBtoInstance();
|
}
|
int formtype = -1;
|
String info ="{";
|
if(list.size()>0){
|
try{
|
formtype = (Integer)list.get(0).get("formtype");
|
if (bol) {
|
switch ((Integer)list.get(0).get("formtype")) {
|
case 9:
|
formtype=5;
|
break;
|
case 17:
|
formtype=16;
|
break;
|
case 15://在功能号输入框填写单号不跳转到对应单号的问题(8类型)xin 2018-10-12 10:18:54
|
formtype=8;
|
break;
|
case 497:
|
formtype=496;
|
break;
|
|
default:
|
break;
|
}
|
}
|
info+="\"type\":\""+formtype+"\",\"menuname\":\""
|
+list.get(0).get("menuname")+"\",";
|
info+=(!bol?"\"query_string\":\""+(list.get(0).get("query_string")==null?"":
|
list.get(0).get("query_string"))+"\"":"\"query_string\":\"doccode='"+DBHelper.getValue(dMap, "query_string")+"'\","
|
+ "\"id\":\""+formId+"\"");
|
}catch(Exception e){}
|
}
|
info+="}";
|
ResponseUtils.printJson(response, info);
|
}
|
}
|