Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
platform
hp-smart
Commits
a8318a65
Commit
a8318a65
authored
Mar 12, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://gitlab.baocloud.cn/bggf/smart/hp-smart
into dev
parents
efe0e78a
00281a1d
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1902 additions
and
206 deletions
+1902
-206
DdynamicEnum.java
src/main/java/com/baosight/hpjx/common/DdynamicEnum.java
+37
-3
FilterConfig.java
src/main/java/com/baosight/hpjx/config/FilterConfig.java
+25
-0
CodesetConstant.java
...java/com/baosight/hpjx/core/constant/CodesetConstant.java
+2
-0
ServiceHPMT002.java
.../java/com/baosight/hpjx/hp/mt/service/ServiceHPMT002.java
+132
-61
HPMT002.xml
src/main/java/com/baosight/hpjx/hp/mt/sql/HPMT002.xml
+42
-7
BASE64DecodedMultipartFile.java
...aosight/hpjx/hp/mt/untils/BASE64DecodedMultipartFile.java
+59
-0
Base64ToMultipartFile.java
...com/baosight/hpjx/hp/mt/untils/Base64ToMultipartFile.java
+161
-0
Base64Utils.java
...main/java/com/baosight/hpjx/hp/mt/untils/Base64Utils.java
+31
-0
UploadUtils.java
...main/java/com/baosight/hpjx/hp/mt/untils/UploadUtils.java
+158
-6
ServiceHPPZ013.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ013.java
+47
-0
HPPZ013.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ013.xml
+18
-3
HPPZ014.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ014.xml
+1
-3
HPPZTools.java
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
+13
-5
ServiceHPSC003B.java
...java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003B.java
+58
-1
ServiceHPSC005A.java
...java/com/baosight/hpjx/hp/sc/service/ServiceHPSC005A.java
+3
-0
ServiceHPSC007.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC007.java
+7
-3
HPSC005.xml
src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC005.xml
+34
-0
HPXSOrg.xml
src/main/java/com/baosight/hpjx/hp/xs/sql/HPXSOrg.xml
+16
-4
HPZL001.java
src/main/java/com/baosight/hpjx/hp/zl/domain/HPZL001.java
+51
-2
HPZL001A.java
src/main/java/com/baosight/hpjx/hp/zl/domain/HPZL001A.java
+25
-0
ServiceHPZL001B.java
...java/com/baosight/hpjx/hp/zl/service/ServiceHPZL001B.java
+2
-0
HPZL001.xml
src/main/java/com/baosight/hpjx/hp/zl/sql/HPZL001.xml
+5
-1
HPZL001A.xml
src/main/java/com/baosight/hpjx/hp/zl/sql/HPZL001A.xml
+1
-1
StringUtils.java
src/main/java/com/baosight/hpjx/util/StringUtils.java
+64
-1
HTMLFilter.java
src/main/java/com/baosight/hpjx/xss/HTMLFilter.java
+535
-0
XssFilter.java
src/main/java/com/baosight/hpjx/xss/XssFilter.java
+77
-0
XssHttpServletRequestWrapper.java
...a/com/baosight/hpjx/xss/XssHttpServletRequestWrapper.java
+155
-0
HPSC003.js
src/main/webapp/HP/SC/HPSC003.js
+85
-83
HPSC003.jsp
src/main/webapp/HP/SC/HPSC003.jsp
+4
-4
HPSC003B.js
src/main/webapp/HP/SC/HPSC003B.js
+51
-16
HPSC003B.jsp
src/main/webapp/HP/SC/HPSC003B.jsp
+2
-1
HPSC007.jsp
src/main/webapp/HP/SC/HPSC007.jsp
+1
-1
No files found.
src/main/java/com/baosight/hpjx/common/DdynamicEnum.java
View file @
a8318a65
...
...
@@ -127,6 +127,19 @@ public enum DdynamicEnum {
*/
FACTORY_GROUP_ECORD_BLOCK_ID
(
"factory_group_ecord_block_id"
,
"factoryCode"
,
"factoryName"
,
"groupCode"
,
"groupName"
,
"HPPZ011.queryComboBoxAll"
),
/**
* 模块:组管理
* 用途:组管理下拉框
* 编写:ll
*/
GROUP_PRO_BLOCK_ID
(
"group_pro_block_id"
,
"groupCode"
,
"groupName"
,
"HPXSOrg.queryList"
),
/**
* 模块:巡检移动端
* 用途:不良品类下拉
* 编写:ll
*/
POOR_TYPE_BLOCK_ID
(
"poor_type_block_id"
,
"itemCode"
,
"itemCname"
,
"HPXSOrg.queryTedcm01"
),
//------------------------------------生产管理-----------------------------------
/**
* 模块:项目档案
...
...
@@ -164,8 +177,21 @@ public enum DdynamicEnum {
* 编写:wwl
*/
PROJ_PROD_BLOCK_ID
(
"proj_prod_block_id"
,
"projCode"
,
"projName"
,
"HPSC005.queryProjComboBox"
),
/**
* 模块:项目档案(通过工厂、生产组)
* 用途:项目档案下拉框
* 编写:ll
*/
PROJ_PRODQUERY_BLOCK_ID
(
"proj_prodQuery_block_id"
,
"projCode"
,
"projName"
,
"HPSC005.queryProjComboBox2"
),
/**
* 模块:项目档案(通过工厂、生产组、项目号)
* 用途:移动端任务号、生产订单号
* 编写:ll
*/
PROJ_QUERYPROD_BLOCK_ID
(
"proj_queryProd_block_id"
,
"prodOrderNo"
,
"prodTaskNo"
,
"HPSC005.queryProjComboBox2"
),
//------------------------------------用户管理-----------------------------------
/**
...
...
@@ -223,7 +249,15 @@ public enum DdynamicEnum {
* 用途:厂区查询
* 编写:ly
*/
FACTORY_CODE_BLOCK_ID
(
"factory_code_block_id"
,
"factoryCode"
,
"factoryName"
,
"HPXS001.queryFactoryCode"
);
FACTORY_CODE_BLOCK_ID
(
"factory_code_block_id"
,
"factoryCode"
,
"factoryName"
,
"HPXS001.queryFactoryCode"
),
/**
* 模块:工人管理
* 用途:工人管理下拉框
* 编写:wwl
*/
WORKER_BLOCK_ID
(
"worker_block_id"
,
"userId"
,
"userName"
,
"HPPZ013.queryComboBox"
);
/** 将结果集放入的块名 */
private
final
String
blockId
;
...
...
src/main/java/com/baosight/hpjx/config/FilterConfig.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
config
;
import
com.baosight.hpjx.xss.XssFilter
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @Author wwl
* @Date 2024/3/11 14:20
*/
@Configuration
public
class
FilterConfig
{
@Bean
public
FilterRegistrationBean
<
XssFilter
>
xssFilterRegistration
()
{
FilterRegistrationBean
<
XssFilter
>
registration
=
new
FilterRegistrationBean
<>();
registration
.
setFilter
(
new
XssFilter
());
registration
.
addUrlPatterns
(
"/*"
);
registration
.
setOrder
(
1
);
return
registration
;
}
}
\ No newline at end of file
src/main/java/com/baosight/hpjx/core/constant/CodesetConstant.java
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
core
.
constant
;
import
com.baosight.hpjx.util.StringUtils
;
/**
* @author:songx
* @date:2024/3/1,17:36
...
...
src/main/java/com/baosight/hpjx/hp/mt/service/ServiceHPMT002.java
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
hp
.
mt
.
service
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.servlet.multipart.UploadFile
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.mt.untils.uploadUntil
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile
;
import
com.baosight.hpjx.hp.mt.untils.Base64Utils
;
import
com.baosight.hpjx.hp.mt.untils.UploadUtils
;
import
com.baosight.hpjx.hp.sc.domain.HPSC002A
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.hp.xs.domain.User
;
import
com.baosight.hpjx.hp.zl.domain.HPZL001
;
import
com.baosight.hpjx.hp.zl.domain.HPZL001A
;
import
com.baosight.hpjx.util.*
;
import
com.baosight.iplat4j.config.AdminFactoryConfig
;
import
com.baosight.iplat4j.common.ed.domain.TEDCM01
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* 鸿鹏机械APP移动端接口调用处
*/
...
...
@@ -95,8 +108,7 @@ public class ServiceHPMT002 extends ServiceBase {
* @return
*/
public
EiInfo
pmQualityList
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
status
=
MapUtils
.
getString
(
queryMap
,
"status"
);
String
status
=
inInfo
.
getString
(
"status"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
inInfo
.
setMsg
(
"账号异常"
);
...
...
@@ -120,22 +132,40 @@ public class ServiceHPMT002 extends ServiceBase {
* @return
*/
public
EiInfo
pmQualityDetail
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
status
=
MapUtils
.
getString
(
queryMap
,
"status"
);
String
checkNo
=
MapUtils
.
getString
(
queryMap
,
"checkNo"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
inInfo
.
setMsg
(
"账号异常"
);
}
Map
sqlMap
=
new
HashMap
();
sqlMap
.
put
(
"companyCode"
,
companyCode
);
sqlMap
.
put
(
"status"
,
status
);
sqlMap
.
put
(
"checkNo"
,
checkNo
);
List
<
Map
>
rows
=
this
.
dao
.
query
(
"HPMT002.pmQualityDetail"
,
sqlMap
);
EiInfo
outInfo
=
new
EiInfo
();
EiBlock
eiBlock
=
new
EiBlock
(
EiConstant
.
resultBlock
);
eiBlock
.
setRows
(
rows
);
outInfo
.
setBlock
(
eiBlock
);
try
{
String
id
=
inInfo
.
getString
(
"id"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
outInfo
.
setMsg
(
"账号异常"
);
}
Map
Map
=
new
HashMap
();
Map
.
put
(
"checkId"
,
id
);
Map
.
put
(
"docType"
,
"XJ_WC"
);
List
<
HPZL001A
>
docIdlist
=
this
.
dao
.
query
(
"HPZL001A.query"
,
Map
);
List
<
String
>
imgList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
docIdlist
.
size
();
i
++)
{
Map
dirId
=
new
HashMap
();
HPZL001A
hpzl001A
=
docIdlist
.
get
(
i
);
String
docId
=
hpzl001A
.
getDocId
();
dirId
.
put
(
"docId"
,
docId
);
List
<
Map
>
query
=
this
.
dao
.
query
(
"HPMT002.queryFile"
,
dirId
);
File
file
=
new
File
(
UploadUtils
.
ROOT_PATH
+
"/A/"
+
query
.
get
(
0
).
get
(
"CHG_NAME"
));
BufferedImage
bf
=
ImageIO
.
read
(
file
);
String
imgBase64
=
UploadUtils
.
imageToBase64
(
bf
);
imgList
.
add
(
imgBase64
);
}
Map
sqlMap
=
new
HashMap
();
sqlMap
.
put
(
"companyCode"
,
companyCode
);
sqlMap
.
put
(
"id"
,
id
);
List
<
Map
>
rows
=
this
.
dao
.
query
(
"HPMT002.pmQualityDetail"
,
sqlMap
);
EiBlock
eiBlock
=
new
EiBlock
(
EiConstant
.
resultBlock
);
eiBlock
.
setRows
(
rows
);
outInfo
.
setBlock
(
eiBlock
);
outInfo
.
set
(
"img"
,
imgList
);
}
catch
(
Exception
e
){
outInfo
.
setMsg
(
"账号异常"
);
}
return
outInfo
;
}
...
...
@@ -146,17 +176,31 @@ public class ServiceHPMT002 extends ServiceBase {
* @return
*/
public
EiInfo
pmQualityXl
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
factoryId
=
inInfo
.
getString
(
"factoryId"
);
//工厂id
String
prodCode
=
inInfo
.
getString
(
"projCode"
);
//项目id
String
orgNo
=
inInfo
.
getString
(
"orgNo"
);
//生产组id
String
inventCode
=
inInfo
.
getString
(
"inventCode"
);
//部件id
String
subInventCode
=
inInfo
.
getString
(
"subInventCode"
);
//部件id
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
inInfo
.
setMsg
(
"账号异常"
);
}
Map
sqlMap
=
new
HashMap
();
sqlMap
.
put
(
"companyCode"
,
companyCode
);
sqlMap
.
put
(
"factoryCode"
,
factoryId
);
sqlMap
.
put
(
"orgNo"
,
orgNo
);
sqlMap
.
put
(
"prodCode"
,
prodCode
);
sqlMap
.
put
(
"parentPrdtCode"
,
inventCode
);
sqlMap
.
put
(
"subInventCode"
,
subInventCode
);
EiInfo
outInfo
=
new
EiInfo
();
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
ORG_PROD_BLOCK_ID
),
sqlMap
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
PROJ_RECORD_BLOCK_ID
),
sqlMap
,
false
);
TEDCM01
tedcm01
=
new
TEDCM01
();
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
FACTORY_RECORD_BLOCK_ID
),
null
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
PROJ_PRODQUERY_BLOCK_ID
),
sqlMap
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
PROJ_QUERYPROD_BLOCK_ID
),
sqlMap
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
INVENT_RECORD_BLOCK_ID
),
sqlMap
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
GROUP_PRO_BLOCK_ID
),
sqlMap
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
SUB_INVENT_RECORD_BLOCK_ID
),
sqlMap
,
false
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
POOR_TYPE_BLOCK_ID
),
null
,
false
);
return
outInfo
;
}
...
...
@@ -167,54 +211,49 @@ public class ServiceHPMT002 extends ServiceBase {
* @return
*/
public
EiInfo
pmInsertQuality
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
projCode
=
MapUtils
.
getString
(
queryMap
,
"projCode"
);
String
prodOrderNo
=
MapUtils
.
getString
(
queryMap
,
"prodOrderNo"
);
String
docId
=
MapUtils
.
getString
(
queryMap
,
"docId"
);
String
docId
=
inInfo
.
getString
(
"docId"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
inInfo
.
setMsg
(
"账号异常"
);
}
try
{
Map
sqlMap
=
new
HashMap
();
sqlMap
.
put
(
"companyCode"
,
companyCode
);
sqlMap
.
put
(
"projCode"
,
projCode
);
sqlMap
.
put
(
"prodOrderNo"
,
prodOrderNo
);
List
<
HPSC005
>
HPSC005
=
dao
.
query
(
"HPSC005.query"
,
sqlMap
);
HPZL001
fZl001
=
new
HPZL001
();
Map
attr
=
inInfo
.
getAttr
();
fZl001
.
fromMap
(
attr
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
fZl001
.
fromMap
(
queryMap
);
fZl001
.
setProjName
(
HPSC005
.
get
(
0
).
getProjName
());
fZl001
.
setOrgName
(
HPSC005
.
get
(
0
).
getOrgName
());
fZl001
.
setInventName
(
HPSC005
.
get
(
0
).
getPrdtName
());
fZl001
.
setSubInventName
(
HPSC005
.
get
(
0
).
getPartName
());
fZl001
.
setCreatedTime
(
sdf
.
format
(
new
Date
()));
fZl001
.
setReceiptDate
(
DateUtils
.
shortDate
());
// 生成单据号
fZl001
.
setCompanyCode
(
companyCode
);
User
user
=
UserSessionUtils
.
getUser
();
fZl001
.
setCheckUser
(
user
.
getUserName
());
fZl001
.
setCheckNo
(
user
.
getUserId
());
// 生成单据号
fZl001
.
setCheckNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
HPZL001_NUMBER
));
fZl001
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
fZl001
.
setStatus
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
insert
(
HPZL001
.
INSERT
,
fZl001
);
//处理文件
if
(!
fZl001
.
getCheckNo
().
equals
(
"
"
))
{
if
(!
docId
.
equals
(
"
"
))
{
Map
fZl0012
=
new
HashMap
();
fZl0012
.
put
(
"checkNo"
,
fZl001
.
getCheckNo
());
HPZL001
HPZL001
=
(
HPZL001
)
dao
.
query
(
"HPZL001.query"
,
fZl0012
);
List
<
HPZL001
>
HPZL001
=
dao
.
query
(
"HPZL001.query"
,
fZl0012
);
//绑定文件
String
[]
docIds
=
docId
.
split
(
","
);
int
num
=
0
;
while
(
num
<=
docIds
.
length
)
{
HPSC002A
HPSC002A
=
new
HPSC002A
();
HPSC002A
.
setBizType
(
CommonConstant
.
YesNo
.
NO_0
.
toString
());
HPSC002A
.
setDocId
(
docIds
[
num
]);
HPSC002A
.
setMatId
(
HPZL001
.
getId
());
HPSC002A
.
setCompanyCode
(
companyCode
);
DaoUtils
.
insert
(
HPSC002A
.
INSERT
,
HPSC002A
);
while
(
num
<
docIds
.
length
)
{
HPZL001A
HPZL001A
=
new
HPZL001A
();
HPZL001A
.
setDeptCode
(
CommonConstant
.
YesNo
.
YES
);
HPZL001A
.
setDocType
(
CommonConstant
.
YesNo
.
NO_0
);
HPZL001A
.
setBizType
(
"XJ_WC"
);
HPZL001A
.
setDocId
(
docIds
[
num
]);
HPZL001A
.
setCheckId
(
HPZL001
.
get
(
0
).
getId
());
HPZL001A
.
setCompanyCode
(
companyCode
);
DaoUtils
.
insert
(
HPZL001A
.
INSERT
,
HPZL001A
);
num
++;
}
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_
DEFAULT
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_
SUCCESS
);
inInfo
.
setMsg
(
"新增成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"新增失败"
);
...
...
@@ -230,30 +269,36 @@ public class ServiceHPMT002 extends ServiceBase {
* @return
*/
public
EiInfo
pmModifyQuality
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
docId
=
MapUtils
.
getString
(
queryMap
,
"docId"
);
String
docId
=
inInfo
.
getString
(
"docId"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
inInfo
.
setMsg
(
"账号异常"
);
}
try
{
HPZL001
fZl001
=
new
HPZL001
();
fZl001
.
fromMap
(
queryMap
);
Map
attr
=
inInfo
.
getAttr
();
fZl001
.
fromMap
(
attr
);
// 去除日期字符串中的-
fZl001
.
setReceiptDate
(
StringUtil
.
removeHorizontalLine
(
fZl001
.
getReceiptDate
()));
fZl001
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
update
(
HPSqlConstant
.
HPZL001
.
DO_PROCESS2
,
fZl001
);
//绑定文件
if
(!
docId
.
equals
(
" "
))
{
if
(!
docId
.
equals
(
""
))
{
Map
fZl0012
=
new
HashMap
();
fZl0012
.
put
(
"checkNo"
,
fZl001
.
getCheckNo
());
List
<
HPZL001
>
HPZL001
=
dao
.
query
(
"HPZL001.query"
,
fZl0012
);
//绑定文件
String
[]
docIds
=
docId
.
split
(
","
);
int
num
=
0
;
while
(
num
<=
docIds
.
length
)
{
HPSC002A
HPSC002A
=
new
HPSC002A
();
HPSC002A
.
setBizType
(
CommonConstant
.
YesNo
.
NO_0
.
toString
());
HPSC002A
.
setDocId
(
docIds
[
num
]);
HPSC002A
.
setMatId
(
fZl001
.
getId
());
HPSC002A
.
setCompanyCode
(
companyCode
);
DaoUtils
.
insert
(
HPSC002A
.
INSERT
,
HPSC002A
);
while
(
num
<
docIds
.
length
)
{
HPZL001A
HPZL001A
=
new
HPZL001A
();
HPZL001A
.
setDeptCode
(
CommonConstant
.
YesNo
.
YES
);
HPZL001A
.
setDocType
(
CommonConstant
.
YesNo
.
YES_1
);
HPZL001A
.
setBizType
(
"XJ_CL"
);
HPZL001A
.
setDocId
(
docIds
[
num
]);
HPZL001A
.
setCheckId
(
HPZL001
.
get
(
0
).
getId
());
HPZL001A
.
setCompanyCode
(
companyCode
);
DaoUtils
.
insert
(
HPZL001A
.
INSERT
,
HPZL001A
);
num
++;
}
}
...
...
@@ -264,4 +309,30 @@ public class ServiceHPMT002 extends ServiceBase {
return
inInfo
;
}
/**
* 生产管理-文件上传
*
* @param inInfo
* @return
*/
public
EiInfo
pmUploadFile
(
EiInfo
inInfo
)
{
String
files
=
inInfo
.
getString
(
"files"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StrUtil
.
isEmpty
(
companyCode
))
{
inInfo
.
setMsg
(
"账号异常"
);
}
try
{
CommonsMultipartFile
multipartFile
=
Base64ToMultipartFile
.
base64toMultipartFile
(
files
);
JSONObject
upload
=
UploadUtils
.
upload
(
multipartFile
);
inInfo
.
set
(
"id"
,
upload
.
getString
(
"docId"
));
inInfo
.
setMsg
(
"上传成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"上传失败"
);
}
return
inInfo
;
}
}
src/main/java/com/baosight/hpjx/hp/mt/sql/HPMT002.xml
View file @
a8318a65
...
...
@@ -48,8 +48,16 @@
COUNT(POOR_TYPE) AS POOR_TYPE_NUM,
<!-- 单种不良品类数量 -->
CONCAT( FORMAT(COUNT(POOR_TYPE)/ (
SELECT COUNT(*) FROM hpjx.t_hpzl001 WHERE
COMPANY_CODE=#companyCode# )* 100,2),'%') AS NUM
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0
COMPANY_CODE=#companyCode# )* 100,2),'%') AS NUM,
ITEM_CNAME AS ITEM_CNAME
FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0
GROUP BY POOR_TYPE
</select>
...
...
@@ -65,11 +73,21 @@
INVENT_NAME as "inventName",
<!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode",
<!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName",
<!-- 零件名称 -->
FACTORY_CODE as "factoryCode",
<!-- 厂区编码 -->
FACTORY_NAME as "factoryName",
<!-- 厂区名称 -->
ORG_NO as "orgNo",
<!-- 生产组编码 -->
ORG_NAME as "orgName",
<!-- 生产组名称 -->
POOR_TYPE as "poorType",
<!-- 不良品类 -->
STATUS as "status"
<!-- 单据状态 0未处理 1已处理 -->
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0
STATUS as "status",
<!-- 单据状态 0未处理 1已处理 -->
B.ITEM_CNAME AS "itemCname"
FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0
</select>
<select
id=
"pmQualityDetail"
resultClass=
"java.util.HashMap"
>
...
...
@@ -84,15 +102,25 @@
INVENT_NAME as "inventName",
<!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode",
<!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName",
<!-- 零件名称 -->
FACTORY_CODE as "factoryCode",
<!-- 厂区编码 -->
FACTORY_NAME as "factoryName",
<!-- 厂区名称 -->
ORG_NO as "orgNo",
<!-- 生产组编码 -->
ORG_NAME as "orgName",
<!-- 生产组名称 -->
POOR_TYPE as "poorType",
<!-- 不良品类 -->
PROBLEM_DESC as "problemDesc",
<!-- 质量问题描述 -->
CHECK_USER as "checkUser",
<!-- 检查人 -->
CHECK_USER_NAME as "checkUserName",
<!-- 检查人名称 -->
STATUS as "status"
<!-- 单据状态 0未处理 1已处理 -->
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status#
AND DELETE_FLAG = 0 AND CHECK_NO = #checkNo#
STATUS as "status",
<!-- 单据状态 0未处理 1已处理 -->
B.ITEM_CNAME AS "itemCname"
FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode#
AND DELETE_FLAG = 0 AND ID = #id#
</select>
<insert
id=
"insert"
>
...
...
@@ -109,6 +137,8 @@
INVENT_NAME,
<!-- 部件名称 -->
SUB_INVENT_CODE,
<!-- 零件编码 -->
SUB_INVENT_NAME,
<!-- 零件名称 -->
FACTORY_CODE as "factoryCode",
<!-- 厂区编码 -->
FACTORY_NAME as "factoryName",
<!-- 厂区名称 -->
ORG_NO,
<!-- 生产组编码 -->
ORG_NAME,
<!-- 生产组名称 -->
POOR_TYPE,
<!-- 不良品类 -->
...
...
@@ -127,4 +157,9 @@
#createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert>
<select
id=
"queryFile"
resultClass=
"java.util.HashMap"
>
SELECT CHG_NAME FROM iplat.TEUDM02 where DOC_ID=#docId#
</select>
</sqlMap>
src/main/java/com/baosight/hpjx/hp/mt/untils/BASE64DecodedMultipartFile.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
hp
.
mt
.
untils
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
public
class
BASE64DecodedMultipartFile
implements
MultipartFile
{
private
final
byte
[]
imgContent
;
private
final
String
header
;
public
BASE64DecodedMultipartFile
(
byte
[]
imgContent
,
String
header
)
{
this
.
imgContent
=
imgContent
;
this
.
header
=
header
.
split
(
";"
)[
0
];
}
@Override
public
String
getName
()
{
return
System
.
currentTimeMillis
()
+
Math
.
random
()
+
"."
+
header
.
split
(
"/"
)[
1
];
}
@Override
public
String
getOriginalFilename
()
{
return
System
.
currentTimeMillis
()
+
(
int
)
Math
.
random
()
*
10000
+
"."
+
header
.
split
(
"/"
)[
1
];
}
@Override
public
String
getContentType
()
{
return
header
.
split
(
":"
)[
1
];
}
@Override
public
boolean
isEmpty
()
{
return
imgContent
==
null
||
imgContent
.
length
==
0
;
}
@Override
public
long
getSize
()
{
return
imgContent
.
length
;
}
@Override
public
byte
[]
getBytes
()
throws
IOException
{
return
imgContent
;
}
@Override
public
InputStream
getInputStream
()
throws
IOException
{
return
new
ByteArrayInputStream
(
imgContent
);
}
@Override
public
void
transferTo
(
File
dest
)
throws
IOException
,
IllegalStateException
{
new
FileOutputStream
(
dest
).
write
(
imgContent
);
}
}
src/main/java/com/baosight/hpjx/hp/mt/untils/Base64ToMultipartFile.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
hp
.
mt
.
untils
;
import
org.apache.commons.fileupload.disk.DiskFileItem
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.xerces.impl.dv.util.Base64
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
sun.misc.BASE64Decoder
;
import
java.io.*
;
public
class
Base64ToMultipartFile
implements
MultipartFile
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
Base64ToMultipartFile
.
class
);
private
final
byte
[]
imgContent
;
private
final
String
header
;
public
Base64ToMultipartFile
(
byte
[]
imgContent
,
String
header
)
{
this
.
imgContent
=
imgContent
;
this
.
header
=
header
.
split
(
";"
)[
0
];
}
@Override
public
String
getName
()
{
return
System
.
currentTimeMillis
()
+
Math
.
random
()
+
"."
+
header
.
split
(
"/"
)[
1
];
}
@Override
public
String
getOriginalFilename
()
{
return
System
.
currentTimeMillis
()
+
(
int
)
Math
.
random
()
*
10000
+
"."
+
header
.
split
(
"/"
)[
1
];
}
@Override
public
String
getContentType
()
{
return
header
.
split
(
":"
)[
1
];
}
@Override
public
boolean
isEmpty
()
{
return
imgContent
==
null
||
imgContent
.
length
==
0
;
}
@Override
public
long
getSize
()
{
return
imgContent
.
length
;
}
@Override
public
byte
[]
getBytes
()
throws
IOException
{
return
imgContent
;
}
@Override
public
InputStream
getInputStream
()
throws
IOException
{
ByteArrayInputStream
byteArrayInputStream
=
new
ByteArrayInputStream
(
imgContent
);
// 关闭流,不然文件会一直占用资源,无法对其操作
byteArrayInputStream
.
close
();
return
byteArrayInputStream
;
}
@Override
public
void
transferTo
(
File
dest
)
throws
IOException
,
IllegalStateException
{
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
dest
);
fileOutputStream
.
write
(
imgContent
);
// 关闭流,不然文件会一直占用资源,无法对其操作
fileOutputStream
.
close
();
}
/**
* base64转multipartFile
*
* @param
* @return
*/
public
static
MultipartFile
base64Convert
(
String
base64
)
{
String
[]
baseStrs
=
base64
.
split
(
","
);
BASE64Decoder
decoder
=
new
BASE64Decoder
();
byte
[]
b
=
new
byte
[
0
];
try
{
b
=
decoder
.
decodeBuffer
(
baseStrs
[
1
]);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
for
(
int
i
=
0
;
i
<
b
.
length
;
++
i
)
{
if
(
b
[
i
]
<
0
)
{
b
[
i
]
+=
256
;
}
}
return
new
Base64ToMultipartFile
(
b
,
baseStrs
[
0
]);
}
public
static
CommonsMultipartFile
base64toMultipartFile
(
String
base64filestr
){
final
File
file
=
base64ToFile
(
base64filestr
);
if
(
file
.
exists
()){
logger
.
info
(
"存在"
);
logger
.
info
(
"长度"
+
file
.
length
());
}
DiskFileItem
item
=
(
DiskFileItem
)
new
DiskFileItemFactory
().
createItem
(
file
.
getName
(),
"image/jpeg"
,
false
,
file
.
getName
());
InputStream
input
=
null
;
try
{
input
=
new
FileInputStream
(
file
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
OutputStream
os
=
null
;
try
{
os
=
item
.
getOutputStream
();
int
ret
=
input
.
read
();
while
(
ret
!=
-
1
)
{
os
.
write
(
ret
);
ret
=
input
.
read
();
}
os
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
new
CommonsMultipartFile
(
item
);
}
public
static
File
base64ToFile
(
String
base64
)
{
if
(
base64
==
null
||
""
.
equals
(
base64
))
{
return
null
;
}
//getRealImgeStr 方法 截取bese64字符串 逗号后半部分有用的字符串
byte
[]
buff
=
Base64
.
decode
(
getRealImgeStr
(
base64
));
File
file
=
null
;
FileOutputStream
fout
=
null
;
try
{
file
=
File
.
createTempFile
(
"tmp"
,
".jpg"
);
fout
=
new
FileOutputStream
(
file
);
fout
.
write
(
buff
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
fout
!=
null
)
{
try
{
fout
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
file
;
}
public
static
String
getRealImgeStr
(
String
imgStr
){
String
[]
str
=
imgStr
.
split
(
","
);
return
str
[
1
];
}
}
src/main/java/com/baosight/hpjx/hp/mt/untils/Base64Utils.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
hp
.
mt
.
untils
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Decoder
;
import
java.io.IOException
;
public
class
Base64Utils
{
public
static
MultipartFile
base64ToMultipartFile
(
String
s
)
{
MultipartFile
image
=
null
;
StringBuilder
base64
=
new
StringBuilder
(
""
);
if
(
s
!=
null
&&
!
""
.
equals
(
s
))
{
base64
.
append
(
s
);
String
[]
baseStrs
=
base64
.
toString
().
split
(
","
);
BASE64Decoder
decoder
=
new
BASE64Decoder
();
byte
[]
b
=
new
byte
[
0
];
try
{
b
=
decoder
.
decodeBuffer
(
baseStrs
[
1
]);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
for
(
int
j
=
0
;
j
<
b
.
length
;
++
j
)
{
if
(
b
[
j
]
<
0
)
{
b
[
j
]
+=
256
;
}
}
image
=
new
BASE64DecodedMultipartFile
(
b
,
baseStrs
[
0
]);
}
return
image
;
}
}
src/main/java/com/baosight/hpjx/hp/mt/untils/
uploadUntil
.java
→
src/main/java/com/baosight/hpjx/hp/mt/untils/
UploadUtils
.java
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
hp
.
mt
.
untils
;
import
com.baosight.iplat4j.core.data.ibatis.dao.Dao
;
import
com.baosight.iplat4j.core.data.id.UUIDHexIdGenerator
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
import
com.baosight.iplat4j.core.util.DateUtils
;
import
com.baosight.iplat4j.core.util.StringUtils
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.iplat4j.eu.dm.domain.EUDM02
;
import
com.baosight.iplat4j.eu.dm.util.FileProcessUtils
;
import
com.baosight.iplat4j.eu.dm.util.IFileUploader
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.codec.binary.Base64
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
uploadUntil
{
import
static
com
.
baosight
.
iplat4j
.
eu
.
dm
.
util
.
FileUploadConstant
.
VIRTUAL_ROOT
;
public
class
UploadUtils
{
public
static
String
ROOT_PATH
=
"C:/workspace/java/hp-smart/file"
;
private
static
String
DEFAULT_INVALID_SUFFIX
;
private
static
String
MODULE_NAME
=
"EP"
;
private
static
String
PROJECT_NAME
=
"HPJX"
;
private
static
String
VIRTUAL_ROOT
=
"HPJX_EP_$"
;
public
static
IFileUploader
fileUploader
;
public
static
String
upload
(
CommonsMultipartFile
multipartFile
)
throws
IOException
{
private
static
Dao
dao
=
(
Dao
)
PlatApplicationContext
.
getApplicationContext
().
getBean
(
"dao"
);
public
static
JSONObject
upload
(
CommonsMultipartFile
multipartFile
)
throws
IOException
{
JSONObject
documentJSON
=
new
JSONObject
();
String
filePath
;
String
msg
;
...
...
@@ -25,9 +43,9 @@ public class uploadUntil {
String
docPath
;
filePath
=
multipartFile
.
getOriginalFilename
();
Long
docSize
=
multipartFile
.
getSize
();
String
chgName
=
fileUploader
.
transformFileName
(
filePath
);
String
chgName
=
transformFileName
(
filePath
);
String
attachmentName
;
Map
<
String
,
String
>
pathMap
=
fileUploader
.
getRealPath
(
"A"
);
Map
<
String
,
String
>
pathMap
=
getRealPath
(
"A"
);
msg
=
(
String
)
pathMap
.
get
(
"dirId"
);
category
=
(
String
)
pathMap
.
get
(
"path"
);
checkInvalidPath
(
category
);
...
...
@@ -46,7 +64,7 @@ public class uploadUntil {
map
.
put
(
"docSize"
,
docSize
);
map
.
put
(
"recCreator"
,
""
);
map
.
put
(
"recCreateTime"
,
DateUtils
.
curDateTimeStr14
());
fileUploader
.
uploadDoc
(
map
);
uploadDoc
(
map
);
attachmentName
=
category
+
"/"
+
chgName
;
multipartFile
.
transferTo
(
new
File
(
attachmentName
));
documentJSON
.
put
(
"docId"
,
docPath
);
...
...
@@ -57,9 +75,56 @@ public class uploadUntil {
documentJSON
.
put
(
"docUrl"
,
attachmentName
);
documentJSON
.
put
(
"docSize"
,
docSize
);
documentJSON
.
put
(
"docName"
,
filePath
);
return
documentJSON
;
}
private
static
String
transformFileName
(
String
originalFileName
)
{
String
dateMselStr14
=
DateUtils
.
curDateTimeStr14
();
String
uuid8
=
FileProcessUtils
.
getShortUuid
();
String
chgFileName
=
dateMselStr14
+
"_"
+
uuid8
;
String
dot
=
"."
;
int
index
=
originalFileName
.
lastIndexOf
(
dot
);
String
fileName
;
if
(
index
>
0
)
{
String
suffix
=
originalFileName
.
substring
(
index
+
1
);
String
invalidSuffixConfig
=
PlatApplicationContext
.
getProperty
(
"iplat.upload.invalidSuffix"
);
if
(!
StringUtils
.
isNotEmpty
(
invalidSuffixConfig
))
{
invalidSuffixConfig
=
DEFAULT_INVALID_SUFFIX
;
}
String
[]
invalidSuffixs
=
invalidSuffixConfig
.
split
(
","
);
String
[]
var11
=
invalidSuffixs
;
int
var12
=
invalidSuffixs
.
length
;
for
(
int
var13
=
0
;
var13
<
var12
;
++
var13
)
{
String
invalidSuffix
=
var11
[
var13
];
if
(
suffix
.
equalsIgnoreCase
(
invalidSuffix
))
{
throw
new
PlatException
(
"文件扩展名不合法!"
);
}
}
fileName
=
chgFileName
+
dot
+
suffix
;
}
else
{
fileName
=
chgFileName
.
toString
();
}
return
fileName
;
}
public
static
Map
<
String
,
String
>
getRealPath
(
String
path
)
{
String
postPath
=
preparePath
(
path
);
String
dirId
=
initPath
(
postPath
);
postPath
=
ROOT_PATH
+
"/"
+
postPath
;
Map
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"path"
,
postPath
);
map
.
put
(
"dirId"
,
dirId
);
return
map
;
}
return
""
;
public
static
String
preparePath
(
String
path
)
{
return
path
;
}
public
static
void
checkInvalidPath
(
String
realPath
)
{
...
...
@@ -83,4 +148,91 @@ public class uploadUntil {
}
}
public
static
String
initPath
(
String
path
)
{
String
[]
dirs
=
path
.
split
(
"/"
);
String
parentId
=
VIRTUAL_ROOT
;
String
dirPath
=
VIRTUAL_ROOT
;
String
dirId
=
null
;
String
realPath
=
""
;
try
{
for
(
int
i
=
0
;
i
<
dirs
.
length
;
++
i
)
{
HashMap
<
String
,
String
>
pathMap
=
new
HashMap
();
pathMap
.
put
(
"parentId"
,
parentId
);
pathMap
.
put
(
"dirEname"
,
dirs
[
i
]);
pathMap
.
put
(
"moduleEname"
,
MODULE_NAME
);
pathMap
.
put
(
"projectEname"
,
PROJECT_NAME
);
List
pathList
=
dao
.
query
(
"EUDM01.queryPath"
,
pathMap
);
realPath
=
realPath
+
dirs
[
i
]
+
"/"
;
if
(
pathList
.
size
()
==
0
)
{
Map
<
String
,
String
>
dirRow
=
new
HashMap
();
String
userId
=
String
.
valueOf
(
UserSession
.
getUserId
());
String
dateTime
=
DateUtils
.
curDateTimeStr14
();
dirId
=
UUIDHexIdGenerator
.
generate
().
toString
();
dirPath
=
dirPath
+
"."
+
dirId
;
dirRow
.
put
(
"dirId"
,
dirId
);
dirRow
.
put
(
"dirEname"
,
dirs
[
i
]);
dirRow
.
put
(
"dirCname"
,
dirs
[
i
]);
dirRow
.
put
(
"parentId"
,
parentId
);
dirRow
.
put
(
"isLeaf"
,
i
==
dirs
.
length
-
1
?
"1"
:
"0"
);
dirRow
.
put
(
"dirPath"
,
dirPath
);
dirRow
.
put
(
"projectEname"
,
PROJECT_NAME
);
dirRow
.
put
(
"moduleEname"
,
MODULE_NAME
);
dirRow
.
put
(
"recCreator"
,
userId
);
dirRow
.
put
(
"recCreateTime"
,
dateTime
);
dirRow
.
put
(
"recRevisor"
,
" "
);
dirRow
.
put
(
"recReviseTime"
,
" "
);
dirRow
.
put
(
"archiveFlag"
,
" "
);
dirRow
.
put
(
"archiveFlag"
,
" "
);
dirRow
.
put
(
"realPath"
,
realPath
);
dao
.
insert
(
"EUDM01.insert"
,
dirRow
);
Map
<
String
,
String
>
dirMap
=
new
HashMap
();
dirMap
.
put
(
"dirId"
,
parentId
);
List
list
=
dao
.
query
(
"EUDM01.query"
,
dirMap
);
if
(
null
!=
list
&&
list
.
size
()
>
0
)
{
Map
<
String
,
String
>
item
=
(
Map
)
list
.
get
(
0
);
if
(
"1"
.
equals
(
item
.
get
(
"isLeaf"
)))
{
item
.
put
(
"isLeaf"
,
"0"
);
dao
.
update
(
"EUDM01.update"
,
list
.
get
(
0
));
}
}
parentId
=
dirId
;
}
else
{
Map
<
String
,
String
>
item
=
(
Map
)
pathList
.
get
(
0
);
parentId
=
(
String
)
item
.
get
(
"dirId"
);
dirId
=
(
String
)
item
.
get
(
"dirId"
);
dirPath
=
(
String
)
item
.
get
(
"dirPath"
);
}
}
return
dirId
;
}
catch
(
Exception
var16
)
{
throw
new
PlatException
(
"上传附件,创建目录: "
+
path
+
" 失败!"
,
var16
);
}
}
public
static
boolean
uploadDoc
(
Map
docMap
)
{
EUDM02
document
=
new
EUDM02
();
document
.
fromMap
(
docMap
);
try
{
dao
.
insert
(
"EUDM02.insert"
,
document
);
boolean
success
=
true
;
return
success
;
}
catch
(
Exception
var5
)
{
throw
new
PlatException
(
"保存附件 "
+
docMap
.
get
(
"docName"
)
+
" 失败!"
,
var5
);
}
}
public
static
String
imageToBase64
(
BufferedImage
bufferedImage
)
{
Base64
encoder
=
new
Base64
();
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
try
{
ImageIO
.
write
(
bufferedImage
,
"jpg"
,
baos
);
}
catch
(
IOException
e
)
{
}
return
new
String
(
encoder
.
encode
((
baos
.
toByteArray
())));
}
}
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ013.java
View file @
a8318a65
...
...
@@ -19,9 +19,12 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XLocalManager
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -162,6 +165,28 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz01301
.
setUserId
(
userId
);
fPz01301
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
insert
(
HPPZ013
.
INSERT
,
fPz01301
);
// 添加到组织机构
this
.
insertOrgMember
(
fPz01301
);
}
/**
* 用户关联组织
*
* @param fPz01301
*/
private
void
insertOrgMember
(
HPPZ01301
fPz01301
)
{
Map
inInfoRowMap
=
new
HashMap
();
inInfoRowMap
.
put
(
"loginName"
,
fPz01301
.
getUserId
());
inInfoRowMap
.
put
(
"userId"
,
fPz01301
.
getUserId
());
inInfoRowMap
.
put
(
"orgId"
,
fPz01301
.
getGroupCode
());
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addRow
(
inInfoRowMap
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"XSOG0801"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"insertUserByOrgId"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
throw
new
PlatException
(
outInfo
.
getMsg
());
}
}
/**
...
...
@@ -188,6 +213,8 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz013
.
fromMap
(
resultRow
);
fPz013
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
update
(
HPPZ013
.
DELETE
,
fPz013
);
// 从组织机构删除
this
.
deleteOrgMember
(
fPz013
);
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
...
...
@@ -198,4 +225,24 @@ public class ServiceHPPZ013 extends ServiceBase {
return
inInfo
;
}
/**
* 用户删除组织
*
* @param fPz013
*/
private
void
deleteOrgMember
(
HPPZ013
fPz013
)
{
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-parentOrgId"
,
fPz013
.
getGroupCode
());
inInfo
.
set
(
"result-0-userId"
,
fPz013
.
getUserId
());
inInfo
.
set
(
"result-0-loginName"
,
fPz013
.
getUserId
());
inInfo
.
set
(
"result-0-orgId"
,
fPz013
.
getGroupCode
());
inInfo
.
set
(
"result-0-orgEname"
,
fPz013
.
getGroupCode
());
// serviceName:XSOrgManage,methodName:deleteRelationBetweenUserAndOrg
inInfo
.
set
(
EiConstant
.
serviceName
,
"XSOG0801"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"deleteUserByOrgId"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
throw
new
PlatException
(
outInfo
.
getMsg
());
}
}
}
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ013.xml
View file @
a8318a65
...
...
@@ -26,12 +26,10 @@
<sql
id=
"condition"
>
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"depCode"
>
DEP_CODE = #depCode#
</isNotEmpty>
...
...
@@ -170,4 +168,21 @@
WHERE ID = #id#
</update>
<select
id=
"queryComboBox"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
SELECT DISTINCT
USER_ID as "userId",
USER_NAME as "userName"
FROM ${hpjxSchema}.T_HPPZ013 WHERE STATUS = 1 AND DELETE_FLAG = '0'
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"groupCode"
>
GROUP_CODE = #groupCode#
</isNotEmpty>
ORDER BY USER_ID
</select>
</sqlMap>
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ014.xml
View file @
a8318a65
...
...
@@ -25,12 +25,10 @@
<sql
id=
"condition"
>
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"depCode"
>
DEP_CODE = #depCode#
</isNotEmpty>
...
...
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
View file @
a8318a65
...
...
@@ -6,11 +6,7 @@ import com.baosight.hpjx.core.dao.DaoBase;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ004
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ007
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ009
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.hp.pz.domain.*
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.MapUtils
;
import
com.baosight.hpjx.util.ObjectUtils
;
...
...
@@ -534,6 +530,18 @@ public class HPPZTools {
}
}
public
static
class
HpPz013
{
public
static
HPPZ013
get
(
String
userId
)
{
AssertUtils
.
isNull
(
userId
,
"工人ID不能为空"
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"userId"
,
userId
);
List
<
HPPZ013
>
results
=
DaoBase
.
getInstance
().
query
(
HPPZ013
.
QUERY
,
queryMap
);
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"工人ID[%s]不存在"
,
userId
));
return
results
.
get
(
0
);
}
}
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
*
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003B.java
View file @
a8318a65
...
...
@@ -2,17 +2,22 @@ package com.baosight.hpjx.hp.sc.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.ProdOrderStatusEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.sc.domain.*
;
import
com.baosight.hpjx.hp.sc.tools.HPSCTools
;
import
com.baosight.hpjx.hp.xs.domain.Org
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.math.BigDecimal
;
...
...
@@ -86,7 +91,7 @@ public class ServiceHPSC003B extends ServiceBase {
Map
parmMap
=
new
HashMap
();
parmMap
.
put
(
"orgType"
,
"prodGroup"
);
parmMap
.
put
(
"parentOrgId"
,
factoryCode
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
GROUP_RECORD_BLOCK_ID
),
null
,
false
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
GROUP_RECORD_BLOCK_ID
),
parmMap
,
false
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
...
...
@@ -101,4 +106,56 @@ public class ServiceHPSC003B extends ServiceBase {
public
EiInfo
query
(
EiInfo
inInfo
)
{
return
inInfo
;
}
/**
* 创建任务
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"自动排产"
,
operType
=
"查询"
)
public
EiInfo
autoGenerateTask
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 写入数据
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPSC005
hpsc005
=
new
HPSC005
();
hpsc005
.
fromMap
(
resultRows
.
get
(
i
));
HPSC005
dbSc005
=
HPSCTools
.
HpSc005
.
get
(
hpsc005
.
getProdOrderNo
());
// 锁主单号
HPSCTools
.
HpSc005
.
lock
(
dbSc005
.
getProdOrderNo
());
// 校验主订单是否已分派
AssertUtils
.
isTrue
(
ProdOrderStatusEnum
.
ALL_ASSIGN
.
getCode
().
equals
(
dbSc005
.
getStatus
()),
String
.
format
(
"生产订单[%s]已全部分派,不能在进行批量分派,请检查!"
,
dbSc005
.
getProdOrderNo
()));
// 更新订单主表数量
if
(
ProdOrderStatusEnum
.
NOT_ASSIGN
.
getCode
().
equals
(
dbSc005
.
getStatus
()))
{
HPSCTools
.
checkAssignedNum
(
dbSc005
.
getProdOrderNo
(),
dbSc005
.
getNum
());
}
else
{
HPSCTools
.
checkAssignedNum2
(
dbSc005
.
getProdOrderNo
(),
dbSc005
.
getUnassignedNum
());
}
// 写入子表数据
HPSC005A
newSc005a
=
new
HPSC005A
();
newSc005a
.
setProdTaskNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
PROD_TASK_NO
,
new
String
[]{
dbSc005
.
getProdOrderNo
()}));
newSc005a
.
setProdOrderNo
(
dbSc005
.
getProdOrderNo
());
//区分未派单与部分派单
if
(
ProdOrderStatusEnum
.
NOT_ASSIGN
.
getCode
().
equals
(
dbSc005
.
getStatus
()))
{
newSc005a
.
setNum
(
dbSc005
.
getNum
());
}
else
{
newSc005a
.
setNum
(
dbSc005
.
getUnassignedNum
());
}
newSc005a
.
setTotalWt
(
newSc005a
.
getNum
().
multiply
(
dbSc005
.
getUnitWt
()));
newSc005a
.
setOrgNo
(
hpsc005
.
getOrgNo
());
newSc005a
.
setOrgName
(
hpsc005
.
getOrgName
());
newSc005a
.
setFactoryCode
(
hpsc005
.
getFactoryCode
());
newSc005a
.
setFactoryName
(
hpsc005
.
getFactoryName
());
DaoUtils
.
insert
(
HPSC005A
.
INSERT
,
newSc005a
);
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据进行智能分派!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"智能分派失败"
);
}
return
inInfo
;
}
}
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC005A.java
View file @
a8318a65
...
...
@@ -226,6 +226,9 @@ public class ServiceHPSC005A extends ServiceBase {
for
(
String
orderId
:
orderIds
)
{
// 校验主订单是否已分派
HPSC005
dbSc005
=
HPSCTools
.
HpSc005
.
getById
(
Long
.
parseLong
(
orderId
));
// 锁主单号
HPSCTools
.
HpSc005
.
lock
(
dbSc005
.
getProdOrderNo
());
AssertUtils
.
isTrue
(
ProdOrderStatusEnum
.
ALL_ASSIGN
.
getCode
().
equals
(
dbSc005
.
getStatus
()),
String
.
format
(
"生产订单[%s]已全部分派,不能在进行批量分派,请检查!"
,
dbSc005
.
getProdOrderNo
()));
// 更新订单主表数量
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC007.java
View file @
a8318a65
...
...
@@ -6,6 +6,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.sc.domain.HPSC004
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.hp.sc.domain.HPSC006
;
...
...
@@ -46,7 +47,10 @@ public class ServiceHPSC007 extends ServiceBase {
HPSC006
.
setPartName
(
HPSC005
.
getPartName
());
inInfo
.
addBlock
(
"detail"
).
addRow
(
HPSC006
);
inInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addBlockMeta
(
new
HPSC007
().
eiMetadata
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
USER_BLOCK_ID
),
null
,
false
);
Map
map
=
new
HashMap
();
map
.
put
(
"factoryCode"
,
HPSC006
.
getFactoryCode
());
map
.
put
(
"groupCode"
,
HPSC006
.
getOrgNo
());
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WORKER_BLOCK_ID
),
map
,
false
);
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"初始化失败"
);
}
...
...
@@ -112,8 +116,7 @@ public class ServiceHPSC007 extends ServiceBase {
BigDecimal
totalWt
=
new
BigDecimal
(
decimalFormat
.
format
(
num
.
multiply
(
unitWt
).
floatValue
()));
actualCompletionTotalWt
=
actualCompletionTotalWt
.
add
(
totalWt
);
HPSC007
.
setactualCompletionTotalWt
(
totalWt
);
Map
<
String
,
String
>
user
=
(
Map
<
String
,
String
>)
this
.
dao
.
get
(
"HPXSUser.queryComboBox"
,
"userId"
,
HPSC007
.
getUserId
());
HPSC007
.
setUserName
(
user
.
get
(
"userName"
));
HPSC007
.
setUserName
(
HPPZTools
.
HpPz013
.
get
(
HPSC007
.
getUserId
()).
getUserName
());
DaoUtils
.
insert
(
"HPSC007.insert"
,
HPSC007
);
}
// 修改下料表中的字段
...
...
@@ -178,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase {
BigDecimal
totalWt
=
new
BigDecimal
(
decimalFormat
.
format
(
Math
.
round
(
num
.
multiply
(
unitWt
).
floatValue
())));
actualCompletionTotalWt
=
actualCompletionTotalWt
.
add
(
new
BigDecimal
(
decimalFormat
.
format
(
Math
.
round
(
totalNum
.
multiply
(
unitWt
).
floatValue
()))));
HPSC007
.
setactualCompletionTotalWt
(
totalWt
);
HPSC007
.
setUserName
(
HPPZTools
.
HpPz013
.
get
(
HPSC007
.
getUserId
()).
getUserName
());
DaoUtils
.
insert
(
"HPSC007.update"
,
HPSC007
);
}
// 修改下料表中的字段
...
...
src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC005.xml
View file @
a8318a65
...
...
@@ -333,6 +333,40 @@
ORDER BY PROJ_CODE
</select>
<!-- 项目下拉框 -->
<select
id=
"queryProjComboBox2"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
SELECT DISTINCT
A.PROJ_CODE as "projCode",
A.PROJ_NAME as "projName",
A.PROD_ORDER_NO AS "prodOrderNo",
B.PROD_TASK_NO AS "prodTaskNo"
FROM ${hpjxSchema}.T_HPSC005 A LEFT JOIN ${hpjxSchema}.T_HPSC005A B ON A.COMPANY_CODE=B.COMPANY_CODE
AND A.PROD_ORDER_NO=B.PROD_ORDER_NO
WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projCode"
>
A.PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"status"
>
A.STATUS = #status#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"orgNo"
>
B.ORG_NO = #orgNo#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"parentPrdtCode"
>
A.PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"subInventCode"
>
A.PART_CODE = #subInventCode#
</isNotEmpty>
ORDER BY A.PROJ_CODE
</select>
<!-- 生产组下拉框 -->
<select
id=
"queryOrgComboBox"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
SELECT
...
...
src/main/java/com/baosight/hpjx/hp/xs/sql/HPXSOrg.xml
View file @
a8318a65
...
...
@@ -4,6 +4,7 @@
<sql
id=
"condition"
>
AND IS_DELETED = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty
prepend=
" AND "
property=
"orgEname"
>
ORG_ENAME = #orgEname#
</isNotEmpty>
...
...
@@ -19,9 +20,6 @@
<isNotEmpty
prepend=
" AND "
property=
"parentOrgId"
>
PARENT_ORG_ID = #parentOrgId#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<sql
id=
"customCondition"
>
...
...
@@ -165,7 +163,10 @@
ORG_CNAME
FROM iplat.TXSOG01 WHERE COMPANY_CODE=#companyCode#
) B ON A.PARENT_ORG_ID=B.ORG_ENAME
WHERE A.ORG_TYPE = 'cutGroup' AND A.COMPANY_CODE=#companyCode#
WHERE A.ORG_TYPE = 'prodGroup' AND A.COMPANY_CODE=#companyCode#
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
A.PARENT_ORG_ID=#factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryName"
>
B.ORG_CNAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty>
...
...
@@ -174,4 +175,15 @@
</isNotEmpty>
</select>
<!-- 查询组织信息 -->
<select
id=
"queryTedcm01"
resultClass=
"com.baosight.iplat4j.common.ed.domain.TEDCM01"
>
SELECT
ITEM_CODE AS "itemCode",
ITEM_CNAME AS "itemCname"
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
</select>
</sqlMap>
src/main/java/com/baosight/hpjx/hp/zl/domain/HPZL001.java
View file @
a8318a65
...
...
@@ -48,7 +48,9 @@ public class HPZL001 extends DaoEPBase {
public
static
final
String
FIELD_UPDATED_NAME
=
"updatedName"
;
/* 更新人名称*/
public
static
final
String
FIELD_UPDATED_TIME
=
"updatedTime"
;
/* 更新时间*/
public
static
final
String
FIELD_DELETE_FLAG
=
"deleteFlag"
;
/* 是否删除*/
public
static
final
String
FIELD_FACTORY_CODE
=
"factoryCode"
;
/* 厂区编码*/
public
static
final
String
FIELD_FACTORY_NAME
=
"factoryName"
;
/* 厂区名称*/
public
static
final
String
COL_ID
=
"ID"
;
public
static
final
String
COL_COMPANY_CODE
=
"COMPANY_CODE"
;
/* 企业编码 预留*/
public
static
final
String
COL_DEP_CODE
=
"DEP_CODE"
;
/* 部门编码*/
...
...
@@ -76,6 +78,8 @@ public class HPZL001 extends DaoEPBase {
public
static
final
String
COL_UPDATED_NAME
=
"UPDATED_NAME"
;
/* 更新人名称*/
public
static
final
String
COL_UPDATED_TIME
=
"UPDATED_TIME"
;
/* 更新时间*/
public
static
final
String
COL_DELETE_FLAG
=
"DELETE_FLAG"
;
/* 是否删除*/
public
static
final
String
COL_FACTORY_CODE
=
"FACTORY_CODE"
;
/* 厂区编码*/
public
static
final
String
COL_FACTORY_NAME
=
"FACTORY_NAME"
;
/* 厂区名称*/
public
static
final
String
QUERY
=
"HPZL001.query"
;
public
static
final
String
COUNT
=
"HPZL001.count"
;
...
...
@@ -110,6 +114,8 @@ public class HPZL001 extends DaoEPBase {
private
String
updatedName
=
" "
;
/* 更新人名称*/
private
String
updatedTime
=
" "
;
/* 更新时间*/
private
Integer
deleteFlag
;
/* 是否删除*/
private
String
factoryCode
=
" "
;
/* 厂区编码*/
private
String
factoryName
=
" "
;
/* 厂区名称*/
/**
* initialize the metadata.
...
...
@@ -225,6 +231,14 @@ public class HPZL001 extends DaoEPBase {
eiColumn
=
new
EiColumn
(
FIELD_DELETE_FLAG
);
eiColumn
.
setDescName
(
"是否删除"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_FACTORY_CODE
);
eiColumn
.
setDescName
(
"厂区编码"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_FACTORY_NAME
);
eiColumn
.
setDescName
(
"厂区名称"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
...
...
@@ -669,6 +683,38 @@ public class HPZL001 extends DaoEPBase {
this
.
deleteFlag
=
deleteFlag
;
}
/**
* get the factoryCode - 厂区编码.
* @return the factoryCode
*/
public
String
getFactoryCode
()
{
return
this
.
factoryCode
;
}
/**
* set the factoryCode - 厂区编码.
*
* @param factoryCode - 厂区编码
*/
public
void
setFactoryCode
(
String
factoryCode
)
{
this
.
factoryCode
=
factoryCode
;
}
/**
* get the factoryName - 厂区名称.
* @return the factoryName
*/
public
String
getFactoryName
()
{
return
this
.
factoryName
;
}
/**
* set the factoryName - 厂区名称.
*
* @param factoryName - 厂区名称
*/
public
void
setFactoryName
(
String
factoryName
)
{
this
.
factoryName
=
factoryName
;
}
/**
* get the value from Map.
*
* @param map - source data map
...
...
@@ -703,6 +749,8 @@ public class HPZL001 extends DaoEPBase {
setUpdatedName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_NAME
)),
updatedName
));
setUpdatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_TIME
)),
updatedTime
));
setDeleteFlag
(
NumberUtils
.
toInteger
(
StringUtils
.
toString
(
map
.
get
(
FIELD_DELETE_FLAG
)),
deleteFlag
));
setFactoryCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_FACTORY_CODE
)),
factoryCode
));
setFactoryName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_FACTORY_NAME
)),
factoryName
));
}
/**
...
...
@@ -739,7 +787,8 @@ public class HPZL001 extends DaoEPBase {
map
.
put
(
FIELD_UPDATED_NAME
,
StringUtils
.
toString
(
updatedName
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_NAME
)));
map
.
put
(
FIELD_UPDATED_TIME
,
StringUtils
.
toString
(
updatedTime
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_TIME
)));
map
.
put
(
FIELD_DELETE_FLAG
,
StringUtils
.
toString
(
deleteFlag
,
eiMetadata
.
getMeta
(
FIELD_DELETE_FLAG
)));
map
.
put
(
FIELD_FACTORY_CODE
,
StringUtils
.
toString
(
factoryCode
,
eiMetadata
.
getMeta
(
FIELD_FACTORY_CODE
)));
map
.
put
(
FIELD_FACTORY_NAME
,
StringUtils
.
toString
(
factoryName
,
eiMetadata
.
getMeta
(
FIELD_FACTORY_NAME
)));
return
map
;
}
}
src/main/java/com/baosight/hpjx/hp/zl/domain/HPZL001A.java
View file @
a8318a65
...
...
@@ -35,6 +35,7 @@ public class HPZL001A extends DaoEPBase {
public
static
final
String
FIELD_UPDATED_BY
=
"updatedBy"
;
/* 修改人*/
public
static
final
String
FIELD_UPDATED_NAME
=
"updatedName"
;
/* 修改人名称*/
public
static
final
String
FIELD_UPDATED_TIME
=
"updatedTime"
;
/* 修改时间*/
public
static
final
String
FIELD_BIZ_TYPE
=
"bizType"
;
/* 业务类型*/
public
static
final
String
COL_ID
=
"ID"
;
/* 主键ID*/
public
static
final
String
COL_COMPANY_CODE
=
"COMPANY_CODE"
;
/* 企业编码 预留*/
...
...
@@ -49,6 +50,7 @@ public class HPZL001A extends DaoEPBase {
public
static
final
String
COL_UPDATED_BY
=
"UPDATED_BY"
;
/* 修改人*/
public
static
final
String
COL_UPDATED_NAME
=
"UPDATED_NAME"
;
/* 修改人名称*/
public
static
final
String
COL_UPDATED_TIME
=
"UPDATED_TIME"
;
/* 修改时间*/
public
static
final
String
COL_BIZ_TYPE
=
"BIZ_TYPE"
;
/* 业务类型*/
public
static
final
String
QUERY
=
"HPZL001A.query"
;
public
static
final
String
COUNT
=
"HPZL001A.count"
;
...
...
@@ -69,6 +71,7 @@ public class HPZL001A extends DaoEPBase {
private
String
updatedBy
=
" "
;
/* 修改人*/
private
String
updatedName
=
" "
;
/* 修改人名称*/
private
String
updatedTime
=
" "
;
/* 修改时间*/
private
String
bizType
=
" "
;
/* 业务类型*/
/**
* initialize the metadata.
...
...
@@ -129,6 +132,10 @@ public class HPZL001A extends DaoEPBase {
eiColumn
.
setDescName
(
"修改时间"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_BIZ_TYPE
);
eiColumn
.
setDescName
(
"业务类型"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
...
...
@@ -348,6 +355,22 @@ public class HPZL001A extends DaoEPBase {
this
.
updatedTime
=
updatedTime
;
}
/**
* get the bizType - 业务类型.
* @return the bizType
*/
public
String
getBizType
()
{
return
this
.
bizType
;
}
/**
* set the bizType - 业务类型.
*
* @param bizType - 业务类型
*/
public
void
setBizType
(
String
bizType
)
{
this
.
bizType
=
bizType
;
}
/**
* get the value from Map.
*
* @param map - source data map
...
...
@@ -368,6 +391,7 @@ public class HPZL001A extends DaoEPBase {
setUpdatedBy
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_BY
)),
updatedBy
));
setUpdatedName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_NAME
)),
updatedName
));
setUpdatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_TIME
)),
updatedTime
));
setBizType
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_BIZ_TYPE
)),
bizType
));
}
/**
...
...
@@ -390,6 +414,7 @@ public class HPZL001A extends DaoEPBase {
map
.
put
(
FIELD_UPDATED_BY
,
StringUtils
.
toString
(
updatedBy
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_BY
)));
map
.
put
(
FIELD_UPDATED_NAME
,
StringUtils
.
toString
(
updatedName
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_NAME
)));
map
.
put
(
FIELD_UPDATED_TIME
,
StringUtils
.
toString
(
updatedTime
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_TIME
)));
map
.
put
(
FIELD_BIZ_TYPE
,
StringUtils
.
toString
(
bizType
,
eiMetadata
.
getMeta
(
FIELD_BIZ_TYPE
)));
return
map
;
}
...
...
src/main/java/com/baosight/hpjx/hp/zl/service/ServiceHPZL001B.java
View file @
a8318a65
...
...
@@ -128,6 +128,8 @@ public class ServiceHPZL001B extends ServiceEPBase {
newZl001
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
newZl001
.
setCheckUser
(
UserSession
.
getLoginName
());
newZl001
.
setCheckUserName
(
UserSession
.
getLoginCName
());
newZl001
.
setFactoryCode
(
dbSc005b
.
getFactoryCode
());
newZl001
.
setFactoryName
(
dbSc005b
.
getFactoryName
());
DaoUtils
.
insert
(
HPZL001
.
INSERT
,
newZl001
);
}
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/baosight/hpjx/hp/zl/sql/HPZL001.xml
View file @
a8318a65
...
...
@@ -12,6 +12,8 @@
PROD_TASK_NO as "prodTaskNo",
<!-- 生产任务号 -->
PROJ_CODE as "projCode",
<!-- 项目号 -->
PROJ_NAME as "projName",
<!-- 项目名称 -->
FACTORY_CODE as "factoryCode",
<!-- 厂区编码 -->
FACTORY_NAME as "factoryName",
<!-- 厂区名称 -->
INVENT_CODE as "inventCode",
<!-- 部件编码 -->
INVENT_NAME as "inventName",
<!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode",
<!-- 零件编码 -->
...
...
@@ -138,6 +140,8 @@
INVENT_NAME,
<!-- 部件名称 -->
SUB_INVENT_CODE,
<!-- 零件编码 -->
SUB_INVENT_NAME,
<!-- 零件名称 -->
FACTORY_CODE,
<!-- 厂区编码 -->
FACTORY_NAME,
<!-- 厂区名称 -->
ORG_NO,
<!-- 生产组编码 -->
ORG_NAME,
<!-- 生产组名称 -->
POOR_TYPE,
<!-- 不良品类 -->
...
...
@@ -151,7 +155,7 @@
DELETE_FLAG
<!-- 是否删除 -->
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #checkNo#, #prodOrderNo#, #prodTaskNo#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#factoryCode#,#factoryName#,
#orgNo#, #orgName#, #poorType#, #problemDesc#,#checkUser#,#checkUserName#, #status#,
#createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert>
...
...
src/main/java/com/baosight/hpjx/hp/zl/sql/HPZL001A.xml
View file @
a8318a65
...
...
@@ -15,7 +15,7 @@
A.CREATED_TIME as "createdTime",
<!-- 创建时间 -->
A.UPDATED_BY as "updatedBy",
<!-- 修改人 -->
A.UPDATED_NAME as "updatedName",
<!-- 修改人名称 -->
A.UPDATED_TIME as "updatedTime"
<!-- 修改时间 -->
A.UPDATED_TIME as "updatedTime"
<!-- 修改时间 -->
</sql>
<sql
id=
"condition"
>
...
...
src/main/java/com/baosight/hpjx/util/StringUtils.java
View file @
a8318a65
...
...
@@ -2,9 +2,12 @@ package com.baosight.hpjx.util;
import
com.alibaba.fastjson.JSONObject
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
org.springframework.util.AntPathMatcher
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
...
...
@@ -127,5 +130,65 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
paramsText
=
URLDecoder
.
decode
(
paramsText
,
"UTF-8"
);
return
JSONObject
.
parseObject
(
paramsText
).
getInnerMap
();
}
/**
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
*
* @param str 指定字符串
* @param strs 需要检查的字符串数组
* @return 是否匹配
*/
public
static
boolean
matches
(
String
str
,
List
<
String
>
strs
)
{
if
(
isEmpty
(
str
)
||
isEmpty
(
strs
))
{
return
false
;
}
for
(
String
pattern
:
strs
)
{
if
(
isMatch
(
pattern
,
str
))
{
return
true
;
}
}
return
false
;
}
/**
* 判断url是否与规则配置:
* ? 表示单个字符;
* * 表示一层路径内的任意字符串,不可跨层级;
* ** 表示任意层路径;
*
* @param pattern 匹配规则
* @param url 需要匹配的url
* @return
*/
public
static
boolean
isMatch
(
String
pattern
,
String
url
)
{
AntPathMatcher
matcher
=
new
AntPathMatcher
();
return
matcher
.
match
(
pattern
,
url
);
}
/**
* * 判断一个Collection是否为空, 包含List,Set,Queue
*
* @param coll 要判断的Collection
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Collection
<?>
coll
)
{
return
isNull
(
coll
)
||
coll
.
isEmpty
();
}
/**
* * 判断一个对象是否为空
*
* @param object Object
* @return true:为空 false:非空
*/
public
static
boolean
isNull
(
Object
object
)
{
return
object
==
null
;
}
}
src/main/java/com/baosight/hpjx/xss/HTMLFilter.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
xss
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.logging.Logger
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
*
* HTML filtering utility for protecting against XSS (Cross Site Scripting).
*
* This code is licensed LGPLv3
*
* This code is a Java port of the original work in PHP by Cal Hendersen.
* http://code.iamcal.com/php/lib_filter/
*
* The trickiest part of the translation was handling the differences in regex handling
* between PHP and Java. These resources were helpful in the process:
*
* http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
* http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php
* http://www.regular-expressions.info/modifiers.html
*
* A note on naming conventions: instance variables are prefixed with a "v"; global
* constants are in all caps.
*
* Sample use:
* String input = ...
* String clean = new HTMLFilter().filter( input );
*
* The class is not thread safe. Create a new instance if in doubt.
*
* If you find bugs or have suggestions on improvement (especially regarding
* performance), please contact us. The latest version of this
* source, and our contact details, can be found at http://xss-html-filter.sf.net
*
* @author Joseph O'Connell
* @author Cal Hendersen
* @author Michael Semb Wever
*/
public
class
HTMLFilter
{
/** regex flag union representing /si modifiers in php **/
private
static
final
int
REGEX_FLAGS_SI
=
Pattern
.
CASE_INSENSITIVE
|
Pattern
.
DOTALL
;
private
static
final
Pattern
P_COMMENTS
=
Pattern
.
compile
(
"<!--(.*?)-->"
,
Pattern
.
DOTALL
);
private
static
final
Pattern
P_COMMENT
=
Pattern
.
compile
(
"^!--(.*)--$"
,
REGEX_FLAGS_SI
);
private
static
final
Pattern
P_TAGS
=
Pattern
.
compile
(
"<(.*?)>"
,
Pattern
.
DOTALL
);
private
static
final
Pattern
P_END_TAG
=
Pattern
.
compile
(
"^/([a-z0-9]+)"
,
REGEX_FLAGS_SI
);
private
static
final
Pattern
P_START_TAG
=
Pattern
.
compile
(
"^([a-z0-9]+)(.*?)(/?)$"
,
REGEX_FLAGS_SI
);
private
static
final
Pattern
P_QUOTED_ATTRIBUTES
=
Pattern
.
compile
(
"([a-z0-9]+)=([\"'])(.*?)\\2"
,
REGEX_FLAGS_SI
);
private
static
final
Pattern
P_UNQUOTED_ATTRIBUTES
=
Pattern
.
compile
(
"([a-z0-9]+)(=)([^\"\\s']+)"
,
REGEX_FLAGS_SI
);
private
static
final
Pattern
P_PROTOCOL
=
Pattern
.
compile
(
"^([^:]+):"
,
REGEX_FLAGS_SI
);
private
static
final
Pattern
P_ENTITY
=
Pattern
.
compile
(
"&#(\\d+);?"
);
private
static
final
Pattern
P_ENTITY_UNICODE
=
Pattern
.
compile
(
"&#x([0-9a-f]+);?"
);
private
static
final
Pattern
P_ENCODE
=
Pattern
.
compile
(
"%([0-9a-f]{2});?"
);
private
static
final
Pattern
P_VALID_ENTITIES
=
Pattern
.
compile
(
"&([^&;]*)(?=(;|&|$))"
);
private
static
final
Pattern
P_VALID_QUOTES
=
Pattern
.
compile
(
"(>|^)([^<]+?)(<|$)"
,
Pattern
.
DOTALL
);
private
static
final
Pattern
P_END_ARROW
=
Pattern
.
compile
(
"^>"
);
private
static
final
Pattern
P_BODY_TO_END
=
Pattern
.
compile
(
"<([^>]*?)(?=<|$)"
);
private
static
final
Pattern
P_XML_CONTENT
=
Pattern
.
compile
(
"(^|>)([^<]*?)(?=>)"
);
private
static
final
Pattern
P_STRAY_LEFT_ARROW
=
Pattern
.
compile
(
"<([^>]*?)(?=<|$)"
);
private
static
final
Pattern
P_STRAY_RIGHT_ARROW
=
Pattern
.
compile
(
"(^|>)([^<]*?)(?=>)"
);
private
static
final
Pattern
P_AMP
=
Pattern
.
compile
(
"&"
);
private
static
final
Pattern
P_QUOTE
=
Pattern
.
compile
(
"\""
);
private
static
final
Pattern
P_LEFT_ARROW
=
Pattern
.
compile
(
"<"
);
private
static
final
Pattern
P_RIGHT_ARROW
=
Pattern
.
compile
(
">"
);
private
static
final
Pattern
P_BOTH_ARROWS
=
Pattern
.
compile
(
"<>"
);
private
static
final
Pattern
P_DOUBLE_QUOT
=
Pattern
.
compile
(
"""
);
// @xxx could grow large... maybe use sesat's ReferenceMap
private
static
final
ConcurrentMap
<
String
,
Pattern
>
P_REMOVE_PAIR_BLANKS
=
new
ConcurrentHashMap
<
String
,
Pattern
>();
private
static
final
ConcurrentMap
<
String
,
Pattern
>
P_REMOVE_SELF_BLANKS
=
new
ConcurrentHashMap
<
String
,
Pattern
>();
/** set of allowed html elements, along with allowed attributes for each element **/
private
final
Map
<
String
,
List
<
String
>>
vAllowed
;
/** counts of open tags for each (allowable) html element **/
private
final
Map
<
String
,
Integer
>
vTagCounts
=
new
HashMap
<
String
,
Integer
>();
/** html elements which must always be self-closing (e.g. "<img />") **/
private
final
String
[]
vSelfClosingTags
;
/** html elements which must always have separate opening and closing tags (e.g. "<b></b>") **/
private
final
String
[]
vNeedClosingTags
;
/** set of disallowed html elements **/
private
final
String
[]
vDisallowed
;
/** attributes which should be checked for valid protocols **/
private
final
String
[]
vProtocolAtts
;
/** allowed protocols **/
private
final
String
[]
vAllowedProtocols
;
/** tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />") **/
private
final
String
[]
vRemoveBlanks
;
/** entities allowed within html markup **/
private
final
String
[]
vAllowedEntities
;
/** flag determining whether comments are allowed in input String. */
private
final
boolean
stripComment
;
private
final
boolean
encodeQuotes
;
private
boolean
vDebug
=
false
;
/**
* flag determining whether to try to make tags when presented with "unbalanced"
* angle brackets (e.g. "<b text </b>" becomes "<b> text </b>"). If set to false,
* unbalanced angle brackets will be html escaped.
*/
private
final
boolean
alwaysMakeTags
;
/** Default constructor.
*
*/
public
HTMLFilter
()
{
vAllowed
=
new
HashMap
<>();
final
ArrayList
<
String
>
a_atts
=
new
ArrayList
<
String
>();
a_atts
.
add
(
"href"
);
a_atts
.
add
(
"target"
);
vAllowed
.
put
(
"a"
,
a_atts
);
final
ArrayList
<
String
>
img_atts
=
new
ArrayList
<
String
>();
img_atts
.
add
(
"src"
);
img_atts
.
add
(
"width"
);
img_atts
.
add
(
"height"
);
img_atts
.
add
(
"alt"
);
vAllowed
.
put
(
"img"
,
img_atts
);
final
ArrayList
<
String
>
no_atts
=
new
ArrayList
<
String
>();
vAllowed
.
put
(
"b"
,
no_atts
);
vAllowed
.
put
(
"strong"
,
no_atts
);
vAllowed
.
put
(
"i"
,
no_atts
);
vAllowed
.
put
(
"em"
,
no_atts
);
vSelfClosingTags
=
new
String
[]{
"img"
};
vNeedClosingTags
=
new
String
[]{
"a"
,
"b"
,
"strong"
,
"i"
,
"em"
};
vDisallowed
=
new
String
[]{};
vAllowedProtocols
=
new
String
[]{
"http"
,
"mailto"
,
"https"
};
// no ftp.
vProtocolAtts
=
new
String
[]{
"src"
,
"href"
};
vRemoveBlanks
=
new
String
[]{
"a"
,
"b"
,
"strong"
,
"i"
,
"em"
};
vAllowedEntities
=
new
String
[]{
"amp"
,
"gt"
,
"lt"
,
"quot"
};
stripComment
=
true
;
encodeQuotes
=
true
;
alwaysMakeTags
=
true
;
}
/** Set debug flag to true. Otherwise use default settings. See the default constructor.
*
* @param debug turn debug on with a true argument
*/
public
HTMLFilter
(
final
boolean
debug
)
{
this
();
vDebug
=
debug
;
}
/** Map-parameter configurable constructor.
*
* @param conf map containing configuration. keys match field names.
*/
public
HTMLFilter
(
final
Map
<
String
,
Object
>
conf
)
{
assert
conf
.
containsKey
(
"vAllowed"
)
:
"configuration requires vAllowed"
;
assert
conf
.
containsKey
(
"vSelfClosingTags"
)
:
"configuration requires vSelfClosingTags"
;
assert
conf
.
containsKey
(
"vNeedClosingTags"
)
:
"configuration requires vNeedClosingTags"
;
assert
conf
.
containsKey
(
"vDisallowed"
)
:
"configuration requires vDisallowed"
;
assert
conf
.
containsKey
(
"vAllowedProtocols"
)
:
"configuration requires vAllowedProtocols"
;
assert
conf
.
containsKey
(
"vProtocolAtts"
)
:
"configuration requires vProtocolAtts"
;
assert
conf
.
containsKey
(
"vRemoveBlanks"
)
:
"configuration requires vRemoveBlanks"
;
assert
conf
.
containsKey
(
"vAllowedEntities"
)
:
"configuration requires vAllowedEntities"
;
vAllowed
=
Collections
.
unmodifiableMap
((
HashMap
<
String
,
List
<
String
>>)
conf
.
get
(
"vAllowed"
));
vSelfClosingTags
=
(
String
[])
conf
.
get
(
"vSelfClosingTags"
);
vNeedClosingTags
=
(
String
[])
conf
.
get
(
"vNeedClosingTags"
);
vDisallowed
=
(
String
[])
conf
.
get
(
"vDisallowed"
);
vAllowedProtocols
=
(
String
[])
conf
.
get
(
"vAllowedProtocols"
);
vProtocolAtts
=
(
String
[])
conf
.
get
(
"vProtocolAtts"
);
vRemoveBlanks
=
(
String
[])
conf
.
get
(
"vRemoveBlanks"
);
vAllowedEntities
=
(
String
[])
conf
.
get
(
"vAllowedEntities"
);
stripComment
=
conf
.
containsKey
(
"stripComment"
)
?
(
Boolean
)
conf
.
get
(
"stripComment"
)
:
true
;
encodeQuotes
=
conf
.
containsKey
(
"encodeQuotes"
)
?
(
Boolean
)
conf
.
get
(
"encodeQuotes"
)
:
true
;
alwaysMakeTags
=
conf
.
containsKey
(
"alwaysMakeTags"
)
?
(
Boolean
)
conf
.
get
(
"alwaysMakeTags"
)
:
true
;
}
private
void
reset
()
{
vTagCounts
.
clear
();
}
private
void
debug
(
final
String
msg
)
{
if
(
vDebug
)
{
Logger
.
getAnonymousLogger
().
info
(
msg
);
}
}
//---------------------------------------------------------------
// my versions of some PHP library functions
public
static
String
chr
(
final
int
decimal
)
{
return
String
.
valueOf
((
char
)
decimal
);
}
public
static
String
htmlSpecialChars
(
final
String
s
)
{
String
result
=
s
;
result
=
regexReplace
(
P_AMP
,
"&"
,
result
);
result
=
regexReplace
(
P_QUOTE
,
"""
,
result
);
result
=
regexReplace
(
P_LEFT_ARROW
,
"<"
,
result
);
result
=
regexReplace
(
P_RIGHT_ARROW
,
">"
,
result
);
return
result
;
}
//---------------------------------------------------------------
/**
* given a user submitted input String, filter out any invalid or restricted
* html.
*
* @param input text (i.e. submitted by a user) than may contain html
* @return "clean" version of input, with only valid, whitelisted html elements allowed
*/
public
String
filter
(
final
String
input
)
{
reset
();
String
s
=
input
;
debug
(
"************************************************"
);
debug
(
" INPUT: "
+
input
);
s
=
escapeComments
(
s
);
debug
(
" escapeComments: "
+
s
);
// s = balanceHTML(s);
// debug(" balanceHTML: " + s);
//
// s = checkTags(s);
// debug(" checkTags: " + s);
//
// s = processRemoveBlanks(s);
// debug("processRemoveBlanks: " + s);
//
// s = validateEntities(s);
// debug(" validateEntites: " + s);
debug
(
"************************************************\n\n"
);
return
s
;
}
public
boolean
isAlwaysMakeTags
(){
return
alwaysMakeTags
;
}
public
boolean
isStripComments
(){
return
stripComment
;
}
private
String
escapeComments
(
final
String
s
)
{
final
Matcher
m
=
P_COMMENTS
.
matcher
(
s
);
final
StringBuffer
buf
=
new
StringBuffer
();
if
(
m
.
find
())
{
final
String
match
=
m
.
group
(
1
);
//(.*?)
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
"<!--"
+
htmlSpecialChars
(
match
)
+
"-->"
));
}
m
.
appendTail
(
buf
);
return
buf
.
toString
();
}
private
String
balanceHTML
(
String
s
)
{
if
(
alwaysMakeTags
)
{
//
// try and form html
//
s
=
regexReplace
(
P_END_ARROW
,
""
,
s
);
s
=
regexReplace
(
P_BODY_TO_END
,
"<$1>"
,
s
);
s
=
regexReplace
(
P_XML_CONTENT
,
"$1<$2"
,
s
);
}
else
{
//
// escape stray brackets
//
s
=
regexReplace
(
P_STRAY_LEFT_ARROW
,
"<$1"
,
s
);
s
=
regexReplace
(
P_STRAY_RIGHT_ARROW
,
"$1$2><"
,
s
);
//
// the last regexp causes '<>' entities to appear
// (we need to do a lookahead assertion so that the last bracket can
// be used in the next pass of the regexp)
//
s
=
regexReplace
(
P_BOTH_ARROWS
,
""
,
s
);
}
return
s
;
}
private
String
checkTags
(
String
s
)
{
Matcher
m
=
P_TAGS
.
matcher
(
s
);
final
StringBuffer
buf
=
new
StringBuffer
();
while
(
m
.
find
())
{
String
replaceStr
=
m
.
group
(
1
);
replaceStr
=
processTag
(
replaceStr
);
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
replaceStr
));
}
m
.
appendTail
(
buf
);
s
=
buf
.
toString
();
// these get tallied in processTag
// (remember to reset before subsequent calls to filter method)
for
(
String
key
:
vTagCounts
.
keySet
())
{
for
(
int
ii
=
0
;
ii
<
vTagCounts
.
get
(
key
);
ii
++)
{
s
+=
"</"
+
key
+
">"
;
}
}
return
s
;
}
private
String
processRemoveBlanks
(
final
String
s
)
{
String
result
=
s
;
for
(
String
tag
:
vRemoveBlanks
)
{
if
(!
P_REMOVE_PAIR_BLANKS
.
containsKey
(
tag
)){
P_REMOVE_PAIR_BLANKS
.
putIfAbsent
(
tag
,
Pattern
.
compile
(
"<"
+
tag
+
"(\\s[^>]*)?></"
+
tag
+
">"
));
}
result
=
regexReplace
(
P_REMOVE_PAIR_BLANKS
.
get
(
tag
),
""
,
result
);
if
(!
P_REMOVE_SELF_BLANKS
.
containsKey
(
tag
)){
P_REMOVE_SELF_BLANKS
.
putIfAbsent
(
tag
,
Pattern
.
compile
(
"<"
+
tag
+
"(\\s[^>]*)?/>"
));
}
result
=
regexReplace
(
P_REMOVE_SELF_BLANKS
.
get
(
tag
),
""
,
result
);
}
return
result
;
}
private
static
String
regexReplace
(
final
Pattern
regex_pattern
,
final
String
replacement
,
final
String
s
)
{
Matcher
m
=
regex_pattern
.
matcher
(
s
);
return
m
.
replaceAll
(
replacement
);
}
private
String
processTag
(
final
String
s
)
{
// ending tags
Matcher
m
=
P_END_TAG
.
matcher
(
s
);
if
(
m
.
find
())
{
final
String
name
=
m
.
group
(
1
).
toLowerCase
();
if
(
allowed
(
name
))
{
if
(!
inArray
(
name
,
vSelfClosingTags
))
{
if
(
vTagCounts
.
containsKey
(
name
))
{
vTagCounts
.
put
(
name
,
vTagCounts
.
get
(
name
)
-
1
);
return
"</"
+
name
+
">"
;
}
}
}
}
// starting tags
m
=
P_START_TAG
.
matcher
(
s
);
if
(
m
.
find
())
{
final
String
name
=
m
.
group
(
1
).
toLowerCase
();
final
String
body
=
m
.
group
(
2
);
String
ending
=
m
.
group
(
3
);
//debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" );
if
(
allowed
(
name
))
{
String
params
=
""
;
final
Matcher
m2
=
P_QUOTED_ATTRIBUTES
.
matcher
(
body
);
final
Matcher
m3
=
P_UNQUOTED_ATTRIBUTES
.
matcher
(
body
);
final
List
<
String
>
paramNames
=
new
ArrayList
<
String
>();
final
List
<
String
>
paramValues
=
new
ArrayList
<
String
>();
while
(
m2
.
find
())
{
paramNames
.
add
(
m2
.
group
(
1
));
//([a-z0-9]+)
paramValues
.
add
(
m2
.
group
(
3
));
//(.*?)
}
while
(
m3
.
find
())
{
paramNames
.
add
(
m3
.
group
(
1
));
//([a-z0-9]+)
paramValues
.
add
(
m3
.
group
(
3
));
//([^\"\\s']+)
}
String
paramName
,
paramValue
;
for
(
int
ii
=
0
;
ii
<
paramNames
.
size
();
ii
++)
{
paramName
=
paramNames
.
get
(
ii
).
toLowerCase
();
paramValue
=
paramValues
.
get
(
ii
);
// debug( "paramName='" + paramName + "'" );
// debug( "paramValue='" + paramValue + "'" );
// debug( "allowed? " + vAllowed.get( name ).contains( paramName ) );
if
(
allowedAttribute
(
name
,
paramName
))
{
if
(
inArray
(
paramName
,
vProtocolAtts
))
{
paramValue
=
processParamProtocol
(
paramValue
);
}
params
+=
" "
+
paramName
+
"=\""
+
paramValue
+
"\""
;
}
}
if
(
inArray
(
name
,
vSelfClosingTags
))
{
ending
=
" /"
;
}
if
(
inArray
(
name
,
vNeedClosingTags
))
{
ending
=
""
;
}
if
(
ending
==
null
||
ending
.
length
()
<
1
)
{
if
(
vTagCounts
.
containsKey
(
name
))
{
vTagCounts
.
put
(
name
,
vTagCounts
.
get
(
name
)
+
1
);
}
else
{
vTagCounts
.
put
(
name
,
1
);
}
}
else
{
ending
=
" /"
;
}
return
"<"
+
name
+
params
+
ending
+
">"
;
}
else
{
return
""
;
}
}
// comments
m
=
P_COMMENT
.
matcher
(
s
);
if
(!
stripComment
&&
m
.
find
())
{
return
"<"
+
m
.
group
()
+
">"
;
}
return
""
;
}
private
String
processParamProtocol
(
String
s
)
{
s
=
decodeEntities
(
s
);
final
Matcher
m
=
P_PROTOCOL
.
matcher
(
s
);
if
(
m
.
find
())
{
final
String
protocol
=
m
.
group
(
1
);
if
(!
inArray
(
protocol
,
vAllowedProtocols
))
{
// bad protocol, turn into local anchor link instead
s
=
"#"
+
s
.
substring
(
protocol
.
length
()
+
1
,
s
.
length
());
if
(
s
.
startsWith
(
"#//"
))
{
s
=
"#"
+
s
.
substring
(
3
,
s
.
length
());
}
}
}
return
s
;
}
private
String
decodeEntities
(
String
s
)
{
StringBuffer
buf
=
new
StringBuffer
();
Matcher
m
=
P_ENTITY
.
matcher
(
s
);
while
(
m
.
find
())
{
final
String
match
=
m
.
group
(
1
);
final
int
decimal
=
Integer
.
decode
(
match
).
intValue
();
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
chr
(
decimal
)));
}
m
.
appendTail
(
buf
);
s
=
buf
.
toString
();
buf
=
new
StringBuffer
();
m
=
P_ENTITY_UNICODE
.
matcher
(
s
);
while
(
m
.
find
())
{
final
String
match
=
m
.
group
(
1
);
final
int
decimal
=
Integer
.
valueOf
(
match
,
16
).
intValue
();
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
chr
(
decimal
)));
}
m
.
appendTail
(
buf
);
s
=
buf
.
toString
();
buf
=
new
StringBuffer
();
m
=
P_ENCODE
.
matcher
(
s
);
while
(
m
.
find
())
{
final
String
match
=
m
.
group
(
1
);
final
int
decimal
=
Integer
.
valueOf
(
match
,
16
).
intValue
();
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
chr
(
decimal
)));
}
m
.
appendTail
(
buf
);
s
=
buf
.
toString
();
s
=
validateEntities
(
s
);
return
s
;
}
private
String
validateEntities
(
final
String
s
)
{
StringBuffer
buf
=
new
StringBuffer
();
// validate entities throughout the string
Matcher
m
=
P_VALID_ENTITIES
.
matcher
(
s
);
while
(
m
.
find
())
{
final
String
one
=
m
.
group
(
1
);
//([^&;]*)
final
String
two
=
m
.
group
(
2
);
//(?=(;|&|$))
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
checkEntity
(
one
,
two
)));
}
m
.
appendTail
(
buf
);
return
encodeQuotes
(
buf
.
toString
());
}
private
String
encodeQuotes
(
final
String
s
){
if
(
encodeQuotes
){
StringBuffer
buf
=
new
StringBuffer
();
Matcher
m
=
P_VALID_QUOTES
.
matcher
(
s
);
while
(
m
.
find
())
{
final
String
one
=
m
.
group
(
1
);
//(>|^)
final
String
two
=
m
.
group
(
2
);
//([^<]+?)
final
String
three
=
m
.
group
(
3
);
//(<|$)
m
.
appendReplacement
(
buf
,
Matcher
.
quoteReplacement
(
one
+
regexReplace
(
P_QUOTE
,
"""
,
two
)
+
three
));
}
m
.
appendTail
(
buf
);
return
buf
.
toString
();
}
else
{
return
s
;
}
}
private
String
checkEntity
(
final
String
preamble
,
final
String
term
)
{
return
";"
.
equals
(
term
)
&&
isValidEntity
(
preamble
)
?
'&'
+
preamble
:
"&"
+
preamble
;
}
private
boolean
isValidEntity
(
final
String
entity
)
{
return
inArray
(
entity
,
vAllowedEntities
);
}
private
static
boolean
inArray
(
final
String
s
,
final
String
[]
array
)
{
for
(
String
item
:
array
)
{
if
(
item
!=
null
&&
item
.
equals
(
s
))
{
return
true
;
}
}
return
false
;
}
private
boolean
allowed
(
final
String
name
)
{
return
(
vAllowed
.
isEmpty
()
||
vAllowed
.
containsKey
(
name
))
&&
!
inArray
(
name
,
vDisallowed
);
}
private
boolean
allowedAttribute
(
final
String
name
,
final
String
paramName
)
{
return
allowed
(
name
)
&&
(
vAllowed
.
isEmpty
()
||
vAllowed
.
get
(
name
).
contains
(
paramName
));
}
}
src/main/java/com/baosight/hpjx/xss/XssFilter.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
xss
;
import
com.baosight.hpjx.util.StringUtils
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.FilterConfig
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
/**
* xss过滤
*/
public
class
XssFilter
implements
Filter
{
//不拦截的地址
private
List
<
String
>
excludedList
=
new
ArrayList
<
String
>();
@Override
public
void
init
(
FilterConfig
config
)
throws
ServletException
{
/*
* 这里只处理了需要拦截的url地址,如果想不拦截某个字段,比如富文本字段,
* 需要自己在XssHttpServletRequestWrapper类中去添加逻辑
*/
excludedList
.
add
(
"/service/HP*/*"
);
}
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
XssHttpServletRequestWrapper
xssRequest
=
new
XssHttpServletRequestWrapper
(
(
HttpServletRequest
)
request
);
String
url
=
xssRequest
.
getServletPath
();
if
(
isExcluded
(
url
)){
chain
.
doFilter
(
request
,
response
);
}
else
{
//使用XSS过滤
chain
.
doFilter
(
xssRequest
,
response
);
}
}
@Override
public
void
destroy
()
{
}
/**
* 是否不拦截
* @param url 请求地址
* @return true不拦截,false拦截
*/
private
boolean
isExcluded
(
String
url
){
// if(StringUtils.isBlank(url)){
// return false;
// }
if
(!
StringUtils
.
matches
(
url
,
excludedList
)){
return
true
;
}
// for (String excluded : excludedList) {
// if(!url.contains(excluded)){
// return true;
// }
// }
return
false
;
}
}
src/main/java/com/baosight/hpjx/xss/XssHttpServletRequestWrapper.java
0 → 100644
View file @
a8318a65
package
com
.
baosight
.
hpjx
.
xss
;
import
org.apache.commons.lang3.StringEscapeUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequestWrapper
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
javax.servlet.ReadListener
;
import
javax.servlet.ServletInputStream
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
public
class
XssHttpServletRequestWrapper
extends
HttpServletRequestWrapper
{
// 没被包装过的HttpServletRequest(特殊场景,需求自己过滤)
HttpServletRequest
orgRequest
;
// html过滤
private
final
static
HTMLFilter
htmlFilter
=
new
HTMLFilter
();
public
XssHttpServletRequestWrapper
(
HttpServletRequest
request
)
{
super
(
request
);
orgRequest
=
request
;
}
/**
* 过滤json参数
*/
@Override
public
ServletInputStream
getInputStream
()
throws
IOException
{
String
contentType
=
super
.
getHeader
(
HttpHeaders
.
CONTENT_TYPE
);
//非json类型,直接返回
if
(!(
MediaType
.
APPLICATION_JSON_VALUE
.
equalsIgnoreCase
(
contentType
)
||
MediaType
.
APPLICATION_JSON_UTF8_VALUE
.
equalsIgnoreCase
(
contentType
))){
return
super
.
getInputStream
();
}
//为空,直接返回
String
json
=
IOUtils
.
toString
(
super
.
getInputStream
(),
"utf-8"
);
if
(
StringUtils
.
isBlank
(
json
))
{
return
super
.
getInputStream
();
}
//xss过滤
json
=
xssEncode
(
json
);
json
=
StringEscapeUtils
.
unescapeHtml4
(
json
);
final
ByteArrayInputStream
bis
=
new
ByteArrayInputStream
(
json
.
getBytes
(
"utf-8"
));
return
new
ServletInputStream
()
{
@Override
public
boolean
isFinished
()
{
return
true
;
}
@Override
public
boolean
isReady
()
{
return
true
;
}
@Override
public
void
setReadListener
(
ReadListener
readListener
)
{
}
@Override
public
int
read
()
throws
IOException
{
return
bis
.
read
();
}
};
}
@Override
public
String
getParameter
(
String
name
)
{
String
value
=
super
.
getParameter
(
xssEncode
(
name
));
if
(
StringUtils
.
isNotBlank
(
value
))
{
value
=
xssEncode
(
value
);
}
return
StringEscapeUtils
.
unescapeHtml4
(
value
);
}
@Override
public
String
[]
getParameterValues
(
String
name
)
{
String
[]
parameters
=
super
.
getParameterValues
(
name
);
if
(
parameters
==
null
||
parameters
.
length
==
0
)
{
return
null
;
}
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
parameters
[
i
]
=
xssEncode
(
parameters
[
i
]);
parameters
[
i
]
=
StringEscapeUtils
.
unescapeHtml4
(
parameters
[
i
]);
}
return
parameters
;
}
@Override
public
Map
<
String
,
String
[]>
getParameterMap
()
{
Map
<
String
,
String
[]>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
String
[]>
parameters
=
super
.
getParameterMap
();
for
(
String
key
:
parameters
.
keySet
())
{
String
[]
values
=
parameters
.
get
(
key
);
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
values
[
i
]
=
xssEncode
(
values
[
i
]);
values
[
i
]
=
StringEscapeUtils
.
unescapeHtml4
(
values
[
i
]);
}
map
.
put
(
key
,
values
);
}
return
map
;
}
@Override
public
String
getHeader
(
String
name
)
{
String
value
=
super
.
getHeader
(
xssEncode
(
name
));
if
(
StringUtils
.
isNotBlank
(
value
))
{
value
=
xssEncode
(
value
);
}
return
StringEscapeUtils
.
unescapeHtml4
(
value
);
}
private
String
xssEncode
(
String
input
)
{
return
htmlFilter
.
filter
(
input
);
}
/**
* 获取最原始的request
*/
public
HttpServletRequest
getOrgRequest
()
{
return
orgRequest
;
}
/**
* 获取最原始的request
*/
public
static
HttpServletRequest
getOrgRequest
(
HttpServletRequest
request
)
{
if
(
request
instanceof
XssHttpServletRequestWrapper
)
{
return
((
XssHttpServletRequestWrapper
)
request
).
getOrgRequest
();
}
return
request
;
}
}
src/main/webapp/HP/SC/HPSC003.js
View file @
a8318a65
...
...
@@ -135,87 +135,87 @@ function showUploadFile(id) {
});
}
function
check
(
id
,
auditStatus
,
planInfoNo
)
{
const
inEiInfo
=
new
EiInfo
();
inEiInfo
.
set
(
"id"
,
id
);
inEiInfo
.
set
(
"planInfoNo"
,
planInfoNo
);
//先判断本身是否填写
EiCommunicator
.
send
(
'HPSC003'
,
'getInfo'
,
inEiInfo
,
{
onSuccess
(
ei
)
{
var
model
=
ei
.
get
(
"model"
);
if
(
!
(
model
.
planCompletionDate
).
trim
())
{
NotificationUtil
(
"提交失败!原因:基本信息中计划完成日期未填写"
,
"error"
);
return
;
}
else
{
//提交
//提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交
if
(
auditStatus
==
1
)
{
EiCommunicator
.
send
(
'HPSC004'
,
'inspectDetail'
,
inEiInfo
,
{
onSuccess
(
ei
)
{
var
list
=
ei
.
get
(
"list"
);
if
(
list
)
{
var
count
=
list
[
0
];
if
(
count
>
0
)
{
NotificationUtil
(
"提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间"
,
"error"
);
}
else
{
EiCommunicator
.
send
(
'HPSC004'
,
'queryDetail'
,
inEiInfo
,{
onSuccess
(
ei
){
var
rows
=
ei
.
blocks
.
detail
.
rows
;
var
res
=
check_time
(
model
,
rows
);
if
(
!
res
){
NotificationUtil
(
"计划结束时间应该大于计划开始时间!"
,
"error"
);
}
else
{
// 提交通过,生成
EiCommunicator
.
send
(
'HPSC003'
,
'submitPlan'
,
inEiInfo
,
{
onSuccess
(
response
)
{
NotificationUtil
(
response
.
msg
);
console
.
log
(
response
)
autoProductionschedul
(
response
.
get
(
'planInfoNo'
));
resultGrid
.
dataSource
.
page
(
1
);
},
onFail
(
errorMessage
,
status
,
e
)
{
NotificationUtil
(
"执行失败!"
,
"error"
);
}
},
{
async
:
false
}
);
}
// const inEiInfo = new EiInfo();
// inEiInfo.set("id", id);
// inEiInfo.set("planInfoNo",planInfoNo);
// //先判断本身是否填写
// EiCommunicator.send('HPSC003', 'getInfo', inEiInfo, {
// onSuccess(ei) {
// var model=ei.get("model");
// if(!(model.planCompletionDate).trim()) {
// NotificationUtil("提交失败!原因:基本信息中计划完成日期未填写", "error");
// return;
// } else {
// //提交
// //提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交
// if (auditStatus == 1) {
// EiCommunicator.send('HPSC004', 'inspectDetail', inEiInfo, {
// onSuccess(ei) {
// var list=ei.get("list");
// if(list) {
// var count = list[0];
// if (count > 0) {
// NotificationUtil("提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间", "error");
// } else {
// EiCommunicator.send('HPSC004','queryDetail',inEiInfo,{
// onSuccess(ei){
// var rows = ei.blocks.detail.rows;
// var res = check_time(model,rows);
// if (!res){
// NotificationUtil("计划结束时间应该大于计划开始时间!", "error");
// }
// else {
// // 提交通过,生成
// EiCommunicator.send('HPSC003', 'submitPlan', inEiInfo, {
// onSuccess(response) {
// NotificationUtil(response.msg);
// console.log(response)
// autoProductionschedul(response.get('planInfoNo'));
// resultGrid.dataSource.page(1);
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
// }
//
//
// }
// })
//
// }
// } else {
// NotificationUtil("提交失败!未找到明细信息", "error");
// }
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
// } else {
// // 撤回
//
// }
// }
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
}
})
}
}
else
{
NotificationUtil
(
"提交失败!未找到明细信息"
,
"error"
);
}
},
onFail
(
errorMessage
,
status
,
e
)
{
NotificationUtil
(
"执行失败!"
,
"error"
);
}
},
{
async
:
false
}
);
}
else
{
// 撤回
}
}
},
onFail
(
errorMessage
,
status
,
e
)
{
NotificationUtil
(
"执行失败!"
,
"error"
);
}
},
{
async
:
false
}
);
// autoProductionschedul('SCJH24030700006');
autoProductionschedul
(
'SCJH24030700006'
);
}
/**
...
...
@@ -228,7 +228,7 @@ let autoProductionschedul = function (planInfoNo) {
href
:
"HPSC003A?methodName=initLoad&inqu_status-0-planInfoNo="
+
planInfoNo
,
title
:
"<div style='text-align: center;'>自动排产</div>"
,
width
:
"30%"
,
height
:
"
8
0%"
,
height
:
"
4
0%"
,
callbackName
:
autoProductionschedulCallback
});
}
...
...
@@ -242,10 +242,12 @@ function autoProductionschedulCallback (factoryCode,planInfoNo) {
href
:
"HPSC003B?methodName=initLoad&inqu_status-0-planInfoNo="
+
planInfoNo
+
'&inqu_status-0-factoryCode='
+
factoryCode
,
title
:
"<div style='text-align: center;'>自动排产</div>"
,
// width: "80%",
// height: "80%",
width
:
"80%"
,
height
:
"80%"
,
dispaly
:
"flex"
,
callbackName
:
autoProductionschedulCallback1
});
$
(
"#JSColorboxWin"
).
css
({
"height"
:
"100%"
})
}
else
{
message
(
"生产计划单号不能为空!"
);
return
;
...
...
src/main/webapp/HP/SC/HPSC003.jsp
View file @
a8318a65
...
...
@@ -11,11 +11,11 @@
<
%
--
<
EF:EFInput
cname=
"项目编号"
blockId=
"inqu_status"
ename=
"projCode"
row=
"0"
colWidth=
"3"
/>
--%>
<EF:EFInput
cname=
"项目名称"
blockId=
"inqu_status"
ename=
"projName"
row=
"0"
colWidth=
"3"
/>
<EF:EFInput
cname=
"部件名称"
blockId=
"inqu_status"
ename=
"prdtName"
row=
"0"
colWidth=
"3"
/>
<EF:EFInput
cname=
"生产计划单号"
blockId=
"inqu_status"
ename=
"planInfoNo"
row=
"0"
colWidth=
"3"
/
>
<
%
--
<
EF:EFInput
cname=
"生产计划单号"
blockId=
"inqu_status"
ename=
"planInfoNo"
row=
"0"
colWidth=
"3"
/>
--%
>
<EF:EFDatePicker
cname=
"计划完成日期"
blockId=
"inqu_status"
ename=
"planCompletionDate"
row=
"0"
colWidth=
"3"
format=
"yyyy-MM-dd"
readonly=
"true"
/>
</div
>
<div
class=
"row"
>
<
%
--
</
div
>
--%
>
<
%
--
<
div
class=
"row"
>
--%
>
<EF:EFSelect
cname=
"状态"
blockId=
"inqu_status"
ename=
"status"
row=
"0"
colWidth=
"3"
optionLabel=
"全部"
>
<EF:EFOption
label=
"未提交"
value=
"0"
/>
<EF:EFOption
label=
"已提交"
value=
"1"
/>
...
...
@@ -28,7 +28,7 @@
<EF:EFColumn
ename=
"id"
cname=
"主键"
hidden=
"true"
/>
<EF:EFColumn
ename=
"operator"
cname=
"操作"
locked=
"true"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
enable=
"false"
ename=
"projCode"
cname=
"项目号"
readonly=
"true"
hidden=
"true"
/>
<EF:EFColumn
enable=
"false"
ename=
"planInfoNo"
cname=
"生产计划单号"
readonly=
"true"
width=
"100"
/>
<EF:EFColumn
enable=
"false"
ename=
"planInfoNo"
cname=
"生产计划单号"
readonly=
"true"
hidden=
"true"
width=
"100"
/>
<EF:EFColumn
enable=
"false"
ename=
"projName"
cname=
"项目名称"
width=
"120"
readonly=
"true"
/>
<EF:EFComboColumn
ename=
"prdtType"
cname=
"部件类型"
hidden =
'true'
width=
"90"
align=
"center"
enable=
"false"
>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
...
...
src/main/webapp/HP/SC/HPSC003B.js
View file @
a8318a65
$
(
function
()
{
IPLATUI
.
EFGrid
=
{
"result"
:
{
"result"
:
{
toolbarConfig
:
{
hidden
:
true
,
// true时,不显示功能按钮,但保留setting导出按钮
},
...
...
@@ -18,6 +18,53 @@ $(function () {
}
}
/**
* 取消
*/
$
(
'#cancel'
).
on
(
'click'
,
function
()
{
// 关闭弹窗
parent
.
JSColorbox
.
close
();
})
/**
* 确认
*/
$
(
'#confirm'
).
on
(
'click'
,
function
()
{
let
allRows
=
new
Array
();
allRows
=
resultGrid
.
getDataItems
();
console
.
log
(
allRows
);
if
(
allRows
.
length
>
0
)
{
const
inEiInfo
=
new
EiInfo
();
$
.
each
(
allRows
,
function
(
index
,
item
)
{
inEiInfo
.
set
(
"result-"
+
index
+
"-id"
,
item
[
"id"
])
inEiInfo
.
set
(
"result-"
+
index
+
"-prodOrderNo"
,
item
[
"prodOrderNo"
])
inEiInfo
.
set
(
"result-"
+
index
+
"-factoryName"
,
item
[
"factoryName"
])
inEiInfo
.
set
(
"result-"
+
index
+
"-factoryCode"
,
item
[
"factoryCode"
])
inEiInfo
.
set
(
"result-"
+
index
+
"-orgName"
,
item
[
"orgName"
])
inEiInfo
.
set
(
"result-"
+
index
+
"-orgNo"
,
item
[
"orgNo"
])
})
EiCommunicator
.
send
(
'HPSC003B'
,
'autoGenerateTask'
,
inEiInfo
,
{
onSuccess
(
response
)
{
NotificationUtil
(
response
.
msg
);
// 关闭弹窗
parent
.
JSColorbox
.
close
();
query
();
},
onFail
(
errorMessage
,
status
,
e
)
{
NotificationUtil
(
"执行失败!"
,
"error"
);
}
},
{
async
:
false
}
);
}
else
{
message
(
"没有可以生成的计划!"
);
return
;
}
})
});
...
...
@@ -25,14 +72,15 @@ $(function () {
* 查询
*/
function
query
()
{
resultGrid
.
dataSource
.
page
(
1
);
resultGrid
.
dataSource
.
page
(
1
);
}
function
deleteRow
(
rowNo
)
{
resultGrid
.
removeRows
([
rowNo
]);
// 刷新行号
refreshRowNo
();
}
let
refreshRowNo
=
function
()
{
let
refreshRowNo
=
function
()
{
let
allRows
=
resultGrid
.
getDataItems
();
for
(
let
i
=
0
;
i
<
allRows
.
length
;
i
++
)
{
resultGrid
.
setCellValue
(
i
,
"rowNo"
,
i
);
...
...
@@ -43,17 +91,4 @@ $(window).load(function () {
refreshRowNo
();
});
/**
* 取消
*/
$
(
'#cancel'
).
on
(
'click'
,
function
()
{
// 关闭弹窗
parent
.
JSColorbox
.
close
();
})
/**
* 确认
*/
$
(
'#confirm'
).
on
(
'click'
,
function
()
{
})
src/main/webapp/HP/SC/HPSC003B.jsp
View file @
a8318a65
...
...
@@ -10,8 +10,9 @@
<EF:EFRegion
id=
"result"
title=
"记录集"
>
<EF:EFGrid
blockId=
"result"
autoDraw=
"override"
>
<EF:EFColumn
ename=
"operator"
cname=
"操作"
locked=
"true"
enable=
"false"
width=
"80"
align=
"center"
/>
<EF:EFColumn
ename=
"id"
cname=
"主键"
hidden=
"true"
/>
<EF:EFColumn
ename=
"rowNo"
cname=
"行号"
hidden=
"true"
/>
<EF:EFColumn
ename=
"id"
cname=
"主键"
hidden=
"true"
/>
<EF:EFColumn
ename=
"prodOrderNo"
cname=
"生产订单号"
hidden=
"true"
/>
<EF:EFColumn
ename=
"projName"
cname=
"项目名称"
enable=
"false"
width=
"140"
align=
"center"
/>
<EF:EFColumn
ename=
"prdtName"
cname=
"部件名称"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"partName"
cname=
"零件名称"
enable=
"false"
width=
"100"
align=
"center"
/>
...
...
src/main/webapp/HP/SC/HPSC007.jsp
View file @
a8318a65
...
...
@@ -47,7 +47,7 @@
<EF:EFColumn
ename=
"hpsc006Id"
cname=
"生产下料ID"
hidden=
"true"
/>
<EF:EFComboColumn
ename=
"userId"
cname=
"完成人"
width=
"100"
align=
"center"
filter=
"contains"
readonly=
"true"
>
<EF:EFOptions
blockId=
"
us
er_block_id"
valueField=
"valueField"
textField=
"textField"
/>
<EF:EFOptions
blockId=
"
work
er_block_id"
valueField=
"valueField"
textField=
"textField"
/>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"userName"
cname=
"完成名称"
hidden=
"true"
/>
<EF:EFColumn
ename=
"actualCompletionNum"
cname=
"完成数量"
format=
"{0:N3}"
maxLength=
"12"
displayType=
"0.000"
...
...
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