Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
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
poc
poc-api
Commits
f6c732b9
Commit
f6c732b9
authored
Nov 27, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: NPE
parent
d3173521
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
91 deletions
+47
-91
BizVoiceTimbreService.java
...java/cn/com/poc/timbre/service/BizVoiceTimbreService.java
+1
-11
BizVoiceTimbreServiceImpl.java
...om/poc/timbre/service/impl/BizVoiceTimbreServiceImpl.java
+1
-78
BizMemberInfoServiceImpl.java
...n/com/poc/user/service/impl/BizMemberInfoServiceImpl.java
+1
-1
BizVoiceTimbreRestTest.java
...t/java/cn/com/poc/timbre/rest/BizVoiceTimbreRestTest.java
+0
-1
BizVoiceTimbreServiceTest.java
.../cn/com/poc/timbre/service/BizVoiceTimbreServiceTest.java
+44
-0
No files found.
src/main/java/cn/com/poc/timbre/service/BizVoiceTimbreService.java
View file @
f6c732b9
package
cn
.
com
.
poc
.
timbre
.
service
;
package
cn
.
com
.
poc
.
timbre
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.timbre.entity.BizVoiceTimbreEntity
;
import
cn.com.poc.timbre.entity.BizVoiceTimbreEntity
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
public
interface
BizVoiceTimbreService
extends
BaseService
{
public
interface
BizVoiceTimbreService
extends
BaseService
{
BizVoiceTimbreEntity
get
(
java
.
lang
.
Integer
id
)
throws
Exception
;
BizVoiceTimbreEntity
getByTimbreId
(
java
.
lang
.
String
timbreId
);
BizVoiceTimbreEntity
getByTimbreId
(
java
.
lang
.
String
timbreId
);
List
<
BizVoiceTimbreEntity
>
findByExample
(
BizVoiceTimbreEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
List
<
BizVoiceTimbreEntity
>
findByExample
(
BizVoiceTimbreEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizVoiceTimbreEntity
save
(
BizVoiceTimbreEntity
entity
)
throws
Exception
;
BizVoiceTimbreEntity
update
(
BizVoiceTimbreEntity
entity
)
throws
Exception
;
void
deletedById
(
java
.
lang
.
Integer
id
)
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/timbre/service/impl/BizVoiceTimbreServiceImpl.java
View file @
f6c732b9
...
@@ -26,18 +26,6 @@ public class BizVoiceTimbreServiceImpl extends BaseServiceImpl
...
@@ -26,18 +26,6 @@ public class BizVoiceTimbreServiceImpl extends BaseServiceImpl
@Resource
@Resource
private
BizVoiceTimbreRepository
repository
;
private
BizVoiceTimbreRepository
repository
;
public
BizVoiceTimbreEntity
get
(
java
.
lang
.
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizVoiceTimbreModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
)
{
return
null
;
}
if
(
"Y"
.
equals
(
model
.
getIsDeleted
()))
{
return
null
;
}
return
BizVoiceTimbreConvert
.
modelToEntity
(
model
);
}
@Override
@Override
public
BizVoiceTimbreEntity
getByTimbreId
(
String
timbreId
)
{
public
BizVoiceTimbreEntity
getByTimbreId
(
String
timbreId
)
{
BizVoiceTimbreModel
bizVoiceTimbreModel
=
new
BizVoiceTimbreModel
();
BizVoiceTimbreModel
bizVoiceTimbreModel
=
new
BizVoiceTimbreModel
();
...
@@ -50,6 +38,7 @@ public class BizVoiceTimbreServiceImpl extends BaseServiceImpl
...
@@ -50,6 +38,7 @@ public class BizVoiceTimbreServiceImpl extends BaseServiceImpl
return
null
;
return
null
;
}
}
@Override
public
List
<
BizVoiceTimbreEntity
>
findByExample
(
BizVoiceTimbreEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
public
List
<
BizVoiceTimbreEntity
>
findByExample
(
BizVoiceTimbreEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizVoiceTimbreEntity
>
result
=
new
ArrayList
<
BizVoiceTimbreEntity
>();
List
<
BizVoiceTimbreEntity
>
result
=
new
ArrayList
<
BizVoiceTimbreEntity
>();
BizVoiceTimbreModel
model
=
new
BizVoiceTimbreModel
();
BizVoiceTimbreModel
model
=
new
BizVoiceTimbreModel
();
...
@@ -63,70 +52,4 @@ public class BizVoiceTimbreServiceImpl extends BaseServiceImpl
...
@@ -63,70 +52,4 @@ public class BizVoiceTimbreServiceImpl extends BaseServiceImpl
}
}
return
result
;
return
result
;
}
}
public
BizVoiceTimbreEntity
save
(
BizVoiceTimbreEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
entity
.
setIsDeleted
(
"N"
);
BizVoiceTimbreModel
model
=
BizVoiceTimbreConvert
.
entityToModel
(
entity
);
BizVoiceTimbreModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizVoiceTimbreConvert
.
modelToEntity
(
saveModel
);
}
public
BizVoiceTimbreEntity
update
(
BizVoiceTimbreEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizVoiceTimbreModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getTimbreId
()
!=
null
)
{
model
.
setTimbreId
(
entity
.
getTimbreId
());
}
if
(
entity
.
getLanguage
()
!=
null
)
{
model
.
setLanguage
(
entity
.
getLanguage
());
}
if
(
entity
.
getTimbreName
()
!=
null
)
{
model
.
setTimbreName
(
entity
.
getTimbreName
());
}
if
(
entity
.
getTimbreNameEn
()
!=
null
)
{
model
.
setTimbreNameEn
(
entity
.
getTimbreNameEn
());
}
if
(
entity
.
getTimbreNameTw
()
!=
null
)
{
model
.
setTimbreNameTw
(
entity
.
getTimbreNameTw
());
}
if
(
entity
.
getVoiceUrl
()
!=
null
)
{
model
.
setVoiceUrl
(
entity
.
getVoiceUrl
());
}
if
(
entity
.
getIsDeleted
()
!=
null
)
{
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
}
if
(
entity
.
getCreator
()
!=
null
)
{
model
.
setCreator
(
entity
.
getCreator
());
}
if
(
entity
.
getCreatedTime
()
!=
null
)
{
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
}
if
(
entity
.
getModifier
()
!=
null
)
{
model
.
setModifier
(
entity
.
getModifier
());
}
if
(
entity
.
getModifiedTime
()
!=
null
)
{
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
}
if
(
entity
.
getSysVersion
()
!=
null
)
{
model
.
setSysVersion
(
entity
.
getSysVersion
());
}
BizVoiceTimbreModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizVoiceTimbreConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizVoiceTimbreModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
)
{
if
(
"N"
.
equals
(
model
.
getIsDeleted
()))
{
model
.
setIsDeleted
(
"Y"
);
this
.
repository
.
save
(
model
);
}
}
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/user/service/impl/BizMemberInfoServiceImpl.java
View file @
f6c732b9
...
@@ -104,7 +104,7 @@ public class BizMemberInfoServiceImpl extends BaseServiceImpl
...
@@ -104,7 +104,7 @@ public class BizMemberInfoServiceImpl extends BaseServiceImpl
bizMemberInfoModel
.
setEmail
(
memberInfoEntity
.
getEmail
());
bizMemberInfoModel
.
setEmail
(
memberInfoEntity
.
getEmail
());
}
}
if
(
StringUtils
.
isNotBlank
(
memberInfoEntity
.
getRemark
()))
{
if
(
StringUtils
.
isNotBlank
(
memberInfoEntity
.
getRemark
()))
{
if
(
memberInfoEntity
.
get
NickName
().
length
()
>
200
)
{
if
(
memberInfoEntity
.
get
Remark
().
length
()
>
200
)
{
throw
new
I18nMessageException
(
"exception/remark.max.len"
);
throw
new
I18nMessageException
(
"exception/remark.max.len"
);
}
}
bizMemberInfoModel
.
setRemark
(
memberInfoEntity
.
getRemark
());
bizMemberInfoModel
.
setRemark
(
memberInfoEntity
.
getRemark
());
...
...
src/test/java/cn/com/poc/timbre/rest/BizVoiceTimbreRestTest.java
View file @
f6c732b9
...
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
...
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
Mockito
.
when
;
@RunWith
(
MockitoJUnitRunner
.
class
)
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
BizVoiceTimbreRestTest
{
public
class
BizVoiceTimbreRestTest
{
MockedStatic
<
Context
>
mockedContext
;
MockedStatic
<
Context
>
mockedContext
;
@Mock
@Mock
...
...
src/test/java/cn/com/poc/timbre/service/BizVoiceTimbreServiceTest.java
0 → 100644
View file @
f6c732b9
package
cn
.
com
.
poc
.
timbre
.
service
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.timbre.entity.BizVoiceTimbreEntity
;
import
cn.com.yict.framemax.core.spring.SingleContextInitializer
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
initializers
=
SingleContextInitializer
.
class
)
@WebAppConfiguration
public
class
BizVoiceTimbreServiceTest
{
@Resource
private
BizVoiceTimbreService
bizVoiceTimbreService
;
@Test
public
void
getByTimbreIdTest
()
{
BizVoiceTimbreEntity
bizVoiceTimbreEntity
=
bizVoiceTimbreService
.
getByTimbreId
(
"101019"
);
System
.
out
.
println
(
JsonUtils
.
serialize
(
bizVoiceTimbreEntity
));
// 获取不存在
System
.
out
.
println
(
JsonUtils
.
serialize
(
bizVoiceTimbreService
.
getByTimbreId
(
"1"
)));
}
@Test
public
void
findByExampleTest
()
throws
Exception
{
BizVoiceTimbreEntity
bizVoiceTimbreEntity
=
new
BizVoiceTimbreEntity
();
bizVoiceTimbreEntity
.
setIsDeleted
(
CommonConstant
.
YOrN
.
N
);
List
<
BizVoiceTimbreEntity
>
entities
=
bizVoiceTimbreService
.
findByExample
(
bizVoiceTimbreEntity
,
new
PagingInfo
(
10
,
1
));
System
.
out
.
println
(
JsonUtils
.
listToJson
(
entities
));
}
}
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