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
f1cf63a0
Commit
f1cf63a0
authored
Jul 18, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商户初始化
parent
44f5018c
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
590 additions
and
1 deletions
+590
-1
EnterpriseInitCodeEnum.java
...a/com/gic/enterprise/constant/EnterpriseInitCodeEnum.java
+49
-0
EnterpriseInitDTO.java
...c/main/java/com/gic/enterprise/dto/EnterpriseInitDTO.java
+154
-0
EnterpriseApiService.java
...java/com/gic/enterprise/service/EnterpriseApiService.java
+10
-0
EnterpriseInitApiService.java
.../com/gic/enterprise/service/EnterpriseInitApiService.java
+29
-0
TabEnterpriseInitMapper.java
...om/gic/enterprise/dao/mapper/TabEnterpriseInitMapper.java
+12
-0
EnterpriseInitService.java
...ava/com/gic/enterprise/service/EnterpriseInitService.java
+39
-0
EnterpriseService.java
...in/java/com/gic/enterprise/service/EnterpriseService.java
+6
-0
EnterpriseInitServiceImpl.java
...ic/enterprise/service/impl/EnterpriseInitServiceImpl.java
+62
-0
EnterpriseServiceImpl.java
...om/gic/enterprise/service/impl/EnterpriseServiceImpl.java
+8
-0
EnterpriseApiServiceImpl.java
...ic/enterprise/service/outer/EnterpriseApiServiceImpl.java
+18
-0
EnterpriseInitApiServiceImpl.java
...nterprise/service/outer/EnterpriseInitApiServiceImpl.java
+68
-0
dubbo-gic-platform-enterprise-service.xml
.../main/resources/dubbo-gic-platform-enterprise-service.xml
+1
-1
TabEnterpriseInitMapper.xml
...ice/src/main/resources/mapper/TabEnterpriseInitMapper.xml
+83
-0
EnterpriseController.java
...om/gic/operation/web/controller/EnterpriseController.java
+49
-0
dubbo-gic-platform-operation-web.xml
...b/src/main/resources/dubbo-gic-platform-operation-web.xml
+2
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/constant/EnterpriseInitCodeEnum.java
0 → 100644
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
constant
;
/**
* @author guojx
* @date 2019/7/18 11:22 AM
*/
public
enum
EnterpriseInitCodeEnum
{
CreateMemberCard
(
"createMemberCard"
,
"至少新建一张会员卡"
),
CreateMemberGrade
(
"createMemberGrade"
,
"至少新建一个会员等级"
),
BindServiceNumber
(
"bindServiceNumber"
,
"至少绑定一个服务号"
),
PerfectAutoReplyConfig
(
"perfectAutoReplyConfig"
,
"完善自动回复配置"
),
PerfectMenuConfig
(
"perfectMenuConfig"
,
"完善自定义菜单配置"
),
BingWeChat
(
"bingWeChat"
,
"至少绑定一个小程序"
),
PerfectWeChatPage
(
"perfectWeChatPage"
,
"完善小程序页面装修"
),
ShortMessageServiceConfig
(
"shortMessageServiceConfig"
,
"完成短信业务配置"
);
private
String
code
;
private
String
message
;
private
EnterpriseInitCodeEnum
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
static
boolean
isRightCode
(
String
code
)
{
for
(
EnterpriseInitCodeEnum
codeEnum
:
values
())
{
if
(
codeEnum
.
getCode
().
equals
(
code
))
{
return
true
;
}
}
return
false
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/dto/EnterpriseInitDTO.java
0 → 100644
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
dto
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author guojx
* @date 2019/7/18 11:03 AM
*/
public
class
EnterpriseInitDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6673226754430906347L
;
/**
*
*/
private
Integer
enterpriseInitId
;
/**
* 配置信息名称
*/
private
String
configName
;
/**
* 前往商户后台的url
*/
private
String
configUrl
;
/**
* 父级ID
*/
private
Integer
parentId
;
/**
*
*/
private
Integer
enterpriseId
;
/**
*
*/
private
Integer
sort
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
/**
* 配置代码
*/
private
String
configCode
;
/**
* 层级,用于排序
*/
private
Integer
level
;
/**
* 是否初始化 1:已经初始化 0:为初始化
*/
private
Integer
isInitConfig
;
public
Integer
getEnterpriseInitId
()
{
return
enterpriseInitId
;
}
public
void
setEnterpriseInitId
(
Integer
enterpriseInitId
)
{
this
.
enterpriseInitId
=
enterpriseInitId
;
}
public
String
getConfigName
()
{
return
configName
;
}
public
void
setConfigName
(
String
configName
)
{
this
.
configName
=
configName
;
}
public
String
getConfigUrl
()
{
return
configUrl
;
}
public
void
setConfigUrl
(
String
configUrl
)
{
this
.
configUrl
=
configUrl
;
}
public
Integer
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Integer
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getConfigCode
()
{
return
configCode
;
}
public
void
setConfigCode
(
String
configCode
)
{
this
.
configCode
=
configCode
;
}
public
Integer
getLevel
()
{
return
level
;
}
public
void
setLevel
(
Integer
level
)
{
this
.
level
=
level
;
}
public
Integer
getIsInitConfig
()
{
return
isInitConfig
;
}
public
void
setIsInitConfig
(
Integer
isInitConfig
)
{
this
.
isInitConfig
=
isInitConfig
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/EnterpriseApiService.java
View file @
f1cf63a0
...
...
@@ -4,8 +4,11 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.EnterpriseInitDTO
;
import
com.gic.enterprise.dto.EnterpriseListDTO
;
import
java.util.List
;
/**
* @author guojx
* @date 2019/7/16 4:12 PM
...
...
@@ -59,4 +62,11 @@ public interface EnterpriseApiService {
ServiceResponse
<
Page
<
EnterpriseListDTO
>>
listEnterprise
(
String
search
,
Integer
serviceVersion
,
Integer
status
,
String
orderBy
,
Integer
pageNum
,
Integer
pageSize
);
/**
* 初始化商户
* @param enterpriseId
* @return
*/
ServiceResponse
initEnterprise
(
Integer
enterpriseId
);
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/EnterpriseInitApiService.java
0 → 100644
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
service
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.dto.EnterpriseInitDTO
;
import
java.util.List
;
/**
* @author guojx
* @date 2019/7/18 11:04 AM
*/
public
interface
EnterpriseInitApiService
{
/**
* 初始化项目,根据code
* @param configCode
* @param enterpriseId
* @return
*/
ServiceResponse
initByConfigCode
(
String
configCode
,
Integer
enterpriseId
);
/**
* 查询列表
* @param enterpriseId
* @return
*/
ServiceResponse
<
List
<
EnterpriseInitDTO
>>
listByEnterpriseId
(
Integer
enterpriseId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/dao/mapper/TabEnterpriseInitMapper.java
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
dao
.
mapper
;
import
com.gic.enterprise.entity.TabEnterpriseInit
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabEnterpriseInitMapper
{
/**
...
...
@@ -50,4 +53,12 @@ public interface TabEnterpriseInitMapper {
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabEnterpriseInit
record
);
int
updateByEnterpriseIdSelective
(
TabEnterpriseInit
record
);
TabEnterpriseInit
getByCode
(
@Param
(
"configCode"
)
String
configCode
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
List
<
TabEnterpriseInit
>
listByParentId
(
@Param
(
"parentId"
)
Integer
parentId
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
int
initEnterpriseConfigInfo
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/EnterpriseInitService.java
0 → 100644
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
service
;
import
com.gic.enterprise.entity.TabEnterpriseInit
;
import
java.util.List
;
/**
* @author guojx
* @date 2019/7/18 11:07 AM
*/
public
interface
EnterpriseInitService
{
/**
* 初始化项目
* @param configCode
* @param enterpriseId
*/
void
initByCode
(
String
configCode
,
Integer
enterpriseId
);
void
initById
(
Integer
initId
);
TabEnterpriseInit
getByCode
(
String
configCode
,
Integer
enterpriseId
);
/**
* 根据父级ID查询列表
* @param parentId
* @param enterpriseId
* @return
*/
List
<
TabEnterpriseInit
>
listByParentId
(
Integer
parentId
,
Integer
enterpriseId
);
/**
* 商户初始化配置信息生成,在商户新建的时候进行生成
* @param enterpriseId
*/
void
initEnterpriseConfigInfo
(
Integer
enterpriseId
);
TabEnterpriseInit
getById
(
Integer
initId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/EnterpriseService.java
View file @
f1cf63a0
...
...
@@ -49,4 +49,10 @@ public interface EnterpriseService {
Page
<
EnterpriseListDTO
>
listEnterprise
(
String
search
,
Integer
serviceVersion
,
Integer
status
,
String
orderBy
,
Integer
pageNum
,
Integer
pageSize
);
/**
* 初始化商户
* @param enterpriseId
*/
void
initEnterprise
(
Integer
enterpriseId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/EnterpriseInitServiceImpl.java
0 → 100644
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
service
.
impl
;
import
com.gic.enterprise.dao.mapper.TabEnterpriseInitMapper
;
import
com.gic.enterprise.entity.TabEnterpriseInit
;
import
com.gic.enterprise.service.EnterpriseInitService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author guojx
* @date 2019/7/18 11:13 AM
*/
@Service
(
"enterpriseInitService"
)
public
class
EnterpriseInitServiceImpl
implements
EnterpriseInitService
{
@Autowired
private
TabEnterpriseInitMapper
tabEnterpriseInitMapper
;
@Override
public
void
initByCode
(
String
configCode
,
Integer
enterpriseId
)
{
TabEnterpriseInit
enterpriseInit
=
new
TabEnterpriseInit
();
enterpriseInit
.
setEnterpriseId
(
enterpriseId
);
enterpriseInit
.
setConfigCode
(
configCode
);
enterpriseInit
.
setIsInitConfig
(
1
);
tabEnterpriseInitMapper
.
updateByEnterpriseIdSelective
(
enterpriseInit
);
}
@Override
public
void
initById
(
Integer
initId
)
{
TabEnterpriseInit
enterpriseInit
=
new
TabEnterpriseInit
();
enterpriseInit
.
setIsInitConfig
(
1
);
enterpriseInit
.
setEnterpriseInitId
(
initId
);
tabEnterpriseInitMapper
.
updateByPrimaryKeySelective
(
enterpriseInit
);
}
@Override
public
TabEnterpriseInit
getByCode
(
String
configCode
,
Integer
enterpriseId
)
{
return
tabEnterpriseInitMapper
.
getByCode
(
configCode
,
enterpriseId
);
}
@Override
public
List
<
TabEnterpriseInit
>
listByParentId
(
Integer
parentId
,
Integer
enterpriseId
)
{
List
<
TabEnterpriseInit
>
list
=
tabEnterpriseInitMapper
.
listByParentId
(
parentId
,
enterpriseId
);
if
(
list
==
null
||
list
.
size
()
<
1
)
{
return
new
ArrayList
<>();
}
return
list
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
initEnterpriseConfigInfo
(
Integer
enterpriseId
)
{
tabEnterpriseInitMapper
.
initEnterpriseConfigInfo
(
enterpriseId
);
}
@Override
public
TabEnterpriseInit
getById
(
Integer
initId
)
{
return
tabEnterpriseInitMapper
.
selectByPrimaryKey
(
initId
);
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/EnterpriseServiceImpl.java
View file @
f1cf63a0
...
...
@@ -66,4 +66,12 @@ public class EnterpriseServiceImpl implements EnterpriseService{
List
<
EnterpriseListDTO
>
list
=
tabEnterpriseMapper
.
listEnterpriseId
(
search
,
serviceVersion
,
status
,
orderBy
);
return
(
Page
<
EnterpriseListDTO
>)
list
;
}
@Override
public
void
initEnterprise
(
Integer
enterpriseId
)
{
TabEnterprise
tabEnterprise
=
new
TabEnterprise
();
tabEnterprise
.
setEnterpriseId
(
enterpriseId
);
tabEnterprise
.
setIsInitComplete
(
1
);
tabEnterpriseMapper
.
updateByPrimaryKeySelective
(
tabEnterprise
);
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/EnterpriseApiServiceImpl.java
View file @
f1cf63a0
...
...
@@ -8,11 +8,13 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.constant.EnterpriseStatusTypeEnum
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.EnterpriseInitDTO
;
import
com.gic.enterprise.dto.EnterpriseListDTO
;
import
com.gic.enterprise.entity.TabEnterprise
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.exception.EnterpriseException
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.EnterpriseInitService
;
import
com.gic.enterprise.service.EnterpriseService
;
import
com.gic.store.utils.valid.ValidUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -32,6 +34,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
private
EnterpriseService
enterpriseService
;
@Autowired
private
UserApiService
userApiService
;
@Autowired
private
EnterpriseInitService
enterpriseInitService
;
@Override
public
ServiceResponse
<
Integer
>
saveEnterprise
(
EnterpriseDTO
enterpriseDTO
)
{
...
...
@@ -72,6 +76,9 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
enterpriseDTO
.
setStatus
(
EnterpriseStatusTypeEnum
.
EFFECTIVE
.
getCode
());
int
enterpriseId
=
enterpriseService
.
saveEnterprise
(
enterpriseDTO
);
//商户初始化配置信息生成
enterpriseInitService
.
initEnterpriseConfigInfo
(
enterpriseId
);
userDTO
.
setEnterpriseId
(
enterpriseId
);
//超级管理员
userDTO
.
setSuperAdmin
(
1
);
...
...
@@ -140,4 +147,15 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
Page
<
EnterpriseListDTO
>
resultPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
);
return
ServiceResponse
.
success
(
resultPage
);
}
@Override
public
ServiceResponse
initEnterprise
(
Integer
enterpriseId
)
{
TabEnterprise
tabEnterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
tabEnterprise
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID输入有误"
);
}
enterpriseService
.
initEnterprise
(
enterpriseId
);
return
ServiceResponse
.
success
();
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/EnterpriseInitApiServiceImpl.java
0 → 100644
View file @
f1cf63a0
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.constant.EnterpriseInitCodeEnum
;
import
com.gic.enterprise.dto.EnterpriseInitDTO
;
import
com.gic.enterprise.entity.TabEnterprise
;
import
com.gic.enterprise.entity.TabEnterpriseInit
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.service.EnterpriseInitApiService
;
import
com.gic.enterprise.service.EnterpriseInitService
;
import
com.gic.enterprise.service.EnterpriseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* @author guojx
* @date 2019/7/18 11:31 AM
*/
@Service
(
"enterpriseInitApiService"
)
public
class
EnterpriseInitApiServiceImpl
implements
EnterpriseInitApiService
{
@Autowired
private
EnterpriseInitService
enterpriseInitService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Override
public
ServiceResponse
initByConfigCode
(
String
configCode
,
Integer
enterpriseId
)
{
if
(!
EnterpriseInitCodeEnum
.
isRightCode
(
configCode
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"初始化配置代码参数有误"
);
}
TabEnterprise
enterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
enterprise
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID有误"
);
}
enterpriseInitService
.
initByCode
(
configCode
,
enterpriseId
);
//
TabEnterpriseInit
enterpriseInit
=
enterpriseInitService
.
getByCode
(
configCode
,
enterpriseId
);
if
(
enterpriseInit
.
getParentId
()
!=
0
)
{
//如果不是第一层,需要查询子节点是否都已经初始化,如果是,则父级节点自动初始化
List
<
TabEnterpriseInit
>
listByParentId
=
enterpriseInitService
.
listByParentId
(
enterpriseInit
.
getParentId
(),
enterpriseId
);
boolean
isChildrenAllInit
=
true
;
for
(
TabEnterpriseInit
tabEnterpriseInit
:
listByParentId
)
{
if
(
tabEnterpriseInit
.
getIsInitConfig
()
!=
1
)
{
isChildrenAllInit
=
false
;
break
;
}
}
if
(
isChildrenAllInit
)
{
enterpriseInitService
.
initById
(
enterpriseInit
.
getEnterpriseInitId
());
}
}
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
List
<
EnterpriseInitDTO
>>
listByEnterpriseId
(
Integer
enterpriseId
)
{
TabEnterprise
enterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
enterprise
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID有误"
);
}
List
<
TabEnterpriseInit
>
listByParentId
=
enterpriseInitService
.
listByParentId
(
null
,
enterpriseId
);
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
EnterpriseInitDTO
.
class
,
listByParentId
));
}
}
gic-platform-enterprise-service/src/main/resources/dubbo-gic-platform-enterprise-service.xml
View file @
f1cf63a0
...
...
@@ -17,7 +17,7 @@
<dubbo:service
interface=
"com.gic.enterprise.service.EnterpriseApiService"
ref=
"enterpriseApiService"
timeout=
"60000"
/>
<dubbo:service
interface=
"com.gic.enterprise.service.EnterpriseInitApiService"
ref=
"enterpriseInitApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.log.api.service.LogApiService"
id=
"logApiService"
timeout=
"60000"
/>
<!--用户-->
...
...
gic-platform-enterprise-service/src/main/resources/mapper/TabEnterpriseInitMapper.xml
View file @
f1cf63a0
...
...
@@ -161,4 +161,86 @@
is_init_config = #{isInitConfig,jdbcType=INTEGER}
where enterprise_init_id = #{enterpriseInitId,jdbcType=INTEGER}
</update>
<update
id=
"updateByEnterpriseIdSelective"
parameterType=
"com.gic.enterprise.entity.TabEnterpriseInit"
>
update tab_enterprise_init
<set>
<if
test=
"configName != null"
>
config_name = #{configName,jdbcType=VARCHAR},
</if>
<if
test=
"configUrl != null"
>
config_url = #{configUrl,jdbcType=VARCHAR},
</if>
<if
test=
"parentId != null"
>
parent_id = #{parentId,jdbcType=INTEGER},
</if>
<if
test=
"sort != null"
>
sort = #{sort,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"level != null"
>
level = #{level,jdbcType=INTEGER},
</if>
<if
test=
"isInitConfig != null"
>
is_init_config = #{isInitConfig,jdbcType=INTEGER},
</if>
</set>
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
<if
test=
"configCode != null"
>
and config_code = #{configCode,jdbcType=VARCHAR},
</if>
</update>
<select
id=
"getByCode"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
from tab_enterprise_init
where enterprise_id = #{enterpriseId};
and config_code = #{configCode}
</select>
<select
id=
"listByParentId"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
from tab_enterprise_init
where enterprise_id = #{enterpriseId};
<if
test=
"parentId != null and parentId != '' "
>
and parent_id = #{parentId}
</if>
</select>
<insert
id=
"initEnterpriseConfigInfo"
>
INSERT INTO tab_enterprise_init (
config_name,
config_url,
parent_id,
enterprise_id,
sort,
create_time,
update_time,
config_code,
LEVEL,
is_init_config
) SELECT
t2.config_name,
t2.config_url,
t2.parent_id,
#{enterpriseId},
t2.sort,
t2.create_time,
t2.update_time,
t2.config_code,
t2. LEVEL,
t2.is_init_config
FROM
tab_enterprise_init t2
WHERE
t2.enterprise_id = - 1
</insert>
</mapper>
\ No newline at end of file
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/EnterpriseController.java
View file @
f1cf63a0
...
...
@@ -8,9 +8,11 @@ import com.gic.commons.webapi.reponse.RestResponse;
import
com.gic.enterprise.constant.EnterpriseListOrderByEnum
;
import
com.gic.enterprise.constant.EnterpriseVersionStatusEnum
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.EnterpriseInitDTO
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.response.EnterpriseRestResponse
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.EnterpriseInitApiService
;
import
com.gic.operation.web.qo.PageQO
;
import
com.gic.operation.web.utils.UserPasswordUtil
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -21,7 +23,9 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -36,6 +40,8 @@ public class EnterpriseController {
private
EnterpriseApiService
enterpriseApiService
;
@Autowired
private
UserApiService
userApiService
;
@Autowired
private
EnterpriseInitApiService
enterpriseInitApiService
;
@RequestMapping
(
"/save-enterprise"
)
public
RestResponse
saveEnterprise
(
@Validated
({
EnterpriseDTO
.
SaveEnterpriseValid
.
class
})
EnterpriseDTO
enterpriseDTO
,
...
...
@@ -86,6 +92,27 @@ public class EnterpriseController {
return
RestResponse
.
success
(
resultMap
);
}
@RequestMapping
(
"/init-enterprise"
)
public
RestResponse
initEnterprise
(
Integer
enterpriseId
)
{
ServiceResponse
enterpriseResult
=
enterpriseApiService
.
initEnterprise
(
enterpriseId
);
if
(
enterpriseResult
.
isSuccess
())
{
return
RestResponse
.
success
();
}
else
{
return
EnterpriseRestResponse
.
failure
(
enterpriseResult
);
}
}
@RequestMapping
(
"/list-enterprise-init-info"
)
public
RestResponse
listEnterpriseInitInfo
(
Integer
enterpriseId
)
{
ServiceResponse
<
List
<
EnterpriseInitDTO
>>
response
=
enterpriseInitApiService
.
listByEnterpriseId
(
enterpriseId
);
if
(
response
.
isSuccess
())
{
List
<
EnterpriseInitDTO
>
dtoList
=
response
.
getResult
();
return
RestResponse
.
success
(
changeListToTree
(
0
,
dtoList
));
}
else
{
return
EnterpriseRestResponse
.
failure
(
response
);
}
}
@RequestMapping
(
"/edit-enterprise"
)
public
RestResponse
editEnterprise
(
@Validated
({
EnterpriseDTO
.
EditEnterpriseValid
.
class
,
EnterpriseDTO
.
SaveEnterpriseValid
.
class
})
...
...
@@ -127,4 +154,26 @@ public class EnterpriseController {
return
EnterpriseRestResponse
.
failure
(
enterpriseResult
);
}
}
public
static
List
<
Map
<
String
,
Object
>>
changeListToTree
(
int
initId
,
List
<
EnterpriseInitDTO
>
list
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
if
(
list
!=
null
)
{
for
(
EnterpriseInitDTO
t
:
list
)
{
if
(
initId
==
t
.
getParentId
())
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
16
);
data
.
put
(
"parentId"
,
t
.
getParentId
());
data
.
put
(
"initId"
,
t
.
getEnterpriseInitId
());
data
.
put
(
"configName"
,
t
.
getConfigName
());
data
.
put
(
"sort"
,
t
.
getSort
());
data
.
put
(
"isInitConfig"
,
t
.
getIsInitConfig
());
data
.
put
(
"level"
,
t
.
getLevel
());
data
.
put
(
"configUrl"
,
t
.
getConfigUrl
());
List
<
Map
<
String
,
Object
>>
children
=
changeListToTree
(
t
.
getParentId
(),
list
);
data
.
put
(
"children"
,
children
);
result
.
add
(
data
);
}
}
}
return
result
;
}
}
gic-platform-operation-web/src/main/resources/dubbo-gic-platform-operation-web.xml
View file @
f1cf63a0
...
...
@@ -40,4 +40,5 @@
<dubbo:reference
interface=
"com.gic.auth.service.UserApiService"
id=
"userApiService"
timeout=
"60000"
/>
<!--商户-->
<dubbo:reference
interface=
"com.gic.enterprise.service.EnterpriseApiService"
id=
"enterpriseApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.service.EnterpriseInitApiService"
id=
"enterpriseInitApiService"
timeout=
"60000"
/>
</beans>
\ 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