Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BasicAPI
Project
Project
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
杜科
BasicAPI
Commits
e1ad43e1
Commit
e1ad43e1
authored
Jul 05, 2023
by
hanson.yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
2c5a919e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
2084 additions
and
608 deletions
+2084
-608
CatiaIntegration.properties
codebase/com/yonde/config/CatiaIntegration.properties
+1
-1
CADProSetting.json
codebase/com/yonde/config/cadpro/CADProSetting.json
+2
-2
CatiaTransfer.properties
codebase/com/yonde/config/cadpro/CatiaTransfer.properties
+3
-3
OfficeTransfer.properties
codebase/com/yonde/config/cadpro/OfficeTransfer.properties
+1
-1
DxCADBomVo.java
src/com/yonde/cadpro/bean/DxCADBomVo.java
+356
-0
DxModelFile.java
src/com/yonde/cadpro/bean/DxModelFile.java
+2
-2
CADController.java
src/com/yonde/cadpro/controller/CADController.java
+29
-0
PMIAnnotation.java
src/com/yonde/cadpro/pmi/PMIAnnotation.java
+60
-0
PMIAnnotationsRoot.java
src/com/yonde/cadpro/pmi/PMIAnnotationsRoot.java
+69
-0
PMICamera.java
src/com/yonde/cadpro/pmi/PMICamera.java
+74
-0
PMIRoot.java
src/com/yonde/cadpro/pmi/PMIRoot.java
+94
-0
PMIView.java
src/com/yonde/cadpro/pmi/PMIView.java
+83
-0
PMIViewSets.java
src/com/yonde/cadpro/pmi/PMIViewSets.java
+63
-0
CADProService.java
src/com/yonde/cadpro/service/CADProService.java
+12
-520
CadCheckService.java
src/com/yonde/cadpro/service/CadCheckService.java
+1
-1
ModelService.java
src/com/yonde/cadpro/service/ModelService.java
+114
-72
PartVisService.java
src/com/yonde/cadpro/service/PartVisService.java
+575
-0
WIPUtil.java
src/com/yonde/cadpro/util/WIPUtil.java
+299
-0
XMLMapper.java
src/com/yonde/cadpro/util/XMLMapper.java
+241
-0
ConvertCatia2B3dUtil.java
...onde/cadpro/visualization/catia/ConvertCatia2B3dUtil.java
+2
-4
VisualizationFacade.java
...onde/cadpro/visualization/facade/VisualizationFacade.java
+2
-2
VisualizationService.java
...nde/cadpro/visualization/facade/VisualizationService.java
+1
-0
No files found.
codebase/com/yonde/config/CatiaIntegration.properties
View file @
e1ad43e1
...
@@ -13,7 +13,7 @@ Absolute.Position.Type=DS
...
@@ -13,7 +13,7 @@ Absolute.Position.Type=DS
Absolute.Position.Default
=
1;0;0;0;0;1;0;0;0;0;1;0;0;0;0;1
Absolute.Position.Default
=
1;0;0;0;0;1;0;0;0;0;1;0;0;0;0;1
BOM.AllowPartType
=
\u
4E3B
\u
89C6
\u
56FE
\u9876\u
5C42
\u
4EF6,DCI,FCI,LO,DS
BOM.AllowPartType
=
\u
4E3B
\u
89C6
\u
56FE
\u9876\u
5C42
\u
4EF6,DCI,FCI,LO,DS
#For FTP Config
#For FTP Config
ftp.host
=
192.168.
1.240
ftp.host
=
192.168.
37.138
ftp.port
=
21
ftp.port
=
21
ftp.username
=
ftpuser
ftp.username
=
ftpuser
ftp.password
=
Aa12345678!
ftp.password
=
Aa12345678!
...
...
codebase/com/yonde/config/cadpro/CADProSetting.json
View file @
e1ad43e1
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
"type"
:
0
,
"type"
:
0
,
"sort"
:
1
,
"sort"
:
1
,
"code"
:
"77d6cf9e-6527-4f38-ae8e-87bd744e405d"
,
"code"
:
"77d6cf9e-6527-4f38-ae8e-87bd744e405d"
,
"ftpHost"
:
"192.168.
1.240
"
,
"ftpHost"
:
"192.168.
37.138
"
,
"ftpSetting"
:
{
"ftpSetting"
:
{
"host"
:
"192.168.
1.240
"
,
"host"
:
"192.168.
37.138
"
,
"port"
:
21
,
"port"
:
21
,
"userName"
:
"ftpuser"
,
"userName"
:
"ftpuser"
,
"password"
:
"Aa12345678!"
"password"
:
"Aa12345678!"
...
...
codebase/com/yonde/config/cadpro/CatiaTransfer.properties
View file @
e1ad43e1
#For Catia Transfer Web Service
#For Catia Transfer Web Service
Catia.Transfer.host
=
192.168.1.2
40
Catia.Transfer.host
=
192.168.1.2
35
Catia.Transfer.port
=
8081
Catia.Transfer.port
=
8081
Catia.Transfer.targetNameSpace
=
www.ptc.com/ws
Catia.Transfer.targetNameSpace
=
www.ptc.com/ws
Catia.Transfer.serviceName
=
ConvertModel2GlbService
Catia.Transfer.serviceName
=
ConvertModel2GlbService
#For B3d
#For B3d
Catia.Transfer.B3d.host
=
192.168.1.2
40
Catia.Transfer.B3d.host
=
192.168.1.2
35
Catia.Transfer.B3d.port
=
8081
Catia.Transfer.B3d.port
=
8081
Catia.Transfer.B3d.targetNameSpace
=
www.ptc.com/ws
Catia.Transfer.B3d.targetNameSpace
=
www.ptc.com/ws
Catia.Transfer.B3d.serviceName
=
ConvertModel2B3dService
Catia.Transfer.B3d.serviceName
=
ConvertModel2B3dService
#For FTP Config
#For FTP Config
Catia.ftp.host
=
192.168.1.2
40
Catia.ftp.host
=
192.168.1.2
35
Catia.ftp.port
=
21
Catia.ftp.port
=
21
Catia.ftp.username
=
ftpuser
Catia.ftp.username
=
ftpuser
Catia.ftp.password
=
Aa12345678!
Catia.ftp.password
=
Aa12345678!
...
...
codebase/com/yonde/config/cadpro/OfficeTransfer.properties
View file @
e1ad43e1
...
@@ -4,7 +4,7 @@ Office.Transfer.port=8082
...
@@ -4,7 +4,7 @@ Office.Transfer.port=8082
Office.Transfer.targetNameSpace
=
www.ptc.com/ws
Office.Transfer.targetNameSpace
=
www.ptc.com/ws
Office.Transfer.serviceName
=
ConvertOfficePDFService
Office.Transfer.serviceName
=
ConvertOfficePDFService
#For FTP Config
#For FTP Config
Office.ftp.host
=
192.168.
1.240
Office.ftp.host
=
192.168.
37.138
Office.ftp.port
=
21
Office.ftp.port
=
21
Office.ftp.username
=
ftpuser
Office.ftp.username
=
ftpuser
Office.ftp.password
=
Aa12345678!
Office.ftp.password
=
Aa12345678!
...
...
src/com/yonde/cadpro/bean/DxCADBomVo.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
bean
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.yonde.cadpro.util.ContentUtil
;
import
com.yonde.cadpro.util.EPMUtil
;
import
com.yonde.cadpro.util.WIPUtil
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
wt.content.ApplicationData
;
import
wt.content.ContentItem
;
import
wt.content.ContentRoleType
;
import
wt.epm.EPMDocument
;
import
wt.epm.EPMDocumentType
;
import
wt.epm.structure.EPMMemberLink
;
import
wt.org.WTPrincipal
;
import
wt.org.WTUser
;
import
wt.util.WTContext
;
import
wt.util.WTException
;
import
wt.vc.wip.CheckoutInfo
;
import
wt.vc.wip.WorkInProgressHelper
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 模型实体类
* @description:
**/
public
class
DxCADBomVo
implements
Serializable
{
@JsonIgnore
private
EPMDocument
cad
;
@JsonIgnore
private
EPMMemberLink
memberLink
;
private
String
cadId
;
private
String
memberLinkId
;
private
String
number
;
private
String
name
;
private
String
displayVersion
;
private
CADProUser
creator
;
private
CADProUser
modifier
;
private
boolean
checkOuted
;
/**
* 生命周期状态
*/
private
String
state
;
/**
* 检出者
*/
private
CADProUser
checkoutUser
;
/**
*
*/
private
String
checkoutStatus
;
/**
* 基于父装配的相对坐标
* 4x4 字符串表示
*/
private
String
transform
;
/**
* 模型可视化文件
*/
private
DxModelFile
visFile
;
private
boolean
hasPMI
=
false
;
/**
* 模型可视化文件
*/
private
DxModelFile
pmiFile
;
/**
* 子模型列表
*/
private
List
<
DxCADBomVo
>
children
=
new
ArrayList
<
DxCADBomVo
>();
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"Asia/Shanghai"
)
private
Date
modifyTime
;
public
EPMDocument
getCad
()
{
return
cad
;
}
public
void
setCad
(
EPMDocument
cad
)
{
this
.
cad
=
cad
;
}
public
EPMMemberLink
getMemberLink
()
{
return
memberLink
;
}
public
void
setMemberLink
(
EPMMemberLink
memberLink
)
{
this
.
memberLink
=
memberLink
;
}
public
String
getCadId
()
{
return
cadId
;
}
public
void
setCadId
(
String
cadId
)
{
this
.
cadId
=
cadId
;
}
public
String
getMemberLinkId
()
{
return
memberLinkId
;
}
public
void
setMemberLinkId
(
String
memberLinkId
)
{
this
.
memberLinkId
=
memberLinkId
;
}
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDisplayVersion
()
{
return
displayVersion
;
}
public
void
setDisplayVersion
(
String
displayVersion
)
{
this
.
displayVersion
=
displayVersion
;
}
public
CADProUser
getCreator
()
{
return
creator
;
}
public
void
setCreator
(
CADProUser
creator
)
{
this
.
creator
=
creator
;
}
public
CADProUser
getModifier
()
{
return
modifier
;
}
public
void
setModifier
(
CADProUser
modifier
)
{
this
.
modifier
=
modifier
;
}
public
boolean
isCheckOuted
()
{
return
checkOuted
;
}
public
void
setCheckOuted
(
boolean
checkOuted
)
{
this
.
checkOuted
=
checkOuted
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
CADProUser
getCheckoutUser
()
{
return
checkoutUser
;
}
public
void
setCheckoutUser
(
CADProUser
checkoutUser
)
{
this
.
checkoutUser
=
checkoutUser
;
}
public
String
getCheckoutStatus
()
{
return
checkoutStatus
;
}
public
void
setCheckoutStatus
(
String
checkoutStatus
)
{
this
.
checkoutStatus
=
checkoutStatus
;
}
public
String
getTransform
()
{
return
transform
;
}
public
void
setTransform
(
String
transform
)
{
this
.
transform
=
transform
;
}
public
DxModelFile
getVisFile
()
{
return
visFile
;
}
public
void
setVisFile
(
DxModelFile
visFile
)
{
this
.
visFile
=
visFile
;
}
public
boolean
isHasPMI
()
{
return
hasPMI
;
}
public
void
setHasPMI
(
boolean
hasPMI
)
{
this
.
hasPMI
=
hasPMI
;
}
public
DxModelFile
getPmiFile
()
{
return
pmiFile
;
}
public
void
setPmiFile
(
DxModelFile
pmiFile
)
{
this
.
pmiFile
=
pmiFile
;
}
public
List
<
DxCADBomVo
>
getChildren
()
{
if
(
children
==
null
)
{
children
=
new
ArrayList
<
DxCADBomVo
>();
}
return
children
;
}
public
Date
getModifyTime
()
{
return
modifyTime
;
}
public
void
setModifyTime
(
Date
modifyTime
)
{
this
.
modifyTime
=
modifyTime
;
}
public
List
<
DxCADBomVo
>
addChildren
(
DxCADBomVo
child
)
{
if
(
children
==
null
)
{
children
=
new
ArrayList
<
DxCADBomVo
>();
}
if
(
child
!=
null
)
{
children
.
add
(
child
);
}
return
children
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
public
static
DxCADBomVo
newDxCADBomVo
(
EPMDocument
epm
,
EPMMemberLink
memberLink
,
boolean
needVisFileUrl
)
throws
WTException
{
if
(
epm
==
null
)
{
return
null
;
}
String
oid
=
EPMUtil
.
getOROid
(
epm
);
String
memberLinkId
=
""
;
if
(
memberLink
!=
null
)
{
memberLinkId
=
EPMUtil
.
getOROid
(
memberLink
);
}
else
{
memberLinkId
=
"Root"
;
}
String
number
=
epm
.
getNumber
();
String
name
=
epm
.
getName
();
String
version
=
WIPUtil
.
getVersionDisplayWithOneOff
(
epm
);
Boolean
isCheckedOut
=
WorkInProgressHelper
.
isCheckedOut
(
epm
);
//Add for 检出状态、检出者
CheckoutInfo
checkInfo
=
epm
.
getCheckoutInfo
();
String
checkoutInfoState
=
checkInfo
==
null
?
""
:
checkInfo
.
getState
().
toString
();
WTPrincipal
checkoutUserWtp
=
WIPUtil
.
getCheckoutUser
(
epm
);
WTUser
checkOutor
=
null
;
if
(
checkoutUserWtp
!=
null
)
{
if
(
checkoutUserWtp
instanceof
WTUser
)
{
checkOutor
=
(
WTUser
)
checkoutUserWtp
;
}
}
String
state
=
epm
.
getLifeCycleState
().
getDisplay
(
WTContext
.
getContext
().
getLocale
());
DxCADBomVo
dxCADBomVo
=
new
DxCADBomVo
();
dxCADBomVo
.
setCad
(
epm
);
dxCADBomVo
.
setMemberLink
(
memberLink
);
if
(
needVisFileUrl
)
{
try
{
DxModelFile
visFile
=
DxModelFile
.
newVisFile
(
epm
);
System
.
out
.
println
(
"retrive visFile : "
+
visFile
);
dxCADBomVo
.
setVisFile
(
visFile
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"获取模型可视化信息失败"
+
e
);
}
try
{
DxModelFile
pmiFile
=
DxModelFile
.
newPmiFile
(
epm
);
//判断是否存在PMI
if
(
pmiFile
!=
null
)
{
dxCADBomVo
.
setHasPMI
(
true
);
}
System
.
out
.
println
(
"retrive pmiFile : "
+
pmiFile
);
dxCADBomVo
.
setPmiFile
(
pmiFile
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"获取模型PMI可视化信息失败"
+
e
);
}
}
dxCADBomVo
.
setCadId
(
oid
);
dxCADBomVo
.
setMemberLinkId
(
memberLinkId
);
dxCADBomVo
.
setName
(
name
);
dxCADBomVo
.
setNumber
(
number
);
dxCADBomVo
.
setDisplayVersion
(
version
);
dxCADBomVo
.
setState
(
state
);
dxCADBomVo
.
setCheckOuted
(
isCheckedOut
);
dxCADBomVo
.
setCheckoutStatus
(
checkoutInfoState
);
if
(
checkOutor
!=
null
)
{
dxCADBomVo
.
setCheckoutUser
(
CADProUser
.
toCADProUser
(
checkOutor
));
}
WTUser
creator
=
(
WTUser
)
epm
.
getCreator
().
getPrincipal
();
WTUser
modifier
=
(
WTUser
)
epm
.
getModifier
().
getPrincipal
();
dxCADBomVo
.
setCreator
(
CADProUser
.
toCADProUser
(
creator
));
dxCADBomVo
.
setModifier
(
CADProUser
.
toCADProUser
(
modifier
));
dxCADBomVo
.
setModifyTime
(
epm
.
getModifyTimestamp
());
return
dxCADBomVo
;
}
private
static
boolean
checkPMI
(
EPMDocument
epm
)
throws
Exception
{
if
(
epm
==
null
)
{
return
false
;
}
EPMDocumentType
epmComponentType
=
EPMDocumentType
.
toEPMDocumentType
(
"CADCOMPONENT"
);
if
(
epmComponentType
.
equals
(
epm
.
getDocType
()))
{
List
<
ContentItem
>
contentItems
=
ContentUtil
.
getContentsByRole
(
epm
,
new
ContentRoleType
[]
{
ContentRoleType
.
toContentRoleType
(
"CAD_HIDDEN_CONTENT"
)});
if
(
contentItems
!=
null
&&
contentItems
.
size
()
>
0
)
{
ContentItem
ci
=
contentItems
.
get
(
0
);
if
(
ci
instanceof
ApplicationData
)
{
return
true
;
}
}
}
return
false
;
}
}
src/com/yonde/cadpro/bean/DxModelFile.java
View file @
e1ad43e1
...
@@ -179,7 +179,7 @@ public class DxModelFile implements Serializable {
...
@@ -179,7 +179,7 @@ public class DxModelFile implements Serializable {
EPMDocumentType
epmComponentType
=
EPMDocumentType
.
toEPMDocumentType
(
"CADCOMPONENT"
);
EPMDocumentType
epmComponentType
=
EPMDocumentType
.
toEPMDocumentType
(
"CADCOMPONENT"
);
if
(
epmComponentType
.
equals
(
epm
.
getDocType
()))
{
if
(
epmComponentType
.
equals
(
epm
.
getDocType
()))
{
List
<
ContentItem
>
contentItems
=
ContentUtil
.
getContentsByRole
(
epm
,
List
<
ContentItem
>
contentItems
=
ContentUtil
.
getContentsByRole
(
epm
,
new
ContentRoleType
[]
{
ContentRoleType
.
toContentRoleType
(
"A
dditional_Files
"
)
});
new
ContentRoleType
[]
{
ContentRoleType
.
toContentRoleType
(
"A
DDITIONAL_FILES
"
)
});
if
(
contentItems
!=
null
&&
contentItems
.
size
()
>
0
)
{
if
(
contentItems
!=
null
&&
contentItems
.
size
()
>
0
)
{
ContentItem
ci
=
contentItems
.
get
(
0
);
ContentItem
ci
=
contentItems
.
get
(
0
);
if
(
ci
instanceof
ApplicationData
)
{
if
(
ci
instanceof
ApplicationData
)
{
...
@@ -216,7 +216,7 @@ public class DxModelFile implements Serializable {
...
@@ -216,7 +216,7 @@ public class DxModelFile implements Serializable {
EPMDocumentType
epmComponentType
=
EPMDocumentType
.
toEPMDocumentType
(
"CADCOMPONENT"
);
EPMDocumentType
epmComponentType
=
EPMDocumentType
.
toEPMDocumentType
(
"CADCOMPONENT"
);
if
(
epmComponentType
.
equals
(
epm
.
getDocType
()))
{
if
(
epmComponentType
.
equals
(
epm
.
getDocType
()))
{
List
<
ContentItem
>
contentItems
=
ContentUtil
.
getContentsByRole
(
epm
,
List
<
ContentItem
>
contentItems
=
ContentUtil
.
getContentsByRole
(
epm
,
new
ContentRoleType
[]
{
ContentRoleType
.
toContentRoleType
(
"CAD_
hidden_content
"
)
});
new
ContentRoleType
[]
{
ContentRoleType
.
toContentRoleType
(
"CAD_
HIDDEN_CONTENT
"
)
});
if
(
contentItems
!=
null
&&
contentItems
.
size
()
>
0
)
{
if
(
contentItems
!=
null
&&
contentItems
.
size
()
>
0
)
{
ContentItem
ci
=
contentItems
.
get
(
0
);
ContentItem
ci
=
contentItems
.
get
(
0
);
if
(
ci
instanceof
ApplicationData
)
{
if
(
ci
instanceof
ApplicationData
)
{
...
...
src/com/yonde/cadpro/controller/CADController.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yonde.basedata.entity.api.ApiResult
;
import
com.yonde.cadpro.service.PartVisService
;
import
com.yonde.cadpro.util.Base64Util
;
import
javax.servlet.http.HttpServletRequest
;
/**
* Created on 2023/6/28 0028
*
* @author
*/
@RestController
@RequestMapping
(
value
=
"/cad"
)
public
class
CADController
{
@SuppressWarnings
(
"rawtypes"
)
@RequestMapping
(
value
=
"/expandCADBom"
,
method
=
RequestMethod
.
GET
)
public
ApiResult
expandCADBom
(
@RequestParam
String
oid
,
HttpServletRequest
request
)
throws
Exception
{
String
userName
=
Base64Util
.
decodeForUserName
(
request
);
return
ApiResult
.
ok
(
PartVisService
.
expandCADBom
(
oid
,
userName
));
}
}
src/com/yonde/cadpro/pmi/PMIAnnotation.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
pmi
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"Annotation"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"id"
,
"name"
,
"type"
})
public
class
PMIAnnotation
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@XmlAttribute
private
String
id
;
@XmlElement
(
name
=
"name"
)
private
String
name
;
@XmlElement
(
name
=
"type"
)
private
String
type
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/pmi/PMIAnnotationsRoot.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
pmi
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"AnnotationsRoot"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"index"
,
"name"
,
"viewSets"
,
"annotations"
})
public
class
PMIAnnotationsRoot
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@XmlAttribute
private
String
index
;
@XmlAttribute
private
String
name
;
@XmlElement
(
name
=
"ViewSets"
)
private
PMIViewSets
viewSets
;
@XmlElementWrapper
(
name
=
"AnnotationSets"
)
@XmlElement
(
name
=
"Annotation"
)
@JsonProperty
(
value
=
"annotationSets"
)
private
List
<
PMIAnnotation
>
annotations
;
public
PMIAnnotationsRoot
()
{
}
public
String
getIndex
()
{
return
index
;
}
public
void
setIndex
(
String
index
)
{
this
.
index
=
index
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
PMIViewSets
getViewSets
()
{
return
viewSets
;
}
public
void
setViewSets
(
PMIViewSets
viewSets
)
{
this
.
viewSets
=
viewSets
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
\ No newline at end of file
src/com/yonde/cadpro/pmi/PMICamera.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
pmi
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"Camera"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"position"
,
"target"
,
"up"
,
"type"
})
public
class
PMICamera
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@XmlElement
(
name
=
"Position"
)
private
String
position
;
@XmlElement
(
name
=
"Target"
)
private
String
target
;
@XmlElement
(
name
=
"Up"
)
private
String
up
;
@XmlElement
(
name
=
"Type"
)
private
String
type
;
public
PMICamera
()
{
}
public
String
getPosition
()
{
return
position
;
}
public
void
setPosition
(
String
position
)
{
this
.
position
=
position
;
}
public
String
getTarget
()
{
return
target
;
}
public
void
setTarget
(
String
target
)
{
this
.
target
=
target
;
}
public
String
getUp
()
{
return
up
;
}
public
void
setUp
(
String
up
)
{
this
.
up
=
up
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/pmi/PMIRoot.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
pmi
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"PMIRoot"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"id"
,
"partId"
,
"partName"
,
"partNumber"
,
"tool"
,
"annotationsRoot"
})
public
class
PMIRoot
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@XmlAttribute
private
String
id
;
@XmlAttribute
private
String
partId
;
@XmlAttribute
private
String
partName
;
@XmlAttribute
private
String
partNumber
;
@XmlAttribute
private
String
tool
;
@XmlElement
(
name
=
"AnnotationsRoot"
)
private
List
<
PMIAnnotationsRoot
>
annotationsRoot
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getPartId
()
{
return
partId
;
}
public
void
setPartId
(
String
partId
)
{
this
.
partId
=
partId
;
}
public
String
getPartName
()
{
return
partName
;
}
public
void
setPartName
(
String
partName
)
{
this
.
partName
=
partName
;
}
public
String
getPartNumber
()
{
return
partNumber
;
}
public
void
setPartNumber
(
String
partNumber
)
{
this
.
partNumber
=
partNumber
;
}
public
String
getTool
()
{
return
tool
;
}
public
void
setTool
(
String
tool
)
{
this
.
tool
=
tool
;
}
public
List
<
PMIAnnotationsRoot
>
getAnnotationsRoot
()
{
return
annotationsRoot
;
}
public
void
setAnnotationsRoot
(
List
<
PMIAnnotationsRoot
>
annotationsRoot
)
{
this
.
annotationsRoot
=
annotationsRoot
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/pmi/PMIView.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
pmi
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"View"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"id"
,
"name"
,
"camera"
,
"pmiIds"
,
"modelIds"
})
public
class
PMIView
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@XmlAttribute
private
String
id
;
@XmlAttribute
private
String
name
;
@XmlElement
(
name
=
"Camera"
)
private
PMICamera
camera
;
@XmlElement
(
name
=
"PMIIds"
)
private
String
pmiIds
;
@XmlElement
(
name
=
"ModelIds"
)
private
String
modelIds
;
public
PMIView
()
{
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
PMICamera
getCamera
()
{
return
camera
;
}
public
void
setCamera
(
PMICamera
camera
)
{
this
.
camera
=
camera
;
}
public
String
getPmiIds
()
{
return
pmiIds
;
}
public
void
setPmiIds
(
String
pmiIds
)
{
this
.
pmiIds
=
pmiIds
;
}
public
String
getModelIds
()
{
return
modelIds
;
}
public
void
setModelIds
(
String
modelIds
)
{
this
.
modelIds
=
modelIds
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/pmi/PMIViewSets.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
pmi
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"ViewSets"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"index"
,
"name"
,
"view"
})
public
class
PMIViewSets
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@XmlAttribute
private
String
index
;
@XmlAttribute
private
String
name
;
@XmlElement
(
name
=
"View"
)
private
List
<
PMIView
>
view
;
public
PMIViewSets
()
{
}
public
String
getIndex
()
{
return
index
;
}
public
void
setIndex
(
String
index
)
{
this
.
index
=
index
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
List
<
PMIView
>
getView
()
{
return
view
;
}
public
void
setView
(
List
<
PMIView
>
view
)
{
this
.
view
=
view
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/service/CADProService.java
View file @
e1ad43e1
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/service/CadCheckService.java
View file @
e1ad43e1
...
@@ -643,7 +643,7 @@ public class CadCheckService implements RemoteAccess {
...
@@ -643,7 +643,7 @@ public class CadCheckService implements RemoteAccess {
if
(!
isIngoreUpdate
)
{
if
(!
isIngoreUpdate
)
{
//处理EPM
//处理EPM
System
.
out
.
println
(
"开始处理数模..."
);
System
.
out
.
println
(
"开始处理数模..."
);
System
.
out
.
println
(
" 数模主内容>>>>
"
);
System
.
out
.
println
(
" 数模主内容>>>>
modelFileUri:"
+
modelFileUri
+
" modelFileName:"
+
modelFileName
);
if
(
StringUtils
.
isNotBlank
(
modelFileUri
))
{
if
(
StringUtils
.
isNotBlank
(
modelFileUri
))
{
//处理EPM主内容
//处理EPM主内容
String
primaryFilePath
=
ModelService
.
transferModelFilePathFromZIPByCopy
(
modelFileUri
,
modelFileName
);
String
primaryFilePath
=
ModelService
.
transferModelFilePathFromZIPByCopy
(
modelFileUri
,
modelFileName
);
...
...
src/com/yonde/cadpro/service/ModelService.java
View file @
e1ad43e1
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/service/PartVisService.java
0 → 100644
View file @
e1ad43e1
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/util/WIPUtil.java
0 → 100644
View file @
e1ad43e1
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/util/XMLMapper.java
0 → 100644
View file @
e1ad43e1
package
com
.
yonde
.
cadpro
.
util
;
import
org.apache.commons.lang.StringUtils
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.io.OutputFormat
;
import
org.dom4j.io.XMLWriter
;
import
wt.util.WTException
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.JAXBException
;
import
javax.xml.bind.Marshaller
;
import
javax.xml.bind.Unmarshaller
;
import
javax.xml.bind.annotation.XmlAnyElement
;
import
java.io.*
;
import
java.nio.charset.Charset
;
import
java.util.Collection
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
public
class
XMLMapper
{
public
static
String
XML_HEADER
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"
;
private
static
ConcurrentMap
<
Class
,
JAXBContext
>
jaxbContexts
=
new
ConcurrentHashMap
<
Class
,
JAXBContext
>();
/**
* 创建Marshaller并设定encoding(可为null).
* 线程不安全,需要每次创建或pooling。
*/
public
static
Marshaller
createMarshaller
(
Class
clazz
,
String
encoding
)
{
try
{
JAXBContext
jaxbContext
=
getJaxbContext
(
clazz
);
Marshaller
marshaller
=
jaxbContext
.
createMarshaller
();
marshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
Boolean
.
TRUE
);
if
(
StringUtils
.
isNotBlank
(
encoding
))
{
marshaller
.
setProperty
(
Marshaller
.
JAXB_ENCODING
,
encoding
);
}
marshaller
.
setProperty
(
Marshaller
.
JAXB_FRAGMENT
,
Boolean
.
TRUE
);
return
marshaller
;
}
catch
(
JAXBException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 创建UnMarshaller.
* 线程不安全,需要每次创建或pooling。
*/
public
static
Unmarshaller
createUnmarshaller
(
Class
clazz
)
{
try
{
JAXBContext
jaxbContext
=
getJaxbContext
(
clazz
);
return
jaxbContext
.
createUnmarshaller
();
}
catch
(
JAXBException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* Java Object->Xml with encoding.
*/
public
static
String
toXml
(
Object
root
,
Class
clazz
,
String
encoding
)
{
try
{
StringWriter
writer
=
new
StringWriter
();
createMarshaller
(
clazz
,
encoding
).
marshal
(
root
,
writer
);
return
writer
.
toString
();
}
catch
(
JAXBException
e
)
{
e
.
printStackTrace
();
}
return
""
;
}
public
static
File
toXmlFile
(
Object
root
,
Class
clazz
,
String
encoding
,
String
filePath
)
throws
Exception
{
File
file
=
null
;
FileWriter
fWriter
=
null
;
BufferedWriter
bWriter
=
null
;
try
{
String
xmlStr
=
toXml
(
root
,
clazz
,
encoding
);
if
(
StringUtils
.
isNotBlank
(
xmlStr
))
{
if
(!
xmlStr
.
startsWith
(
XML_HEADER
))
{
xmlStr
=
XML_HEADER
+
xmlStr
;
}
file
=
new
File
(
filePath
);
fWriter
=
new
FileWriter
(
file
);
bWriter
=
new
BufferedWriter
(
fWriter
);
bWriter
.
write
(
xmlStr
);
bWriter
.
flush
();
}
}
finally
{
if
(
fWriter
!=
null
)
{
fWriter
.
close
();
}
if
(
bWriter
!=
null
)
{
bWriter
.
close
();
}
}
if
(
file
==
null
||
!
file
.
exists
())
{
throw
new
WTException
(
"生成XML文件异常!"
);
}
return
file
;
}
/**
* Xml->Java Object.
*/
public
static
<
T
>
T
fromXml
(
String
xml
,
Class
<
T
>
clazz
)
{
try
{
StringReader
reader
=
new
StringReader
(
xml
);
return
(
T
)
createUnmarshaller
(
clazz
).
unmarshal
(
reader
);
}
catch
(
JAXBException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/*
protected static JAXBContext getJaxbContext(Class clazz) {
try {
return JAXBContext.newInstance(clazz, clazz);
} catch (JAXBException e) {
e.printStackTrace();
}
return null;
}*/
protected
static
JAXBContext
getJaxbContext
(
Class
clazz
)
{
JAXBContext
jaxbContext
=
jaxbContexts
.
get
(
clazz
);
if
(
jaxbContext
==
null
)
{
try
{
jaxbContext
=
JAXBContext
.
newInstance
(
clazz
,
CollectionWrapper
.
class
);
if
(
jaxbContext
==
null
){
jaxbContext
=
JAXBContext
.
newInstance
(
clazz
);
}
jaxbContexts
.
putIfAbsent
(
clazz
,
jaxbContext
);
}
catch
(
JAXBException
ex
)
{
ex
.
printStackTrace
();
}
}
return
jaxbContext
;
}
/**
* 封装Root Element 是 Collection的情况.
*/
public
static
class
CollectionWrapper
{
@XmlAnyElement
protected
Collection
<?>
collection
;
}
public
static
File
createXmlFile
(
String
xmlString
,
String
xmlPath
,
String
encoding
)
throws
IOException
,
DocumentException
,
WTException
{
org
.
dom4j
.
Document
document
=
DocumentHelper
.
parseText
(
xmlString
);
//OutputFormat xmlFormat = OutputFormat.createPrettyPrint();
OutputFormat
xmlFormat
=
new
OutputFormat
();
xmlFormat
.
setIndentSize
(
2
);
xmlFormat
.
setNewlines
(
false
);
xmlFormat
.
setTrimText
(
false
);
xmlFormat
.
setPadText
(
true
);
xmlFormat
.
setEncoding
(
encoding
);
FileOutputStream
out
=
null
;
XMLWriter
writer
=
null
;
try
{
out
=
new
FileOutputStream
(
new
File
(
xmlPath
));
writer
=
new
XMLWriter
(
out
,
xmlFormat
);
writer
.
write
(
document
);
writer
.
flush
();
out
.
flush
();
File
file
=
new
File
(
xmlPath
);
if
(
file
.
exists
()){
return
file
;
}
throw
new
WTException
(
"生成数据包xml文件失败"
);
}
finally
{
if
(
out
!=
null
){
out
.
close
();
}
if
(
writer
!=
null
){
writer
.
close
();
}
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
xmlToBean
(
String
xml
,
Class
<
T
>
clazz
)
throws
WTException
,
IOException
{
try
{
JAXBContext
context
=
JAXBContext
.
newInstance
(
clazz
);
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
return
(
T
)
unmarshaller
.
unmarshal
(
new
StringReader
(
xml
));
}
catch
(
JAXBException
e
)
{
throw
new
WTException
(
e
);
}
finally
{
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
xmlToBean
(
File
file
,
Class
<
T
>
clazz
)
throws
WTException
,
IOException
{
try
{
JAXBContext
context
=
JAXBContext
.
newInstance
(
clazz
);
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
return
(
T
)
unmarshaller
.
unmarshal
(
file
);
}
catch
(
JAXBException
e
)
{
throw
new
WTException
(
e
);
}
finally
{
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
xmlToBean
(
InputStream
instream
,
Class
<
T
>
clazz
)
throws
WTException
,
IOException
{
try
{
JAXBContext
context
=
JAXBContext
.
newInstance
(
clazz
);
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
InputStreamReader
isReader
=
new
InputStreamReader
(
instream
);
return
(
T
)
unmarshaller
.
unmarshal
(
isReader
);
}
catch
(
JAXBException
e
)
{
throw
new
WTException
(
e
);
}
finally
{
instream
.
close
();
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
xmlToBean
(
InputStream
instream
,
Class
<
T
>
clazz
,
Charset
charset
)
throws
WTException
,
IOException
{
try
{
JAXBContext
context
=
JAXBContext
.
newInstance
(
clazz
);
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
InputStreamReader
isReader
=
new
InputStreamReader
(
instream
,
charset
);
return
(
T
)
unmarshaller
.
unmarshal
(
isReader
);
}
catch
(
JAXBException
e
)
{
throw
new
WTException
(
e
);
}
finally
{
instream
.
close
();
}
}
}
src/com/yonde/cadpro/visualization/catia/ConvertCatia2B3dUtil.java
View file @
e1ad43e1
...
@@ -39,10 +39,8 @@ public class ConvertCatia2B3dUtil {
...
@@ -39,10 +39,8 @@ public class ConvertCatia2B3dUtil {
HOST
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_HOST
);
HOST
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_HOST
);
PORT
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_PORT
);
PORT
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_PORT
);
TARGETNAMESPACE
=
catiaTransferConfig
TARGETNAMESPACE
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_TARGETNAMESPACE
);
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_TARGETNAMESPACE
);
SERVICENAME
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_SERVICENAME
);
SERVICENAME
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_SERVICENAME
);
logger
.
debug
(
HOST
);
logger
.
debug
(
HOST
);
logger
.
debug
(
PORT
);
logger
.
debug
(
PORT
);
...
...
src/com/yonde/cadpro/visualization/facade/VisualizationFacade.java
View file @
e1ad43e1
...
@@ -32,8 +32,8 @@ public class VisualizationFacade implements RemoteAccess, Serializable {
...
@@ -32,8 +32,8 @@ public class VisualizationFacade implements RemoteAccess, Serializable {
private
static
Logger
logger
=
Logger
.
getLogger
(
VisualizationFacade
.
class
);
private
static
Logger
logger
=
Logger
.
getLogger
(
VisualizationFacade
.
class
);
p
rivate
static
ExtProperties
officeTransferConfig
=
null
;
p
ublic
static
ExtProperties
officeTransferConfig
=
null
;
p
rivate
static
ExtProperties
catiaTransferConfig
=
null
;
p
ublic
static
ExtProperties
catiaTransferConfig
=
null
;
private
static
VisualizationService
visualizationService
=
null
;
private
static
VisualizationService
visualizationService
=
null
;
static
{
static
{
...
...
src/com/yonde/cadpro/visualization/facade/VisualizationService.java
View file @
e1ad43e1
...
@@ -159,6 +159,7 @@ public class VisualizationService {
...
@@ -159,6 +159,7 @@ public class VisualizationService {
remoteFilePath
=
remoteFilePath
.
replace
(
"\\"
,
"/"
);
remoteFilePath
=
remoteFilePath
.
replace
(
"\\"
,
"/"
);
System
.
out
.
println
(
"remoteFilePath :"
+
remoteFilePath
);
System
.
out
.
println
(
"remoteFilePath :"
+
remoteFilePath
);
//此处的文件路径为worker机catia.zip的路径
//3. 调用转可视化服务
//3. 调用转可视化服务
WsResult
wsResult
=
null
;
WsResult
wsResult
=
null
;
if
(
contentHolder
instanceof
EPMDocument
)
{
if
(
contentHolder
instanceof
EPMDocument
)
{
...
...
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