CPInfoOperate.jsp
6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="java.net.URLDecoder"%>
<%@ include file="/page/maint/common/initNoCache.jsp"%>
<%@page import="weaver.general.TimeUtil"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs02" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="pro" class="weaver.cpcompanyinfo.ProManageUtil" scope="page" />
<%
String method = Util.null2String(request.getParameter("method"));
StringBuffer strSql = new StringBuffer();
String now = Util.date(2);
String createdatetime = now;
String archivenum = Util.null2String(request.getParameter("archivenum")).trim();
String companyregion = Util.null2String(request.getParameter("companyregion")).trim();
//System.out.println("后台区域的值"+companyregion);
//公司归属
String companyvestin = Util.null2String(request.getParameter("companyvestin")).trim();
String companyname = Util.null2String(request.getParameter("companyname")).trim();
String companyename = Util.null2String(request.getParameter("companyename")).trim();
String companyaddress = Util.null2String(request.getParameter("companyaddress")).trim();
String methodval=Util.null2String(request.getParameter("methodval")).trim();
String foundingTime=Util.null2String(request.getParameter("foundingTime")).trim();
//业务类型
String businesstype = Util.null2String(request.getParameter("businesstype")).trim();
String loancard = Util.null2String(request.getParameter("loancard")).trim();
archivenum = URLDecoder.decode(archivenum,"utf-8").trim();
companyregion = URLDecoder.decode(companyregion,"utf-8").trim();
companyname = URLDecoder.decode(companyname,"utf-8").trim();
companyaddress = URLDecoder.decode(companyaddress,"utf-8").trim();
loancard = URLDecoder.decode(loancard,"utf-8").trim();
companyename = URLDecoder.decode(companyename,"utf-8").trim();
foundingTime=URLDecoder.decode(foundingTime,"utf-8").trim();
String lastupdatetime = now;
if("add".equals(method)){
strSql.setLength(0);
//判断业务类型和公司归属是否存在,如果不存在,则创建失败
//companyvestin
//businesstype
rs.execute("select count(*) s from Companyattributable where id='"+companyvestin+"'");
if(rs.next()&&rs.getInt("s")>0){
rs.execute("select count(*) s from CompanyBusinessService where id='"+businesstype+"'");
if(rs.next()&&rs.getInt("s")>0){
strSql.append(" insert into CPCOMPANYINFO (archivenum,companyregion,companyvestin,");
strSql.append(" companyname,companyaddress,businesstype,loancard,createdatetime,lastupdatetime,isdel,companyename,subcompanyid,foundingTime) ");
strSql.append(" values('" + archivenum + "'," + companyregion + ",");
strSql.append(" '" + companyvestin + "','"+ companyname +"','" + companyaddress + "',");
strSql.append(" '"+businesstype+"','" + loancard + "','" + createdatetime + "','" + lastupdatetime + "','T','"+companyename+"',"+user.getUserSubCompany1()+",'"+foundingTime+"')");
rs.execute(strSql.toString());
strSql.setLength(0);
strSql.append(" select max(companyid) as companyid from CPCOMPANYINFO");
rs.execute(strSql.toString());
if(rs.next()){
pro.writeCompanylog("3",rs.getString("companyid"),"1",user.getUID()+"",SystemEnv.getHtmlLabelName(1361,user.getLanguage()));
}
}
}
}
else if("edit".equals(method))
{
String companyid = Util.null2String(request.getParameter("companyid"));
rs.execute("select count(*) s from Companyattributable where id='"+companyvestin+"'");
if(rs.next()&&rs.getInt("s")>0){
rs.execute("select count(*) s from CompanyBusinessService where id='"+businesstype+"'");
if(rs.next()&&rs.getInt("s")>0){
strSql.setLength(0);
strSql.append(" update CPCOMPANYINFO set archivenum = '"+archivenum+"',companyregion="+companyregion+",");
strSql.append(" companyvestin='"+companyvestin+"',companyname='"+companyname+"',");
strSql.append(" companyaddress='"+companyaddress+"',businesstype='"+businesstype+"',");
strSql.append(" loancard='"+loancard+"',lastupdatetime='"+lastupdatetime+"',companyename='"+companyename+"',foundingTime='"+foundingTime+"'");
strSql.append(" where companyid="+companyid);
//System.out.println(strSql.toString());
rs.execute(strSql.toString());
pro.writeCompanylog("3",companyid,"2",user.getUID()+"",SystemEnv.getHtmlLabelName(1361,user.getLanguage()));
}
}
}
else if("del".equals(method)){
String companyids = Util.null2String(request.getParameter("companyids"));
if(companyids.endsWith(",")){
companyids = companyids.substring(0,companyids.length()-1);
}
strSql.setLength(0);
strSql.append(" update CPCOMPANYINFO set isdel='F' where companyid in("+companyids+")");
//System.out.println(strSql.toString());
rs.execute(strSql.toString());
pro.writeCompanylog("3",companyids,"3",user.getUID()+"",SystemEnv.getHtmlLabelName(1361,user.getLanguage()));
}else if("haved".equals(method)){
String companyid = Util.null2String(request.getParameter("companyid"));
String havesql = "select count(tcp.companyid) as count from cpcompanyinfo tcp where tcp.companyname = '"+companyname+"' and tcp.archivenum='"+archivenum+"' and tcp.isdel='T'";
if("edit".equals(methodval)){
//如果是编辑,需要排除本身
havesql+=" and companyid !="+companyid+"";
}
rs.execute(havesql);
if(rs.next()){
String havecount = rs.getString("count");
if(havecount.equals("1"))
{
out.print("lmboth");
}else{
String havenumsql = "select count(tcp.companyid) as count from cpcompanyinfo tcp where tcp.archivenum='"+archivenum+"' and tcp.isdel='T'";
if("edit".equals(methodval)){
//如果是编辑,需要排除本身
havenumsql+=" and companyid !="+companyid+"";
}
rs.execute(havenumsql);
if(rs.next()){
havecount = rs.getString("count");
if(havecount.equals("1")){
out.print("lmnum");
}else{
String havenamesql = "select count(tcp.companyid) as count from cpcompanyinfo tcp where tcp.companyname = '"+companyname+"' and tcp.isdel='T'";
if("edit".equals(methodval)){
//如果是编辑,需要排除本身
havenamesql+=" and companyid !="+companyid+"";
}
rs.execute(havenamesql);
if(rs.next()){
havecount = rs.getString("count");
if(havecount.equals("1")){
out.print("lmname");
}else{
out.print("lmnohave");
}
}
}
}
}
}
}
//out.println("{method:'"+method+"',flag:'"+flag+"'}");
%>