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
83f34268
Commit
83f34268
authored
Dec 16, 2022
by
hanson.yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert wtPart
parent
710712f8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
988 additions
and
5 deletions
+988
-5
PartUtil.java
src/com/yonde/common/PartUtil.java
+355
-0
DxPartController.java
src/com/yonde/part/controller/DxPartController.java
+21
-0
PartController.java
src/com/yonde/part/controller/PartController.java
+0
-4
ConvertStrategy.java
src/com/yonde/part/convert/ConvertStrategy.java
+14
-0
DxConvertFactory.java
src/com/yonde/part/convert/DxConvertFactory.java
+21
-0
DxDocumentConvert.java
src/com/yonde/part/convert/DxDocumentConvert.java
+16
-0
DxPartConvert.java
src/com/yonde/part/convert/DxPartConvert.java
+48
-0
DxTypeEnum.java
src/com/yonde/part/convert/DxTypeEnum.java
+26
-0
PartService.java
src/com/yonde/part/service/PartService.java
+2
-1
PartServiceImpl.java
src/com/yonde/part/service/impl/PartServiceImpl.java
+20
-0
DxPart.java
src/com/yonde/part/vo/DxPart.java
+465
-0
No files found.
src/com/yonde/common/PartUtil.java
0 → 100644
View file @
83f34268
This diff is collapsed.
Click to expand it.
src/com/yonde/part/controller/DxPartController.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
controller
;
import
com.yonde.part.service.PartService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
value
=
"/part"
)
public
class
DxPartController
{
@Autowired
PartService
partService
;
@GetMapping
(
value
=
"/search"
)
public
Object
getPartByNumber
(
@RequestParam
String
number
)
throws
Exception
{
return
partService
.
getPartByNumber
(
number
);
}
}
src/com/yonde/part/controller/PartController.java
deleted
100644 → 0
View file @
710712f8
package
com
.
yonde
.
part
.
controller
;
public
class
PartController
{
}
src/com/yonde/part/convert/ConvertStrategy.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
convert
;
import
wt.fc.Persistable
;
import
wt.util.WTException
;
/**
* Created on 2022/12/14
*
* @author
*/
public
interface
ConvertStrategy
{
Object
convert
(
Persistable
persistable
)
throws
WTException
;
}
src/com/yonde/part/convert/DxConvertFactory.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
convert
;
import
org.apache.log4j.Logger
;
import
wt.fc.Persistable
;
import
wt.log4j.LogR
;
/**
* Created on 2022/12/14
*
* @author
*/
public
class
DxConvertFactory
{
private
static
Logger
logger
=
LogR
.
getLogger
(
DxConvertFactory
.
class
.
getName
());
public
static
Object
convertFactory
(
DxTypeEnum
dxTypeEnum
,
Persistable
persistable
)
throws
Exception
{
ConvertStrategy
strategy
=
(
ConvertStrategy
)
Class
.
forName
(
dxTypeEnum
.
getClassName
()).
newInstance
();
return
strategy
.
convert
(
persistable
);
}
}
src/com/yonde/part/convert/DxDocumentConvert.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
convert
;
import
wt.fc.Persistable
;
/**
* Created on 2022/12/15
*
* @author
*/
public
class
DxDocumentConvert
implements
ConvertStrategy
{
@Override
public
Object
convert
(
Persistable
persistable
)
{
System
.
out
.
println
(
"DxDocumentConvert start ...."
);
return
null
;
}
}
src/com/yonde/part/convert/DxPartConvert.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
convert
;
import
com.ptc.core.meta.common.TypeIdentifier
;
import
com.yonde.common.PartUtil
;
import
com.yonde.part.vo.DxPart
;
import
wt.fc.ObjectReference
;
import
wt.fc.Persistable
;
import
wt.fc.ReferenceFactory
;
import
wt.part.WTPart
;
import
wt.util.WTException
;
import
java.util.Locale
;
/**
* Created on 2022/12/14
*
* @author
*/
public
class
DxPartConvert
implements
ConvertStrategy
{
@Override
public
Object
convert
(
Persistable
persistable
)
throws
WTException
{
System
.
out
.
println
(
"DxPartConvert start ...."
);
DxPart
dxPart
=
null
;
if
(
persistable
instanceof
WTPart
)
{
dxPart
=
new
DxPart
();
WTPart
wtPart
=
(
WTPart
)
persistable
;
dxPart
.
setAuthKeys
(
""
);
dxPart
.
setId
(
PartUtil
.
getWTObjectOid
(
wtPart
));
TypeIdentifier
typeIdentifier
=
PartUtil
.
getWTObjectSubType
(
wtPart
);
dxPart
.
setSubTypeName
(
typeIdentifier
.
getTypename
());
dxPart
.
setOperator
(
""
);
dxPart
.
setDefaultUnit
(
wtPart
.
getDefaultUnit
().
getDisplay
(
Locale
.
CHINESE
));
dxPart
.
setName
(
wtPart
.
getName
());
dxPart
.
setNumber
(
wtPart
.
getNumber
());
dxPart
.
setMasterId
(
new
ReferenceFactory
().
getReferenceString
(
ObjectReference
.
newObjectReference
((
wtPart
.
getMaster
().
getPersistInfo
().
getObjectIdentifier
()))));
//dxPart.setSubTypeDisplayName(wtPart.getDisplayIdentity().getDisplayType().getLocalizedMessage(Locale.CHINESE));
dxPart
.
setState
(
wtPart
.
getState
().
getState
().
getDisplay
(
Locale
.
CHINA
));
//WTUser create = (WTUser)(wtPart.getCreator().getObject());
//String creator = String.format("%s(%s)", create.getFullName(), create.getName());
//WTUser modify = (WTUser)(wtPart.getModifier().getObject());
//String modifier = String.format("%s(%s)", modify.getFullName(), modify.getName());
//dxPart.setCreator(creator);
//dxPart.setModifier(modifier);
}
return
dxPart
;
}
}
src/com/yonde/part/convert/DxTypeEnum.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
convert
;
/**
* Created on 2022/12/14
*
* @author
*/
public
enum
DxTypeEnum
{
WTDOCUMENT
(
"com.yonde.part.convert.DxDocConvert"
),
WTPART
(
"com.yonde.part.convert.DxPartConvert"
);
DxTypeEnum
(
String
className
)
{
this
.
setClassName
(
className
);
}
private
String
className
;
public
String
getClassName
()
{
return
className
;
}
public
void
setClassName
(
String
className
)
{
this
.
className
=
className
;
}
}
src/com/yonde/part/service/PartService.java
View file @
83f34268
package
com
.
yonde
.
part
.
service
;
package
com
.
yonde
.
part
.
service
;
public
class
PartService
{
public
interface
PartService
{
Object
getPartByNumber
(
String
number
)
throws
Exception
;
}
}
src/com/yonde/part/service/impl/PartServiceImpl.java
0 → 100644
View file @
83f34268
package
com
.
yonde
.
part
.
service
.
impl
;
import
com.yonde.common.PartUtil
;
import
com.yonde.part.convert.DxConvertFactory
;
import
com.yonde.part.convert.DxTypeEnum
;
import
com.yonde.part.service.PartService
;
import
org.springframework.stereotype.Service
;
/**
* Created on 2022/12/15
*
* @author
*/
@Service
public
class
PartServiceImpl
implements
PartService
{
@Override
public
Object
getPartByNumber
(
String
number
)
throws
Exception
{
return
DxConvertFactory
.
convertFactory
(
DxTypeEnum
.
WTPART
,
PartUtil
.
getPartByNumber
(
number
,
false
));
}
}
src/com/yonde/part/vo/DxPart.java
0 → 100644
View file @
83f34268
This diff is collapsed.
Click to expand it.
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