Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
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
base_platform_enterprise
gic-platform-enterprise
Commits
78799d1e
Commit
78799d1e
authored
Jul 16, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增企业
parent
dfdf31e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletions
+48
-1
EnterpriseApiService.java
...java/com/gic/enterprise/service/EnterpriseApiService.java
+7
-0
EnterpriseApiServiceImpl.java
...ic/enterprise/service/outer/EnterpriseApiServiceImpl.java
+11
-1
EnterpriseApiServiceImplTest.java
...nterprise/service/outer/EnterpriseApiServiceImplTest.java
+30
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/EnterpriseApiService.java
View file @
78799d1e
...
...
@@ -23,4 +23,11 @@ public interface EnterpriseApiService {
* @return
*/
ServiceResponse
<
Integer
>
editEnterprise
(
EnterpriseDTO
enterpriseDTO
);
/**
* 根据主键获取数据
* @param enterpriseId
* @return
*/
ServiceResponse
<
EnterpriseDTO
>
getEnterpriseById
(
Integer
enterpriseId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/EnterpriseApiServiceImpl.java
View file @
78799d1e
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.constant.EnterpriseStatusTypeEnum
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.entity.TabEnterprise
;
...
...
@@ -55,7 +56,7 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
if
(
tabEnterprise
==
null
)
{
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"企业ID错误,查询不到数据"
);
}
if
(
enterpriseService
.
isRepeatEnterpriseName
(
enterpriseDTO
.
getEnterpriseName
(),
null
))
{
if
(
enterpriseService
.
isRepeatEnterpriseName
(
enterpriseDTO
.
getEnterpriseName
(),
enterpriseDTO
.
getEnterpriseId
()
))
{
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户名称不能重复"
);
}
...
...
@@ -63,4 +64,13 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
enterpriseService
.
editEnterprise
(
enterpriseDTO
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
EnterpriseDTO
>
getEnterpriseById
(
Integer
enterpriseId
)
{
TabEnterprise
tabEnterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
tabEnterprise
==
null
)
{
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"企业ID错误,查询不到数据"
);
}
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
EnterpriseDTO
.
class
,
tabEnterprise
));
}
}
gic-platform-enterprise-service/src/test/com/gic/enterprise/service/outer/EnterpriseApiServiceImplTest.java
0 → 100644
View file @
78799d1e
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
;
/**
* @author guojx
* @date 2019/7/16 6:31 PM
*/
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
public
class
EnterpriseApiServiceImplTest
extends
AbstractJUnit4SpringContextTests
{
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@Test
public
void
saveEnterprise
()
throws
Exception
{
EnterpriseDTO
dto
=
new
EnterpriseDTO
();
ServiceResponse
response
=
enterpriseApiService
.
saveEnterprise
(
dto
);
if
(!
response
.
isSuccess
())
{
System
.
out
.
println
(
response
.
getMessage
());
}
}
}
\ No newline at end of file
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