Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
drp
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
drp
Commits
f13bce6f
Commit
f13bce6f
authored
Mar 24, 2015
by
reedmi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除多余的project相关
parent
4365dd18
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
743 additions
and
1571 deletions
+743
-1571
.gitignore
.gitignore
+1
-0
pom.xml
pom.xml
+189
-189
src/main/java/com/originspark/drp/controllers/BaseController.java
.../java/com/originspark/drp/controllers/BaseController.java
+1
-1
src/main/java/com/originspark/drp/controllers/MainController.java
.../java/com/originspark/drp/controllers/MainController.java
+4
-4
src/main/java/com/originspark/drp/controllers/ProfileController.java
...va/com/originspark/drp/controllers/ProfileController.java
+5
-5
src/main/java/com/originspark/drp/controllers/UserController.java
.../java/com/originspark/drp/controllers/UserController.java
+31
-31
src/main/java/com/originspark/drp/dao/BaseDAO.java
src/main/java/com/originspark/drp/dao/BaseDAO.java
+6
-2
src/main/java/com/originspark/drp/dao/BaseDAOSupport.java
src/main/java/com/originspark/drp/dao/BaseDAOSupport.java
+6
-6
src/main/java/com/originspark/drp/models/AbstractModel.java
src/main/java/com/originspark/drp/models/AbstractModel.java
+8
-8
src/main/java/com/originspark/drp/models/User.java
src/main/java/com/originspark/drp/models/User.java
+1
-1
src/main/java/com/originspark/drp/processor/UTF8StringBeanPostProcessor.java
...riginspark/drp/processor/UTF8StringBeanPostProcessor.java
+25
-24
src/main/java/com/originspark/drp/util/Blowfish.java
src/main/java/com/originspark/drp/util/Blowfish.java
+320
-262
src/main/java/com/originspark/drp/util/FileUtil.java
src/main/java/com/originspark/drp/util/FileUtil.java
+1
-1
src/main/java/com/originspark/drp/util/SessionUtil.java
src/main/java/com/originspark/drp/util/SessionUtil.java
+5
-4
src/main/java/com/originspark/drp/util/StringUtil.java
src/main/java/com/originspark/drp/util/StringUtil.java
+14
-14
src/main/java/com/originspark/drp/util/poi/exporter/MonthendInventoryGenerator.java
...ark/drp/util/poi/exporter/MonthendInventoryGenerator.java
+9
-9
src/main/java/com/originspark/drp/web/models/projects/ProjectUI.java
...va/com/originspark/drp/web/models/projects/ProjectUI.java
+0
-87
src/main/resources/META-INF/persistence.xml
src/main/resources/META-INF/persistence.xml
+19
-0
src/main/resources/context.xml
src/main/resources/context.xml
+2
-20
src/main/resources/ehcache-hibernate-local.xml
src/main/resources/ehcache-hibernate-local.xml
+4
-7
src/main/resources/jdbc.properties
src/main/resources/jdbc.properties
+1
-17
src/main/resources/sql/users.sql
src/main/resources/sql/users.sql
+0
-69
src/main/webapp/WEB-INF/web.xml
src/main/webapp/WEB-INF/web.xml
+91
-90
src/main/webapp/drp/app/controller/projects/ProjectController.js
...n/webapp/drp/app/controller/projects/ProjectController.js
+0
-229
src/main/webapp/drp/app/model/projects/ProjectModel.js
src/main/webapp/drp/app/model/projects/ProjectModel.js
+0
-51
src/main/webapp/drp/app/store/projects/ProjectDataStore.js
src/main/webapp/drp/app/store/projects/ProjectDataStore.js
+0
-4
src/main/webapp/drp/app/store/projects/ProjectStore.js
src/main/webapp/drp/app/store/projects/ProjectStore.js
+0
-9
src/main/webapp/drp/app/view/projects/ProjectView.js
src/main/webapp/drp/app/view/projects/ProjectView.js
+0
-195
src/main/webapp/drp/app/view/projects/ProjectViewForm.js
src/main/webapp/drp/app/view/projects/ProjectViewForm.js
+0
-148
src/main/webapp/drp/app/view/projects/SystemViewForm.js
src/main/webapp/drp/app/view/projects/SystemViewForm.js
+0
-84
No files found.
.gitignore
View file @
f13bce6f
...
...
@@ -5,3 +5,4 @@
.settings
/filters/dev
upload/
.springBeans
pom.xml
View file @
f13bce6f
This diff is collapsed.
Click to expand it.
src/main/java/com/originspark/drp/controllers/BaseController.java
View file @
f13bce6f
...
...
@@ -78,7 +78,7 @@ public class BaseController extends HandlerInterceptorAdapter {
}
public
User
getCurrentUser
()
{
return
(
User
)
session
().
getAttribute
(
"user"
);
return
(
User
)
session
().
getAttribute
(
"user"
);
}
// 一般用于create、update、delete的返回值
...
...
src/main/java/com/originspark/drp/controllers/MainController.java
View file @
f13bce6f
...
...
@@ -8,12 +8,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
public
class
MainController
{
@RequestMapping
(
"index"
)
public
String
index
(){
public
String
index
()
{
return
"index"
;
}
@RequestMapping
(
value
=
"main"
,
method
=
RequestMethod
.
GET
)
public
String
main
(){
@RequestMapping
(
value
=
"main"
,
method
=
RequestMethod
.
GET
)
public
String
main
()
{
return
"main"
;
}
}
src/main/java/com/originspark/drp/controllers/ProfileController.java
View file @
f13bce6f
...
...
@@ -15,9 +15,9 @@ import com.originspark.drp.util.json.PasswordJson;
@RequestMapping
(
"profile"
)
public
class
ProfileController
extends
BaseController
{
@RequestMapping
(
value
=
"/password/update"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/password/update"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
String
updatePassword
(
@RequestParam
String
data
){
public
String
updatePassword
(
@RequestParam
String
data
)
{
System
.
out
.
println
(
request
().
getSession
());
...
...
@@ -25,7 +25,7 @@ public class ProfileController extends BaseController {
try
{
PasswordJson
json
=
mapper
.
readValue
(
data
,
PasswordJson
.
class
);
if
(!
json
.
getNewpwd
().
equals
(
json
.
getNewpwdagain
()))
{
if
(!
json
.
getNewpwd
().
equals
(
json
.
getNewpwdagain
()))
{
return
failure
(
"修改失败,密码两次输入不一致"
);
}
...
...
@@ -33,7 +33,7 @@ public class ProfileController extends BaseController {
Blowfish
bf
=
new
Blowfish
();
String
pwd
=
bf
.
decryptString
(
user
.
getPassword
());
if
(!
json
.
getPwd
().
equals
(
pwd
))
{
if
(!
json
.
getPwd
().
equals
(
pwd
))
{
return
failure
(
"修改失败,请输入正确的原始密码"
);
}
...
...
@@ -43,7 +43,7 @@ public class ProfileController extends BaseController {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
failure
(
"系统出现异常,修改失败"
);
}
}
return
ok
(
"密码修改成功"
);
}
...
...
src/main/java/com/originspark/drp/controllers/UserController.java
View file @
f13bce6f
...
...
@@ -26,14 +26,14 @@ import com.originspark.drp.util.json.JsonUtils;
@RequestMapping
(
"users"
)
public
class
UserController
extends
BaseController
{
@RequestMapping
(
value
=
"/{type}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/{type}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
String
create
(
@PathVariable
String
type
,
@RequestBody
User
user
)
{
if
(
type
==
null
||
""
.
equals
(
type
))
{
if
(
type
==
null
||
""
.
equals
(
type
))
{
return
ok
(
"参数错误"
);
}
User
currentUser
=
getCurrentUser
();
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
return
ok
(
"权限不足"
);
}
user
.
setType
(
UserType
.
valueOf
(
type
.
toUpperCase
()));
...
...
@@ -45,11 +45,11 @@ public class UserController extends BaseController {
@RequestMapping
(
value
=
"/{type}/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
public
String
delete
(
@PathVariable
String
type
,
@PathVariable
Long
id
)
{
if
(
type
==
null
||
""
.
equals
(
type
)
||
id
==
null
||
id
<
1
)
{
if
(
type
==
null
||
""
.
equals
(
type
)
||
id
==
null
||
id
<
1
)
{
return
ok
(
"参数错误"
);
}
User
currentUser
=
getCurrentUser
();
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
return
ok
(
"权限不足"
);
}
User
leader
=
userService
.
findById
(
User
.
class
,
id
);
...
...
@@ -58,43 +58,43 @@ public class UserController extends BaseController {
return
ok
(
"注销成功"
);
}
@RequestMapping
(
value
=
"/{type}/deleteBatch"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{type}/deleteBatch"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
String
deleteBatch
(
@PathVariable
String
type
,
HttpServletRequest
request
){
if
(
type
==
null
||
""
.
equals
(
type
))
{
public
String
deleteBatch
(
@PathVariable
String
type
,
HttpServletRequest
request
)
{
if
(
type
==
null
||
""
.
equals
(
type
))
{
return
ok
(
"参数错误"
);
}
User
currentUser
=
getCurrentUser
();
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
return
ok
(
"权限不足"
);
}
String
data
=
request
.
getParameter
(
"data"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
IdsJson
json
=
null
;
try
{
json
=
mapper
.
readValue
(
data
,
IdsJson
.
class
);
}
catch
(
Exception
e
)
{
return
failure
(
"提交数据有误"
);
}
if
(
json
==
null
)
{
return
failure
(
"没有需要审核的数据"
);
}
for
(
long
id:
json
.
getIds
())
{
User
leader
=
userService
.
findById
(
User
.
class
,
id
);
leader
.
setStatus
(
Status
.
DESTORYED
);
userService
.
update
(
leader
);
}
String
data
=
request
.
getParameter
(
"data"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
IdsJson
json
=
null
;
try
{
json
=
mapper
.
readValue
(
data
,
IdsJson
.
class
);
}
catch
(
Exception
e
)
{
return
failure
(
"提交数据有误"
);
}
if
(
json
==
null
)
{
return
failure
(
"没有需要审核的数据"
);
}
for
(
long
id
:
json
.
getIds
())
{
User
leader
=
userService
.
findById
(
User
.
class
,
id
);
leader
.
setStatus
(
Status
.
DESTORYED
);
userService
.
update
(
leader
);
}
return
ok
(
"注销成功"
);
}
@RequestMapping
(
value
=
"/{type}/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
public
String
update
(
@PathVariable
String
type
,
@PathVariable
Long
id
,
@RequestBody
User
user
)
{
if
(
type
==
null
||
""
.
equals
(
type
)
||
id
==
null
||
id
<
1
)
{
if
(
type
==
null
||
""
.
equals
(
type
)
||
id
==
null
||
id
<
1
)
{
return
ok
(
"参数错误"
);
}
User
currentUser
=
getCurrentUser
();
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
if
(
currentUser
==
null
||
!
UserType
.
MANAGER
.
equals
(
currentUser
.
getType
()))
{
return
ok
(
"权限不足"
);
}
User
existingLeader
=
userService
.
findById
(
User
.
class
,
id
);
...
...
@@ -114,18 +114,18 @@ public class UserController extends BaseController {
return
ok
(
"更新成功"
);
}
@RequestMapping
(
value
=
"/{type}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{type}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
String
list
(
@PathVariable
String
type
,
@RequestParam
int
start
,
@RequestParam
int
limit
,
@RequestParam
(
required
=
false
)
Object
filter
)
{
public
String
list
(
@PathVariable
String
type
,
@RequestParam
int
start
,
@RequestParam
int
limit
,
@RequestParam
(
required
=
false
)
Object
filter
)
{
List
<
FilterRequest
>
filters
=
new
ArrayList
<
FilterRequest
>();
filters
.
add
(
new
FilterRequest
(
"type"
,
type
.
toUpperCase
()));
if
(
filter
!=
null
)
{
filters
.
addAll
(
JsonUtils
.
getListFromJsonArray
(
filter
));
}
List
<
User
>
data
=
userService
.
pagedDataSet
(
start
,
limit
,
filters
);
List
<
User
>
data
=
userService
.
pagedDataSet
(
start
,
limit
,
filters
);
Long
count
=
userService
.
pagedDataCount
(
filters
);
return
ok
(
data
,
count
);
...
...
src/main/java/com/originspark/drp/dao/BaseDAO.java
View file @
f13bce6f
package
com
.
originspark
.
drp
.
dao
;
public
interface
BaseDAO
<
T
>
{
T
findById
(
Class
<
T
>
c
,
Long
id
);
T
getReferance
(
Class
<
T
>
c
,
Long
id
);
T
findById
(
Class
<
T
>
c
,
Long
id
);
T
getReferance
(
Class
<
T
>
c
,
Long
id
);
T
save
(
T
entity
);
T
update
(
T
entity
);
void
delete
(
T
entity
);
}
src/main/java/com/originspark/drp/dao/BaseDAOSupport.java
View file @
f13bce6f
...
...
@@ -5,7 +5,7 @@ import javax.persistence.PersistenceContext;
import
org.springframework.transaction.annotation.Transactional
;
@Transactional
public
abstract
class
BaseDAOSupport
<
T
>
implements
BaseDAO
<
T
>{
public
abstract
class
BaseDAOSupport
<
T
>
implements
BaseDAO
<
T
>
{
@PersistenceContext
protected
EntityManager
em
;
...
...
@@ -14,8 +14,8 @@ public abstract class BaseDAOSupport<T> implements BaseDAO<T>{
em
.
remove
(
entity
);
}
@Transactional
(
readOnly
=
true
)
public
T
findById
(
Class
<
T
>
c
,
Long
id
)
{
@Transactional
(
readOnly
=
true
)
public
T
findById
(
Class
<
T
>
c
,
Long
id
)
{
return
em
.
find
(
c
,
id
);
}
...
...
@@ -27,9 +27,9 @@ public abstract class BaseDAOSupport<T> implements BaseDAO<T>{
public
T
update
(
T
entity
)
{
return
em
.
merge
(
entity
);
}
@Transactional
(
readOnly
=
true
)
public
T
getReferance
(
Class
<
T
>
c
,
Long
id
)
{
@Transactional
(
readOnly
=
true
)
public
T
getReferance
(
Class
<
T
>
c
,
Long
id
)
{
return
em
.
getReference
(
c
,
id
);
}
...
...
src/main/java/com/originspark/drp/models/AbstractModel.java
View file @
f13bce6f
...
...
@@ -23,25 +23,25 @@ public abstract class AbstractModel {
/**
* 维护信息:记录创建日期
*/
@Column
(
name
=
"createdOn"
,
nullable
=
false
)
@Column
(
name
=
"createdOn"
,
nullable
=
false
)
private
Date
createdOn
;
/**
* 维护信息:记录创建者
*/
@Column
(
name
=
"createdBy"
,
length
=
10
)
@Column
(
name
=
"createdBy"
,
length
=
10
)
private
String
createdBy
;
/**
* 维护信息:记录更新日期
*/
@Column
(
name
=
"updatedOn"
,
nullable
=
false
)
@Column
(
name
=
"updatedOn"
,
nullable
=
false
)
private
Date
updatedOn
;
/**
* 维护信息:记录更新者
*/
@Column
(
name
=
"updatedBy"
,
length
=
10
)
@Column
(
name
=
"updatedBy"
,
length
=
10
)
private
String
updatedBy
;
/**
...
...
@@ -105,12 +105,12 @@ public abstract class AbstractModel {
}
@PreUpdate
private
void
preUpdate
(){
private
void
preUpdate
()
{
updatedOn
=
new
Date
();
}
@Override
public
String
toString
()
{
return
"id="
+
id
+
", updateOn="
+
updatedOn
;
return
"id="
+
id
+
", updateOn="
+
updatedOn
;
}
}
\ No newline at end of file
}
src/main/java/com/originspark/drp/models/User.java
View file @
f13bce6f
...
...
@@ -11,7 +11,7 @@ import com.originspark.drp.util.enums.Gender;
import
com.originspark.drp.util.enums.UserType
;
@Entity
@Table
(
name
=
"users"
)
@Table
(
name
=
"users"
)
public
class
User
extends
AbstractModel
{
@Enumerated
(
EnumType
.
STRING
)
...
...
src/main/java/com/originspark/drp/processor/UTF8StringBeanPostProcessor.java
View file @
f13bce6f
package
com
.
originspark
.
drp
.
processor
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.StringHttpMessageConverter
;
public
class
UTF8StringBeanPostProcessor
implements
BeanPostProcessor
{
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.StringHttpMessageConverter
;
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
bean
instanceof
StringHttpMessageConverter
){
public
class
UTF8StringBeanPostProcessor
implements
BeanPostProcessor
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
bean
instanceof
StringHttpMessageConverter
)
{
MediaType
mediaType
=
new
MediaType
(
"text"
,
"plain"
,
Charset
.
forName
(
"UTF-8"
));
List
<
MediaType
>
types
=
new
ArrayList
<
MediaType
>();
types
.
add
(
mediaType
);
((
StringHttpMessageConverter
)
bean
).
setSupportedMediaTypes
(
types
);
}
return
bean
;
}
List
<
MediaType
>
types
=
new
ArrayList
<
MediaType
>();
types
.
add
(
mediaType
);
((
StringHttpMessageConverter
)
bean
).
setSupportedMediaTypes
(
types
);
}
return
bean
;
}
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
// do nothing
return
bean
;
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
// do nothing
return
bean
;
}
}
\ No newline at end of file
}
src/main/java/com/originspark/drp/util/Blowfish.java
View file @
f13bce6f
This diff is collapsed.
Click to expand it.
src/main/java/com/originspark/drp/util/FileUtil.java
View file @
f13bce6f
...
...
@@ -7,7 +7,7 @@ public class FileUtil {
public
static
String
RESOURCES_PATH
=
"/resources"
;
public
static
String
UPLOAD_PATH
=
"/resources/upload"
;
public
static
String
DOCUMENT_TEMPLATES_PATH
=
"/resources/document_templates"
;
public
static
String
getResourcesPath
(
HttpServletRequest
request
)
{
String
path
=
request
.
getSession
().
getServletContext
().
getRealPath
(
RESOURCES_PATH
);
return
path
;
...
...
src/main/java/com/originspark/drp/util/SessionUtil.java
View file @
f13bce6f
package
com
.
originspark
.
drp
.
util
;
import
javax.servlet.http.HttpServletRequest
;
import
com.originspark.drp.models.User
;
public
class
SessionUtil
{
//返回当前登陆的用户信息
public
static
User
getCurrentUser
(
HttpServletRequest
request
)
{
User
user
=
(
User
)
request
.
getSession
().
getAttribute
(
"user"
);
//
返回当前登陆的用户信息
public
static
User
getCurrentUser
(
HttpServletRequest
request
)
{
User
user
=
(
User
)
request
.
getSession
().
getAttribute
(
"user"
);
return
user
;
}
public
static
String
getCurrentUserName
(
HttpServletRequest
request
){
public
static
String
getCurrentUserName
(
HttpServletRequest
request
)
{
return
getCurrentUser
(
request
).
getName
();
}
}
src/main/java/com/originspark/drp/util/StringUtil.java
View file @
f13bce6f
...
...
@@ -6,35 +6,35 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
public
class
StringUtil
{
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
public
static
Date
String2Date
(
String
str
)
throws
ParseException
{
public
static
Date
String2Date
(
String
str
)
throws
ParseException
{
return
sdf
.
parse
(
str
);
}
public
static
BigDecimal
String2BigDecimal
(
String
str
){
public
static
BigDecimal
String2BigDecimal
(
String
str
)
{
return
BigDecimal
.
valueOf
(
Double
.
parseDouble
(
str
));
}
/**
* 通过年月获取上一个月的年月
*
* @param thisMonth="2014-02"/"2014-01"
* @return "2014-01"/"2013-12"
*/
public
static
String
getPreMonth
(
String
thisMonth
){
public
static
String
getPreMonth
(
String
thisMonth
)
{
String
yearMonth
[]
=
thisMonth
.
split
(
"-"
);
int
month
=
Integer
.
parseInt
(
yearMonth
[
1
]);
if
(
month
>
1
)
{
return
yearMonth
[
0
]
+
"-"
+
String
.
format
(
"%02d"
,
month
-
1
);
if
(
month
>
1
)
{
return
yearMonth
[
0
]
+
"-"
+
String
.
format
(
"%02d"
,
month
-
1
);
}
int
year
=
Integer
.
parseInt
(
yearMonth
[
0
]);
return
(
year
-
1
)+
"-12"
;
return
(
year
-
1
)
+
"-12"
;
}
}
src/main/java/com/originspark/drp/util/poi/exporter/MonthendInventoryGenerator.java
View file @
f13bce6f
...
...
@@ -17,20 +17,20 @@ import org.apache.poi.ss.usermodel.WorkbookFactory;
import
com.originspark.drp.web.models.projects.inventories.Ware
;
public
class
MonthendInventoryGenerator
{
/**
* 生成月末盘点表的excel
*
* @param fileName 文件名:项目名称_系统名称_2014-02_月末盘点
* @param inventories
* @param inventories
* @param resourcePath 代指目录/WebContent/resources
* @return
*/
public
static
File
generate
(
String
fileName
,
List
<
Ware
>
inventories
,
String
resourcePath
)
{
public
static
File
generate
(
String
fileName
,
List
<
Ware
>
inventories
,
String
resourcePath
)
{
try
{
// Open excel template
InputStream
inp
=
new
FileInputStream
(
FileUtils
.
getFile
(
resourcePath
+
"/document_templates/monthEndInventory.xls"
));
InputStream
inp
=
new
FileInputStream
(
FileUtils
.
getFile
(
resourcePath
+
"/document_templates/monthEndInventory.xls"
));
Workbook
wb
=
WorkbookFactory
.
create
(
inp
);
Sheet
mainSheet
=
wb
.
getSheetAt
(
0
);
...
...
@@ -44,10 +44,10 @@ public class MonthendInventoryGenerator {
row
.
createCell
(
1
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getWareBrand
());
row
.
createCell
(
2
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getWareModel
());
row
.
createCell
(
3
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getWareUnit
());
row
.
createCell
(
4
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getLastMonthLeft
()
+
""
);
row
.
createCell
(
5
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getMonthIn
()
+
""
);
row
.
createCell
(
6
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getMonthOut
()
+
""
);
row
.
createCell
(
7
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getMonthLeft
()
+
""
);
row
.
createCell
(
4
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getLastMonthLeft
()
+
""
);
row
.
createCell
(
5
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getMonthIn
()
+
""
);
row
.
createCell
(
6
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getMonthOut
()
+
""
);
row
.
createCell
(
7
,
Cell
.
CELL_TYPE_STRING
).
setCellValue
(
inventory
.
getMonthLeft
()
+
""
);
currentRow
.
increment
();
}
...
...
src/main/java/com/originspark/drp/web/models/projects/ProjectUI.java
deleted
100644 → 0
View file @
4365dd18
package
com
.
originspark
.
drp
.
web
.
models
.
projects
;
import
java.util.Date
;
public
class
ProjectUI
{
private
Long
id
;
private
String
name
;
private
String
code
;
private
String
city
;
private
Date
startDate
;
private
Date
endDate
;
private
Long
parentId
;
private
boolean
leaf
;
private
Long
projectManager
;
private
Long
wareKeeper
;
private
Long
materialKeeper
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
Date
getStartDate
()
{
return
startDate
;
}
public
void
setStartDate
(
Date
startDate
)
{
this
.
startDate
=
startDate
;
}
public
Date
getEndDate
()
{
return
endDate
;
}
public
void
setEndDate
(
Date
endDate
)
{
this
.
endDate
=
endDate
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
boolean
isLeaf
()
{
return
leaf
;
}
public
void
setLeaf
(
boolean
leaf
)
{
this
.
leaf
=
leaf
;
}
public
Long
getProjectManager
()
{
return
projectManager
;
}
public
void
setProjectManager
(
Long
projectManager
)
{
this
.
projectManager
=
projectManager
;
}
public
Long
getWareKeeper
()
{
return
wareKeeper
;
}
public
void
setWareKeeper
(
Long
wareKeeper
)
{
this
.
wareKeeper
=
wareKeeper
;
}
public
Long
getMaterialKeeper
()
{
return
materialKeeper
;
}
public
void
setMaterialKeeper
(
Long
materialKeeper
)
{
this
.
materialKeeper
=
materialKeeper
;
}
}
src/main/resources/META-INF/persistence.xml
0 → 100644
View file @
f13bce6f
<?xml version="1.0"?>
<persistence
xmlns=
"http://java.sun.com/xml/ns/persistence"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version=
"1.0"
>
<persistence-unit
name=
"default"
transaction-type=
"RESOURCE_LOCAL"
>
<provider>
org.hibernate.ejb.HibernatePersistence
</provider>
<properties>
<property
name=
"hibernate.dialect"
value=
"org.hibernate.dialect.MySQL5Dialect"
/>
<property
name=
"hibernate.max_fetch_depth"
value=
"3"
/>
<property
name=
"hibernate.hbm2ddl.auto"
value=
"update"
/>
<property
name=
"hibernate.jdbc.fetch_size"
value=
"18"
/>
<property
name=
"hibernate.jdbc.batch_size"
value=
"10"
/>
<property
name=
"hibernate.show_sql"
value=
"false"
/>
<property
name=
"hibernate.format_sql"
value=
"false"
/>
<property
name=
"hibernate.cache.region.factory_class"
value=
"org.hibernate.cache.ehcache.EhCacheRegionFactory"
/>
<property
name=
"hibernate.ejb.naming_strategy"
value=
"org.hibernate.cfg.ImprovedNamingStrategy"
/>
<property
name=
"net.sf.ehcache.configurationResourceName"
value=
"ehcache-hibernate-local.xml"
/>
</properties>
</persistence-unit>
</persistence>
src/main/resources/
applicationC
ontext.xml
→
src/main/resources/
c
ontext.xml
View file @
f13bce6f
...
...
@@ -19,23 +19,13 @@
<context:exclude-filter
type=
"annotation"
expression=
"org.springframework.stereotype.Controller"
/>
</context:component-scan>
<bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"locations"
>
<list>
<value>
classpath:jdbc.properties
</value>
</list>
</property>
</bean>
<!-- 数据源配置, 使用DBCP数据库连接池 -->
<context:property-placeholder
location=
"classpath:jdbc.properties"
/>
<bean
id=
"dataSource"
class=
"org.apache.commons.dbcp.BasicDataSource"
destroy-method=
"close"
>
<!-- Connection Info -->
<property
name=
"driverClassName"
value=
"${jdbc.driver}"
/>
<property
name=
"url"
value=
"${jdbc.url}"
/>
<property
name=
"username"
value=
"${jdbc.username}"
/>
<property
name=
"password"
value=
"${jdbc.password}"
/>
<!-- Connection Pooling Info -->
<property
name=
"maxActive"
value=
"${dbcp.maxActive}"
/>
<property
name=
"maxIdle"
value=
"${dbcp.maxIdle}"
/>
<property
name=
"defaultAutoCommit"
value=
"false"
/>
...
...
@@ -49,15 +39,7 @@
<property
name=
"dataSource"
ref=
"dataSource"
/>
<property
name=
"jpaVendorAdapter"
ref=
"hibernateJpaVendorAdapter"
/>
<property
name=
"packagesToScan"
value=
"com.originspark.drp.models.**"
/>
<property
name=
"jpaProperties"
>
<props>
<prop
key=
"hibernate.dialect"
>
${hibernate.dialect}
</prop>
<prop
key=
"hibernate.hbm2ddl.auto"
>
${hibernate.hbm2ddl.auto}
</prop>
<prop
key=
"hibernate.cache.region.factory_class"
>
org.hibernate.cache.ehcache.EhCacheRegionFactory
</prop>
<prop
key=
"net.sf.ehcache.configurationResourceName"
>
ehcache-hibernate-local.xml
</prop>
<prop
key=
"hibernate.ejb.naming_strategy"
>
org.hibernate.cfg.ImprovedNamingStrategy
</prop>
</props>
</property>
<property
name=
"persistenceXmlLocation"
value=
"classpath:META-INF/persistence.xml"
/>
</bean>
<bean
id=
"hibernateJpaVendorAdapter"
class=
"org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
/>
...
...
src/main/resources/ehcache-hibernate-local.xml
View file @
f13bce6f
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<diskStore
path=
"java.io.tmpdir/hibernate/wms"
/>
<!-- DefaultCache setting. -->
<defaultCache
maxElementsInMemory=
"10000"
memoryStoreEvictionPolicy=
"LRU"
eternal=
"false"
timeToIdleSeconds=
"300"
timeToLiveSeconds=
"300"
overflowToDisk=
"false"
diskPersistent=
"false"
/>
<diskStore
path=
"java.io.tmpdir/hibernate/wms"
/>
<!-- DefaultCache setting. -->
<defaultCache
maxElementsInMemory=
"10000"
memoryStoreEvictionPolicy=
"LRU"
eternal=
"false"
timeToIdleSeconds=
"300"
timeToLiveSeconds=
"300"
overflowToDisk=
"false"
diskPersistent=
"false"
/>
</ehcache>
src/main/resources/jdbc.properties
View file @
f13bce6f
#sql.type=h2
#jdbc h2
#jdbc.driver=org.h2.Driver
#jdbc.url=jdbc:h2:file:~/wms;AUTO_SERVER=TRUE
#jdbc.username=sa
#jdbc.password=
#hibernate.dialect=org.hibernate.dialect.H2Dialect
sql.type
=
mysql
jdbc.driver
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://localhost:3306/
drp?useUnicode=true&
characterEncoding=UTF-8
jdbc.url
=
jdbc:mysql://localhost:3306/
test?useUnicode=true&
characterEncoding=UTF-8
jdbc.username
=
root
jdbc.password
=
hibernate.dialect
=
org.hibernate.dialect.MySQL5InnoDBDialect
#hibernate settings
hibernate.hbm2ddl.auto
=
update
hibernate.show_sql
=
true
hibernate.format_sql
=
true
#dbcp settings
dbcp.initialSize
=
5
...
...
src/main/resources/sql/users.sql
View file @
f13bce6f
-- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 2015-03-18 05:10:34
-- 服务器版本: 5.6.20
-- PHP Version: 5.5.15
SET
SQL_MODE
=
"NO_AUTO_VALUE_ON_ZERO"
;
SET
time_zone
=
"+00:00"
;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
;
/*!40101 SET NAMES utf8 */
;
--
-- Database: `drp`
--
-- --------------------------------------------------------
--
-- 表的结构 `users`
--
CREATE
TABLE
IF
NOT
EXISTS
`users`
(
`id`
bigint
(
20
)
NOT
NULL
,
`created_by`
varchar
(
10
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`created_on`
datetime
NOT
NULL
,
`status`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`updated_by`
varchar
(
10
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`updated_on`
datetime
NOT
NULL
,
`address`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`code`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`email`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`gender`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`name`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`password`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`phone`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`type`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
,
`username`
varchar
(
255
)
COLLATE
utf8_unicode_ci
DEFAULT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_unicode_ci
AUTO_INCREMENT
=
2
;
--
-- 转存表中的数据 `users`
--
INSERT
INTO
`users`
(
`id`
,
`created_by`
,
`created_on`
,
`status`
,
`updated_by`
,
`updated_on`
,
`address`
,
`code`
,
`email`
,
`gender`
,
`name`
,
`password`
,
`phone`
,
`type`
,
`username`
)
VALUES
(
1
,
NULL
,
'2015-03-18 11:25:34'
,
'ACTIVE'
,
NULL
,
'2015-03-18 12:10:12'
,
''
,
'admin'
,
''
,
'MALE'
,
'admin'
,
'17a73b924892695ff91e16b35ce100b7c64928e43d5a170a'
,
'1324332345'
,
'MANAGER'
,
NULL
);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER
TABLE
`users`
ADD
PRIMARY
KEY
(
`id`
);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER
TABLE
`users`
MODIFY
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
2
;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
;
src/main/webapp/WEB-INF/web.xml
View file @
f13bce6f
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version=
"2.5"
>
<display-name>
smart-nav
</display-name>
<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
classpath*:applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>
encodingFilter
</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>
encoding
</param-name>
<param-value>
UTF-8
</param-value>
</init-param>
<init-param>
<param-name>
forceEncoding
</param-name>
<param-value>
true
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>
encodingFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<filter>
<filter-name>
openEntityManagerInViewFilter
</filter-name>
<filter-class>
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>
openEntityManagerInViewFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>
springServlet
</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
/WEB-INF/spring-mvc.xml
</param-value>
</init-param>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
springServlet
</servlet-name>
<url-pattern>
/
</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
60
</session-timeout>
</session-config>
<filter>
<filter-name>
HiddenHttpMethodFilter
</filter-name>
<filter-class>
org.springframework.web.filter.HiddenHttpMethodFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>
HiddenHttpMethodFilter
</filter-name>
<servlet-name>
springServlet
</servlet-name>
</filter-mapping>
<error-page>
<error-code>
404
</error-code>
<location>
/common/error.jsp
</location>
</error-page>
<error-page>
<error-code>
400
</error-code>
<location>
/common/error.jsp
</location>
</error-page>
<error-page>
<error-code>
500
</error-code>
<location>
/common/500.jsp
</location>
</error-page>
<!-- 由Tomcat的defaultServlet来处理静态文件 -->
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.css
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.js
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.gif
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.png
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.jpg
</url-pattern>
</servlet-mapping>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version=
"2.5"
>
<display-name>
smart-nav
</display-name>
<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
classpath*:context.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>
encodingFilter
</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>
encoding
</param-name>
<param-value>
UTF-8
</param-value>
</init-param>
<init-param>
<param-name>
forceEncoding
</param-name>
<param-value>
true
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>
encodingFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<filter>
<filter-name>
openEntityManagerInViewFilter
</filter-name>
<filter-class>
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>
openEntityManagerInViewFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>
springServlet
</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
/WEB-INF/spring-mvc.xml
</param-value>
</init-param>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
springServlet
</servlet-name>
<url-pattern>
/
</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
60
</session-timeout>
</session-config>
<filter>
<filter-name>
HiddenHttpMethodFilter
</filter-name>
<filter-class>
org.springframework.web.filter.HiddenHttpMethodFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>
HiddenHttpMethodFilter
</filter-name>
<servlet-name>
springServlet
</servlet-name>
</filter-mapping>
<error-page>
<error-code>
404
</error-code>
<location>
/common/error.jsp
</location>
</error-page>
<error-page>
<error-code>
400
</error-code>
<location>
/common/error.jsp
</location>
</error-page>
<error-page>
<error-code>
500
</error-code>
<location>
/common/500.jsp
</location>
</error-page>
<!-- 由Tomcat的defaultServlet来处理静态文件 -->
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.css
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.js
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.gif
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.png
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
default
</servlet-name>
<url-pattern>
*.jpg
</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
src/main/webapp/drp/app/controller/projects/ProjectController.js
deleted
100644 → 0
View file @
4365dd18
/**
* @author allenjin
*/
Ext
.
define
(
"
drp.app.controller.projects.ProjectController
"
,
{
extend
:
"
drp.app.controller.AbstractController
"
,
projectTreePanel
:
null
,
me
:
null
,
init
:
function
()
{
me
=
this
;
this
.
control
({
'
projectview
'
:
{
afterrender
:
function
(
panel
)
{
projectTreePanel
=
panel
.
down
(
'
treepanel
'
);
var
store
=
projectTreePanel
.
getStore
();
store
.
load
({
node
:
store
.
getRootNode
()
});
}
},
// 查询项目
'
projectview button[action=searchProject]
'
:
{
click
:
this
.
searchProject
},
// 增加项目
'
projectview button[action=addProject]
'
:
{
click
:
this
.
showCreateProjectForm
},
// 添加系统
'
projectview button[action=addSystem]
'
:
{
click
:
this
.
showCreateSystemForm
},
// 更新项目
'
projectview > treepanel
'
:
{
itemdblclick
:
this
.
showUpdateProjectOrSystemForm
,
itemclick
:
function
(
tree
,
record
,
item
,
index
,
e
,
eOpts
)
{
tree
.
toggleOnDblClick
=
false
;
}
},
// 删除项目
'
projectview button[action=deleteProject]
'
:
{
click
:
this
.
deleteProject
},
'
projectviewform button[action=submitProjectForm]
'
:
{
click
:
this
.
submitProjectForm
},
'
projectviewform button[action=closeProjectForm]
'
:
{
click
:
this
.
closeProjectForm
},
'
systemviewform button[action=submitSystemForm]
'
:
{
click
:
this
.
submitProjectForm
},
'
systemviewform button[action=closeSystemForm]
'
:
{
click
:
this
.
closeSystemForm
}
});
},
showCreateProjectForm
:
function
(
btn
)
{
var
projectForm
=
Ext
.
widget
(
"
projectviewform
"
);
AlertWin
.
alert
(
'
新增项目
'
,
null
,
projectForm
,
450
,
240
);
},
showCreateSystemForm
:
function
(
btn
){
var
record
=
projectTreePanel
.
getSelectionModel
().
getSelection
()[
0
];
if
(
!
record
||
record
.
data
.
leaf
)
{
Ext
.
MessageBox
.
show
({
title
:
"
提示
"
,
msg
:
"
请先选择项目!
"
,
icon
:
Ext
.
MessageBox
.
INFO
,
buttons
:
Ext
.
Msg
.
OK
});
return
;
}
var
systemForm
=
Ext
.
widget
(
"
systemviewform
"
);
//设置项目名称
var
project
=
record
;
systemForm
.
down
(
'
#projectId
'
).
setValue
(
project
.
data
.
id
);
systemForm
.
down
(
'
#projectName
'
).
setValue
(
project
.
data
.
name
);
AlertWin
.
alert
(
'
添加系统
'
,
null
,
systemForm
,
450
,
180
);
},
showUpdateProjectOrSystemForm
:
function
(
grid
,
record
,
item
,
index
,
e
,
eopts
)
{
if
(
!
record
)
{
me
.
showPromptsOnUpdate
(
"
数据
"
);
return
;
}
else
{
//如果是系统
if
(
record
.
isLeaf
()){
var
systemForm
=
Ext
.
widget
(
"
systemviewform
"
);
if
(
!
record
)
{
me
.
showPromptsOnUpdate
(
"
系统
"
);
return
;
}
else
{
systemForm
.
down
(
'
form
'
).
loadRecord
(
record
);
//设置项目名称
var
project
=
record
.
parentNode
;
systemForm
.
down
(
'
#projectId
'
).
setValue
(
project
.
data
.
id
);
systemForm
.
down
(
'
#projectName
'
).
setValue
(
project
.
data
.
name
);
AlertWin
.
alert
(
'
修改系统
'
,
null
,
systemForm
,
450
,
180
);
}
//如果是项目
}
else
{
var
projectForm
=
Ext
.
widget
(
"
projectviewform
"
);
if
(
!
record
)
{
me
.
showPromptsOnUpdate
(
"
项目
"
);
return
;
}
else
{
//在弹出更新项目的form前,需要设置下面三部分内容
projectForm
.
down
(
'
form
'
).
loadRecord
(
record
);
//1.设置项目经理
var
projectManagerRecord
=
Ext
.
create
(
"
drp.app.model.users.ProjectManagerModel
"
,
{
id
:
record
.
data
.
projectManager
.
id
,
name
:
record
.
data
.
projectManager
.
name
});
projectForm
.
down
(
'
#projectManager_cb
'
).
setValue
(
projectManagerRecord
);
//2.设置库管员
var
WareKeeperRecord
=
Ext
.
create
(
"
drp.app.model.users.WareKeeperModel
"
,
{
id
:
record
.
data
.
wareKeeper
.
id
,
name
:
record
.
data
.
wareKeeper
.
name
});
projectForm
.
down
(
'
#wareKeeper_cb
'
).
setValue
(
WareKeeperRecord
);
//3.设置材料员
var
MaterialKeeperRecord
=
Ext
.
create
(
"
drp.app.model.users.MaterialKeeperModel
"
,
{
id
:
record
.
data
.
materialKeeper
.
id
,
name
:
record
.
data
.
materialKeeper
.
name
});
projectForm
.
down
(
'
#materialKeeper_cb
'
).
setValue
(
MaterialKeeperRecord
);
AlertWin
.
alert
(
'
修改项目
'
,
null
,
projectForm
,
450
,
240
);
}
}
}
},
deleteProject
:
function
(
btn
)
{
var
record
=
projectTreePanel
.
getSelectionModel
().
getSelection
()[
0
];
if
(
!
record
)
{
me
.
showPromptsOnDelete
(
name
);
return
;
}
else
{
Ext
.
MessageBox
.
confirm
(
"
标题
"
,
"
你要删除这个项目吗?
"
,
function
(
btn
)
{
if
(
btn
==
'
yes
'
)
{
me
.
destroyTreeNode
(
record
,
{
success
:
function
(
records
,
operation
)
{
projectTreePanel
.
getSelectionModel
().
deselectAll
();
projectTreePanel
.
getStore
().
load
();
Ext
.
Msg
.
alert
(
"
成功!
"
,
operation
.
request
.
scope
.
reader
.
jsonData
[
"
message
"
]);
},
failure
:
function
(
records
,
operation
)
{
Ext
.
Msg
.
alert
(
"
失败!
"
,
operation
.
request
.
scope
.
reader
.
jsonData
[
"
message
"
]);
}
});
}
});
}
},
submitProjectForm
:
function
(
btn
)
{
var
modelName
=
"
drp.app.model.projects.ProjectModel
"
;
var
form
=
btn
.
up
(
'
form
'
).
getForm
();
if
(
form
.
isValid
())
{
var
formBean
=
form
.
getValues
();
var
model
=
Ext
.
create
(
modelName
,
formBean
);
model
.
set
(
"
projectManager
"
,
formBean
[
'
projectManager.id
'
]);
model
.
set
(
"
wareKeeper
"
,
formBean
[
'
wareKeeper.id
'
]);
model
.
set
(
"
materialKeeper
"
,
formBean
[
'
materialKeeper.id
'
]);
me
.
saveModel
(
model
,
projectTreePanel
);
}
},
closeProjectForm
:
function
(
btn
)
{
me
.
closeForm
();
},
closeSystemForm
:
function
(
btn
)
{
me
.
closeForm
();
},
searchProject
:
function
(
btn
)
{
var
store
=
projectTreePanel
.
getStore
();
store
.
filters
.
clear
();
store
.
filter
([
{
property
:
"
name
"
,
value
:
Ext
.
getCmp
(
"
projectName_filter
"
).
getValue
()
},
{
property
:
"
code
"
,
value
:
Ext
.
getCmp
(
"
projectCode_filter
"
).
getValue
()
},
{
property
:
"
city
"
,
value
:
Ext
.
getCmp
(
"
projectCity_filter
"
).
getValue
()
},
{
property
:
"
startDate
"
,
value
:
Ext
.
getCmp
(
"
projectStartDate_filter
"
).
getValue
()
},
{
property
:
"
endDate
"
,
value
:
Ext
.
getCmp
(
"
projectEndDate_filter
"
).
getValue
()
}
]);
},
models
:
[
"
drp.app.model.projects.ProjectModel
"
,
"
drp.app.model.users.ProjectManagerModel
"
,
"
drp.app.model.users.WareKeeperModel
"
,
"
drp.app.model.users.MaterialKeeperModel
"
],
stores
:
[
"
drp.app.store.projects.ProjectStore
"
,
"
drp.app.store.users.ProjectManagerStore
"
,
"
drp.app.store.users.MaterialKeeperStore
"
,
"
drp.app.store.users.WareKeeperStore
"
],
views
:
[
"
drp.app.view.projects.ProjectView
"
,
"
drp.app.view.projects.ProjectViewForm
"
,
"
drp.app.view.projects.SystemViewForm
"
]
});
\ No newline at end of file
src/main/webapp/drp/app/model/projects/ProjectModel.js
deleted
100644 → 0
View file @
4365dd18
/**
* @author allenjin
*/
Ext
.
define
(
"
drp.app.model.projects.ProjectModel
"
,
{
extend
:
"
drp.app.model.AbstractModel
"
,
fields
:
[{
name
:
"
name
"
// 项目名称
},
{
name
:
"
code
"
// 项目编号
},
{
name
:
"
city
"
//项目所在城市
},
{
name
:
"
startDate
"
// 开工时间
},
{
name
:
"
endDate
"
// 竣工时间
},
{
name
:
"
projectName
"
,
persist
:
false
},
{
name
:
'
projectManager
'
,
type
:
'
auto
'
},
{
name
:
'
wareKeeper
'
,
type
:
'
auto
'
},
{
name
:
'
materialKeeper
'
,
type
:
'
auto
'
}],
proxy
:
{
type
:
'
rest
'
,
url
:
'
project
'
,
reader
:
{
type
:
"
json
"
,
root
:
"
data
"
,
successProperty
:
'
success
'
},
writer
:
{
type
:
"
json
"
},
listeners
:
{
exception
:
function
(
proxy
,
response
,
operation
)
{
Ext
.
MessageBox
.
show
({
title
:
'
错误
'
,
msg
:
"
数据加载错误,请尝试刷新页面
"
,
icon
:
Ext
.
MessageBox
.
ERROR
,
buttons
:
Ext
.
Msg
.
OK
});
}
}
}
});
\ No newline at end of file
src/main/webapp/drp/app/store/projects/ProjectDataStore.js
deleted
100644 → 0
View file @
4365dd18
Ext
.
define
(
"
drp.app.store.projects.ProjectDataStore
"
,
{
extend
:
'
drp.app.store.AbstractStore
'
,
model
:
'
drp.app.model.projects.ProjectModel
'
});
\ No newline at end of file
src/main/webapp/drp/app/store/projects/ProjectStore.js
deleted
100644 → 0
View file @
4365dd18
/**
* @author reed mi
*/
Ext
.
define
(
"
drp.app.store.projects.ProjectStore
"
,
{
extend
:
'
Ext.data.TreeStore
'
,
model
:
'
drp.app.model.projects.ProjectModel
'
,
defaultRootId
:
''
,
root
:
{
data
:
[]}
});
\ No newline at end of file
src/main/webapp/drp/app/view/projects/ProjectView.js
deleted
100644 → 0
View file @
4365dd18
/**
* @author allenjin
*/
Ext
.
define
(
'
drp.app.view.projects.ProjectView
'
,
{
extend
:
'
Ext.panel.Panel
'
,
alias
:
'
widget.projectview
'
,
margins
:
'
0 0 0 0
'
,
border
:
0
,
title
:
'
<center height=40>项目列表</center>
'
,
autoScroll
:
true
,
closable
:
true
,
layout
:
{
type
:
'
border
'
},
initComponent
:
function
()
{
var
me
=
this
;
// var selModel = Ext.create('Ext.selection.CheckboxModel', {
// listeners : {
// selectionchange : function(sm, selections) {
// me.down('#deleteProject_btn').setDisabled(selections.length == 0);
// }
// }
// });
Ext
.
applyIf
(
me
,
{
items
:
[
// {
// xtype : 'panel',
// region : 'north',
// title : '查询',
// collapsible : true,
// items : [ {
// xtype : 'form',
// items : [{
// xtype : 'fieldcontainer',
// layout : 'column',
// items : [ {
// xtype : 'textfield',
// margin : '5 0 0 10',
// id: 'projectName_filter',
// fieldLabel : '项目名称'
// }, {
// xtype : 'textfield',
// margin : '5 0 0 15',
// id: 'projectCode_filter',
// fieldLabel : '项目编码'
// } ]
// }, {
// xtype : 'fieldcontainer',
// layout : 'column',
// items : [ {
// xtype : 'datefield',
// margin : '5 0 0 10',
// id: 'projectStartDate_filter',
// fieldLabel : '开工时间'
// }, {
// xtype : 'datefield',
// margin : '5 0 0 15',
// id: 'projectEndDate_filter',
// fieldLabel : '竣工时间'
// }, {
// xtype : 'textfield',
// margin : '5 0 0 10',
// id: 'projectCity_filter',
// fieldLabel : '城市'
// }, {
// xtype : 'button',
// margin : '5 0 0 20',
// action : 'searchProject',
// icon : 'resources/images/icons/search.png',
// text : '查询'
// } ]
// } ]
// } ]
// },
{
xtype
:
'
treepanel
'
,
region
:
'
center
'
,
rootVisible
:
false
,
autoScroll
:
true
,
columnLines
:
true
,
rowLines
:
true
,
// selModel : selModel,
viewConfig
:
{
// 防止在刷新节点后默认回到最top
preserveScrollOnRefresh
:
false
},
store
:
"
drp.app.store.projects.ProjectStore
"
,
columns
:
[{
xtype
:
'
treecolumn
'
,
width
:
200
,
dataIndex
:
'
name
'
,
text
:
'
项目名称
'
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
code
'
,
text
:
'
项目编号
'
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
projectManager
'
,
text
:
'
项目经理
'
,
renderer
:
function
(
value
,
metadata
,
record
)
{
if
(
record
.
isLeaf
())
{
return
""
;
}
else
{
return
value
==
null
?
""
:(
value
.
name
);
}
}
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
wareKeeper
'
,
text
:
'
库管员
'
,
renderer
:
function
(
value
,
metadata
,
record
)
{
if
(
record
.
isLeaf
())
{
return
""
;
}
else
{
return
value
==
null
?
""
:(
value
.
name
);
}
}
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
materialKeeper
'
,
text
:
'
材料员
'
,
renderer
:
function
(
value
,
metadata
,
record
)
{
if
(
record
.
isLeaf
())
{
return
""
;
}
else
{
return
value
==
null
?
""
:(
value
.
name
);
}
}
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
city
'
,
text
:
'
城市
'
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
startDate
'
,
text
:
'
开工时间
'
},
{
xtype
:
'
gridcolumn
'
,
width
:
100
,
dataIndex
:
'
endDate
'
,
text
:
'
竣工时间
'
},
{
xtype
:
'
gridcolumn
'
,
width
:
140
,
dataIndex
:
'
createOn
'
,
text
:
'
创建时间
'
},
{
xtype
:
'
gridcolumn
'
,
width
:
140
,
dataIndex
:
'
updateOn
'
,
text
:
'
更新时间
'
}],
listeners
:
{
'
selectionchange
'
:
function
(
model
,
selected
){
me
.
down
(
'
#deleteProject_btn
'
).
setDisabled
(
selected
.
length
==
0
);
}
},
dockedItems
:
[{
xtype
:
'
toolbar
'
,
dock
:
'
top
'
,
items
:
[{
xtype
:
'
button
'
,
icon
:
'
resources/images/icons/add.png
'
,
action
:
'
addProject
'
,
text
:
'
新增项目
'
},
'
-
'
,
{
xtype
:
'
button
'
,
icon
:
'
resources/images/icons/add.png
'
,
action
:
'
addSystem
'
,
text
:
'
新增系统
'
},
'
-
'
,
{
xtype
:
'
button
'
,
icon
:
'
resources/images/icons/delete.png
'
,
action
:
'
deleteProject
'
,
itemId
:
"
deleteProject_btn
"
,
disabled
:
true
,
text
:
'
删除
'
}]
}]
}]
});
me
.
callParent
(
arguments
);
}
});
\ No newline at end of file
src/main/webapp/drp/app/view/projects/ProjectViewForm.js
deleted
100644 → 0
View file @
4365dd18
/**
* @author allenjin
*/
Ext
.
define
(
"
drp.app.view.projects.ProjectViewForm
"
,
{
extend
:
'
Ext.panel.Panel
'
,
alias
:
'
widget.projectviewform
'
,
author
:
'
100%
'
,
autoScroll
:
true
,
items
:
[{
xtype
:
'
form
'
,
items
:
[{
xtype
:
'
textfield
'
,
hidden
:
true
,
name
:
'
id
'
},
{
xtype
:
'
textfield
'
,
anchor
:
'
95%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
name
'
,
allowBlank
:
false
,
fieldLabel
:
'
项目名称<font color="red">*</font>
'
},
{
xtype
:
'
textfield
'
,
anchor
:
'
95%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
code
'
,
allowBlank
:
false
,
fieldLabel
:
'
项目编号<font color="red">*</font>
'
},
{
xtype
:
'
combobox
'
,
anchor
:
'
90%
'
,
margin
:
'
5 0 0 5
'
,
allowBlank
:
false
,
editable
:
false
,
itemId
:
'
projectManager_cb
'
,
name
:
'
projectManager.id
'
,
displayField
:
"
name
"
,
valueField
:
"
id
"
,
fieldLabel
:
'
项目经理<font color="red">*</font>
'
,
store
:
Ext
.
create
(
"
Ext.data.Store
"
,{
model
:
'
drp.app.model.users.ProjectManagerModel
'
,
autoLoad
:
false
}),
listeners
:
{
afterrender
:
function
(
cb
){
var
store
=
cb
.
getStore
();
store
.
filters
.
clear
();
store
.
filter
([
{
property
:
"
status
"
,
value
:
"
ACTIVE
"
}]);
}
}
},
{
xtype
:
'
combobox
'
,
anchor
:
'
90%
'
,
margin
:
'
5 0 0 5
'
,
allowBlank
:
false
,
editable
:
false
,
itemId
:
'
wareKeeper_cb
'
,
name
:
'
wareKeeper.id
'
,
displayField
:
"
name
"
,
valueField
:
"
id
"
,
fieldLabel
:
'
库管员<font color="red">*</font>
'
,
store
:
Ext
.
create
(
"
Ext.data.Store
"
,{
model
:
'
drp.app.model.users.WareKeeperModel
'
,
autoLoad
:
false
}),
listeners
:
{
afterrender
:
function
(
cb
){
var
store
=
cb
.
getStore
();
store
.
filters
.
clear
();
store
.
filter
([
{
property
:
"
status
"
,
value
:
"
ACTIVE
"
}]);
}
}
},
{
xtype
:
'
combobox
'
,
anchor
:
'
90%
'
,
margin
:
'
5 0 0 5
'
,
allowBlank
:
false
,
editable
:
false
,
itemId
:
'
materialKeeper_cb
'
,
name
:
'
materialKeeper.id
'
,
displayField
:
"
name
"
,
valueField
:
"
id
"
,
fieldLabel
:
'
材料员<font color="red">*</font>
'
,
store
:
Ext
.
create
(
"
Ext.data.Store
"
,{
model
:
'
drp.app.model.users.MaterialKeeperModel
'
,
autoLoad
:
false
}),
listeners
:
{
afterrender
:
function
(
cb
){
var
store
=
cb
.
getStore
();
store
.
filters
.
clear
();
store
.
filter
([
{
property
:
"
status
"
,
value
:
"
ACTIVE
"
}]);
}
}
},
{
xtype
:
'
textfield
'
,
anchor
:
'
70%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
city
'
,
fieldLabel
:
'
城市
'
},
{
xtype
:
'
datefield
'
,
anchor
:
'
70%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
startDate
'
,
format
:
'
Y-m-d
'
,
editable
:
false
,
fieldLabel
:
'
开工时间
'
},{
xtype
:
'
datefield
'
,
anchor
:
'
70%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
endDate
'
,
format
:
'
Y-m-d
'
,
editable
:
false
,
fieldLabel
:
'
竣工时间
'
},
{
xtype
:
'
fieldcontainer
'
,
height
:
30
,
anchor
:
'
95%
'
,
margin
:
'
5 0 10 5
'
,
style
:
'
text-align:center
'
,
items
:
[{
xtype
:
'
button
'
,
margin
:
'
5 0 0 5
'
,
action
:
'
submitProjectForm
'
,
width
:
80
,
formBind
:
true
,
text
:
'
确认
'
},
{
xtype
:
'
button
'
,
margin
:
'
5 0 0 5
'
,
action
:
'
closeProjectForm
'
,
width
:
80
,
text
:
'
取消
'
}]
}]
}]
});
src/main/webapp/drp/app/view/projects/SystemViewForm.js
deleted
100644 → 0
View file @
4365dd18
/**
* @author reed mi
*/
Ext
.
define
(
"
drp.app.view.projects.SystemViewForm
"
,
{
extend
:
'
Ext.panel.Panel
'
,
alias
:
'
widget.systemviewform
'
,
author
:
'
100%
'
,
autoScroll
:
true
,
items
:
[{
xtype
:
'
form
'
,
items
:
[{
xtype
:
'
textfield
'
,
hidden
:
true
,
name
:
'
id
'
},
{
xtype
:
'
textfield
'
,
hidden
:
true
,
itemId
:
'
projectId
'
,
name
:
'
parentId
'
},
{
xtype
:
'
displayfield
'
,
margin
:
'
5 0 0 5
'
,
anchor
:
'
100%
'
,
itemId
:
'
projectName
'
,
fieldLabel
:
'
项目名称<font color="red">*</font>
'
},
{
xtype
:
'
textfield
'
,
anchor
:
'
95%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
name
'
,
allowBlank
:
false
,
fieldLabel
:
'
系统名称<font color="red">*</font>
'
},
{
xtype
:
'
textfield
'
,
anchor
:
'
95%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
code
'
,
allowBlank
:
false
,
fieldLabel
:
'
系统编号<font color="red">*</font>
'
},
{
xtype
:
'
textfield
'
,
anchor
:
'
70%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
city
'
,
fieldLabel
:
'
城市
'
},
{
xtype
:
'
datefield
'
,
anchor
:
'
70%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
startDate
'
,
format
:
'
Y-m-d
'
,
editable
:
false
,
fieldLabel
:
'
开工时间
'
},{
xtype
:
'
datefield
'
,
anchor
:
'
70%
'
,
margin
:
'
5 0 0 5
'
,
name
:
'
endDate
'
,
format
:
'
Y-m-d
'
,
editable
:
false
,
fieldLabel
:
'
竣工时间
'
},
{
xtype
:
'
fieldcontainer
'
,
height
:
30
,
anchor
:
'
95%
'
,
margin
:
'
5 0 10 5
'
,
style
:
'
text-align:center
'
,
items
:
[{
xtype
:
'
button
'
,
margin
:
'
5 0 0 5
'
,
action
:
'
submitSystemForm
'
,
width
:
80
,
formBind
:
true
,
text
:
'
确认
'
},
{
xtype
:
'
button
'
,
margin
:
'
5 0 0 5
'
,
action
:
'
closeSystemForm
'
,
width
:
80
,
text
:
'
取消
'
}]
}]
}]
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment