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
7aa843f2
Commit
7aa843f2
authored
Feb 16, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商户前置资源调整
parent
9f2eb067
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
734 additions
and
31 deletions
+734
-31
EnterpriseDTO.java
...i/src/main/java/com/gic/enterprise/dto/EnterpriseDTO.java
+7
-6
EnterpriseResourceRelDTO.java
...java/com/gic/enterprise/dto/EnterpriseResourceRelDTO.java
+119
-0
EnterpriseApiService.java
...java/com/gic/enterprise/service/EnterpriseApiService.java
+11
-0
TabEnterpriseResourceRelMapper.java
...enterprise/dao/mapper/TabEnterpriseResourceRelMapper.java
+61
-0
TabEnterpriseResourceRel.java
...a/com/gic/enterprise/entity/TabEnterpriseResourceRel.java
+113
-0
EnterpriseResourceRelService.java
.../gic/enterprise/service/EnterpriseResourceRelService.java
+15
-0
EnterpriseResourceRelServiceImpl.java
...rprise/service/impl/EnterpriseResourceRelServiceImpl.java
+38
-0
EnterpriseApiServiceImpl.java
...terprise/service/outer/impl/EnterpriseApiServiceImpl.java
+84
-11
TabEnterpriseResourceRelMapper.xml
.../main/resources/mapper/TabEnterpriseResourceRelMapper.xml
+147
-0
EnterpriseController.java
...m/gic/enterprise/web/controller/EnterpriseController.java
+14
-8
EnterpriseResourceRelVO.java
...va/com/gic/enterprise/web/vo/EnterpriseResourceRelVO.java
+46
-0
EnterpriseController.java
...om/gic/operation/web/controller/EnterpriseController.java
+22
-6
EnterpriseInfo.java
...a/com/gic/operation/web/vo/enterprise/EnterpriseInfo.java
+11
-0
EnterpriseResourceRelVO.java
.../operation/web/vo/enterprise/EnterpriseResourceRelVO.java
+46
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/dto/EnterpriseDTO.java
View file @
7aa843f2
...
...
@@ -2,6 +2,7 @@ package com.gic.enterprise.dto;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -101,9 +102,9 @@ public class EnterpriseDTO implements Serializable{
private
Integer
serviceStatus
;
/**
*
商品资源 1:有 0:无
*
前置资源,必有
*/
private
Integer
goodsResource
;
private
List
<
EnterpriseResourceRelDTO
>
resourcesList
;
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
...
...
@@ -217,11 +218,11 @@ public class EnterpriseDTO implements Serializable{
this
.
serviceStatus
=
serviceStatus
;
}
public
Integer
getGoodsResource
()
{
return
goodsResource
;
public
List
<
EnterpriseResourceRelDTO
>
getResourcesList
()
{
return
resourcesList
;
}
public
void
set
GoodsResource
(
Integer
goodsResource
)
{
this
.
goodsResource
=
goodsResource
;
public
void
set
ResourcesList
(
List
<
EnterpriseResourceRelDTO
>
resourcesList
)
{
this
.
resourcesList
=
resourcesList
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/dto/EnterpriseResourceRelDTO.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
dto
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 商户和前置资源的关联
* @ClassName: EnterpriseResourceRelDTO
* @Description:
* @author guojuxing
* @date 2020/2/14 4:00 PM
*/
public
class
EnterpriseResourceRelDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1107474208757248300L
;
/**
* id
*/
private
Integer
enterpriseResourceId
;
/**
* 前置资源code
*/
private
String
resourceCode
;
/**
* 前置资源名称
*/
private
String
resourceName
;
/**
* 企业ID
*/
private
Integer
enterpriseId
;
/**
* 状态1:有效 0:无效
*/
private
Integer
status
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
/**
* 是否拥有权限,1:有 0:无
*/
private
Integer
resourceSwitch
;
public
Integer
getEnterpriseResourceId
()
{
return
enterpriseResourceId
;
}
public
void
setEnterpriseResourceId
(
Integer
enterpriseResourceId
)
{
this
.
enterpriseResourceId
=
enterpriseResourceId
;
}
public
String
getResourceCode
()
{
return
resourceCode
;
}
public
void
setResourceCode
(
String
resourceCode
)
{
this
.
resourceCode
=
resourceCode
;
}
public
String
getResourceName
()
{
return
resourceName
;
}
public
void
setResourceName
(
String
resourceName
)
{
this
.
resourceName
=
resourceName
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
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
Integer
getResourceSwitch
()
{
return
resourceSwitch
;
}
public
void
setResourceSwitch
(
Integer
resourceSwitch
)
{
this
.
resourceSwitch
=
resourceSwitch
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/EnterpriseApiService.java
View file @
7aa843f2
...
...
@@ -6,6 +6,7 @@ import com.gic.auth.dto.UserDTO;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.EnterpriseLicenseDTO
;
import
com.gic.enterprise.dto.EnterpriseListDTO
;
import
com.gic.enterprise.dto.EnterpriseResourceRelDTO
;
import
com.gic.enterprise.dto.market.MarketServiceDTO
;
import
com.gic.enterprise.dto.market.OrderBuyLicenseDTO
;
import
com.gic.enterprise.dto.market.OrderGicDTO
;
...
...
@@ -79,6 +80,16 @@ public interface EnterpriseApiService {
ServiceResponse
<
EnterpriseDTO
>
getEnterpriseById
(
Integer
enterpriseId
);
/**
* 获取商户前置资源开关数据
* @Title: getBusinessFrontRes
* @Description:
* @author guojuxing
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.enterprise.dto.EnterpriseResourceRelDTO>>
*/
ServiceResponse
<
List
<
EnterpriseResourceRelDTO
>>
getBusinessFrontRes
(
Integer
enterpriseId
);
/**
* 商户停用
* @Title: disableEnterprise
* @Description:
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/dao/mapper/TabEnterpriseResourceRelMapper.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
dao
.
mapper
;
import
com.gic.enterprise.entity.TabEnterpriseResourceRel
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabEnterpriseResourceRelMapper
{
/**
* 根据主键删除
*
* @param enterpriseResourceId 主键
* @return 更新条目数
*/
int
deleteByPrimaryKey
(
Integer
enterpriseResourceId
);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insert
(
TabEnterpriseResourceRel
record
);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insertSelective
(
TabEnterpriseResourceRel
record
);
/**
* 根据主键查询
*
* @param enterpriseResourceId 主键
* @return 实体对象
*/
TabEnterpriseResourceRel
selectByPrimaryKey
(
Integer
enterpriseResourceId
);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKeySelective
(
TabEnterpriseResourceRel
record
);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabEnterpriseResourceRel
record
);
void
deleteResource
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"resourceCode"
)
String
resourceCode
);
List
<
TabEnterpriseResourceRel
>
getByEnterpriseId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/entity/TabEnterpriseResourceRel.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
entity
;
import
java.util.Date
;
/**
* tab_enterprise_resource_rel
*/
public
class
TabEnterpriseResourceRel
{
/**
* id
*/
private
Integer
enterpriseResourceId
;
/**
* 前置资源code
*/
private
String
resourceCode
;
/**
* 前置资源名称
*/
private
String
resourceName
;
/**
* 企业ID
*/
private
Integer
enterpriseId
;
/**
* 状态1:有效 0:无效
*/
private
Integer
status
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
/**
* 是否拥有权限,1:有 0:无
*/
private
Integer
resourceSwitch
;
public
Integer
getEnterpriseResourceId
()
{
return
enterpriseResourceId
;
}
public
void
setEnterpriseResourceId
(
Integer
enterpriseResourceId
)
{
this
.
enterpriseResourceId
=
enterpriseResourceId
;
}
public
String
getResourceCode
()
{
return
resourceCode
;
}
public
void
setResourceCode
(
String
resourceCode
)
{
this
.
resourceCode
=
resourceCode
;
}
public
String
getResourceName
()
{
return
resourceName
;
}
public
void
setResourceName
(
String
resourceName
)
{
this
.
resourceName
=
resourceName
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
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
Integer
getResourceSwitch
()
{
return
resourceSwitch
;
}
public
void
setResourceSwitch
(
Integer
resourceSwitch
)
{
this
.
resourceSwitch
=
resourceSwitch
;
}
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/EnterpriseResourceRelService.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
service
;
import
com.gic.enterprise.dto.EnterpriseResourceRelDTO
;
import
com.gic.enterprise.entity.TabEnterpriseResourceRel
;
import
java.util.List
;
public
interface
EnterpriseResourceRelService
{
void
saveResource
(
EnterpriseResourceRelDTO
dto
);
void
deleteResource
(
Integer
enterpriseId
,
String
resourceCode
);
List
<
TabEnterpriseResourceRel
>
getByEnterpriseId
(
Integer
enterpriseId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/EnterpriseResourceRelServiceImpl.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
service
.
impl
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.dao.mapper.TabEnterpriseResourceRelMapper
;
import
com.gic.enterprise.dto.EnterpriseResourceRelDTO
;
import
com.gic.enterprise.entity.TabEnterpriseResourceRel
;
import
com.gic.enterprise.service.EnterpriseResourceRelService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
(
"enterpriseResourceRelService"
)
public
class
EnterpriseResourceRelServiceImpl
implements
EnterpriseResourceRelService
{
@Autowired
private
TabEnterpriseResourceRelMapper
tabEnterpriseResourceRelMapper
;
@Override
public
void
saveResource
(
EnterpriseResourceRelDTO
dto
)
{
Date
now
=
new
Date
();
dto
.
setCreateTime
(
now
);
dto
.
setUpdateTime
(
now
);
dto
.
setStatus
(
1
);
TabEnterpriseResourceRel
record
=
EntityUtil
.
changeEntityNew
(
TabEnterpriseResourceRel
.
class
,
dto
);
tabEnterpriseResourceRelMapper
.
insert
(
record
);
}
@Override
public
void
deleteResource
(
Integer
enterpriseId
,
String
resourceCode
)
{
tabEnterpriseResourceRelMapper
.
deleteResource
(
enterpriseId
,
resourceCode
);
}
@Override
public
List
<
TabEnterpriseResourceRel
>
getByEnterpriseId
(
Integer
enterpriseId
)
{
return
tabEnterpriseResourceRelMapper
.
getByEnterpriseId
(
enterpriseId
);
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/EnterpriseApiServiceImpl.java
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
service
.
outer
.
impl
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.auth.dto.BusinessFrontResDTO
;
import
com.gic.auth.service.BusinessFrontResApiService
;
import
com.gic.enterprise.constants.Constants
;
import
com.gic.enterprise.dto.EnterpriseResourceRelDTO
;
import
com.gic.enterprise.entity.TabEnterpriseInit
;
import
com.gic.enterprise.entity.TabEnterpriseResourceRel
;
import
com.gic.enterprise.service.*
;
import
com.gic.member.api.service.MemberInitApiService
;
import
com.gic.open.api.service.ServeApiService
;
...
...
@@ -76,6 +81,10 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
private
MemberInitApiService
memberInitApiService
;
@Autowired
private
ServeApiService
serveApiService
;
@Autowired
private
EnterpriseResourceRelService
enterpriseResourceRelService
;
@Autowired
private
BusinessFrontResApiService
businessFrontResApiService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -93,13 +102,42 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"公司名称不能重复"
);
}
if
(
enterpriseDTO
.
getGoodsResource
()
==
null
)
{
//默认没有商品资源
enterpriseDTO
.
setGoodsResource
(
0
);
}
//新增商户信息
int
enterpriseId
=
enterpriseService
.
saveEnterprise
(
enterpriseDTO
);
//前置资源校验
List
<
EnterpriseResourceRelDTO
>
resourceList
=
enterpriseDTO
.
getResourcesList
();
if
(
CollectionUtils
.
isEmpty
(
resourceList
))
{
ServiceResponse
<
List
<
BusinessFrontResDTO
>>
businessFrontResListResult
=
businessFrontResApiService
.
listGroupResourceCode
();
if
(
businessFrontResListResult
.
isSuccess
())
{
List
<
BusinessFrontResDTO
>
businessFrontResList
=
businessFrontResListResult
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
businessFrontResList
))
{
for
(
BusinessFrontResDTO
res
:
businessFrontResList
)
{
//默认设置关闭数据
enterpriseResourceRelService
.
deleteResource
(
enterpriseId
,
res
.
getResourceCode
());
EnterpriseResourceRelDTO
enterpriseResourceRel
=
new
EnterpriseResourceRelDTO
();
enterpriseResourceRel
.
setEnterpriseId
(
enterpriseId
);
enterpriseResourceRel
.
setResourceCode
(
res
.
getResourceCode
());
enterpriseResourceRel
.
setResourceName
(
res
.
getResourceName
());
enterpriseResourceRel
.
setResourceSwitch
(
0
);
enterpriseResourceRelService
.
saveResource
(
enterpriseResourceRel
);
}
}
}
}
else
{
LOGGER
.
info
(
"新增商户-前置资源参数:{}"
,
JSON
.
toJSONString
(
resourceList
));
for
(
EnterpriseResourceRelDTO
res
:
resourceList
)
{
enterpriseResourceRelService
.
deleteResource
(
enterpriseId
,
res
.
getResourceCode
());
EnterpriseResourceRelDTO
enterpriseResourceRel
=
new
EnterpriseResourceRelDTO
();
enterpriseResourceRel
.
setEnterpriseId
(
enterpriseId
);
enterpriseResourceRel
.
setResourceCode
(
res
.
getResourceCode
());
enterpriseResourceRel
.
setResourceName
(
res
.
getResourceName
());
enterpriseResourceRel
.
setResourceSwitch
(
res
.
getResourceSwitch
());
enterpriseResourceRelService
.
saveResource
(
enterpriseResourceRel
);
}
}
//商户初始化配置信息生成
enterpriseInitService
.
initEnterpriseConfigInfo
(
enterpriseId
);
...
...
@@ -164,10 +202,17 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
if
(
tabEnterprise
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID错误,查询不到数据"
);
}
EnterpriseDTO
dto
=
new
EnterpriseDTO
();
dto
.
setEnterpriseId
(
enterpriseId
);
dto
.
setGoodsResource
(
Integer
.
parseInt
(
resources
));
enterpriseService
.
editEnterprise
(
dto
);
LOGGER
.
info
(
"编辑资源数据:{}"
,
resources
);
List
<
EnterpriseResourceRelDTO
>
list
=
JSON
.
parseArray
(
resources
,
EnterpriseResourceRelDTO
.
class
);
for
(
EnterpriseResourceRelDTO
res
:
list
)
{
enterpriseResourceRelService
.
deleteResource
(
enterpriseId
,
res
.
getResourceCode
());
EnterpriseResourceRelDTO
enterpriseResourceRel
=
new
EnterpriseResourceRelDTO
();
enterpriseResourceRel
.
setEnterpriseId
(
enterpriseId
);
enterpriseResourceRel
.
setResourceCode
(
res
.
getResourceCode
());
enterpriseResourceRel
.
setResourceName
(
res
.
getResourceName
());
enterpriseResourceRel
.
setResourceSwitch
(
res
.
getResourceSwitch
());
enterpriseResourceRelService
.
saveResource
(
enterpriseResourceRel
);
}
return
ServiceResponse
.
success
(
tabEnterprise
.
getEnterpriseName
());
}
...
...
@@ -216,6 +261,32 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
}
@Override
public
ServiceResponse
<
List
<
EnterpriseResourceRelDTO
>>
getBusinessFrontRes
(
Integer
enterpriseId
)
{
List
<
TabEnterpriseResourceRel
>
list
=
enterpriseResourceRelService
.
getByEnterpriseId
(
enterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
EnterpriseResourceRelDTO
.
class
,
list
));
}
else
{
ServiceResponse
<
List
<
BusinessFrontResDTO
>>
businessFrontResListResult
=
businessFrontResApiService
.
listGroupResourceCode
();
if
(
businessFrontResListResult
.
isSuccess
())
{
List
<
BusinessFrontResDTO
>
resourceList
=
businessFrontResListResult
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
resourceList
))
{
List
<
EnterpriseResourceRelDTO
>
result
=
new
ArrayList
<>(
resourceList
.
size
());
for
(
BusinessFrontResDTO
res
:
resourceList
)
{
EnterpriseResourceRelDTO
temp
=
new
EnterpriseResourceRelDTO
();
temp
.
setResourceSwitch
(
0
);
temp
.
setResourceName
(
res
.
getResourceName
());
temp
.
setResourceCode
(
res
.
getResourceCode
());
result
.
add
(
temp
);
}
return
ServiceResponse
.
success
(
result
);
}
}
return
ServiceResponse
.
success
(
Collections
.
emptyList
());
}
}
@Override
public
ServiceResponse
disableEnterprise
(
Integer
enterpriseId
)
{
TabEnterprise
tabEnterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
tabEnterprise
==
null
)
{
...
...
@@ -293,7 +364,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
@Override
public
ServiceResponse
<
List
<
EnterpriseDTO
>>
listEnterpriseByPhoneNumber
(
String
phoneNumber
)
{
ServiceResponse
<
List
<
UserDTO
>>
listServiceResponse
=
this
.
userApiService
.
listUserByPhoneNumber
(
phoneNumber
,
Constants
.
NATION_CODE
);
ServiceResponse
<
List
<
UserDTO
>>
listServiceResponse
=
this
.
userApiService
.
listUserByPhoneNumber
(
phoneNumber
,
Constants
.
NATION_CODE
);
if
(
listServiceResponse
.
isSuccess
())
{
List
<
UserDTO
>
result
=
listServiceResponse
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
result
))
{
...
...
@@ -324,7 +396,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
List
<
com
.
gic
.
enterprise
.
dto
.
market
.
OrderBuyLicenseDTO
>
orderBuyLicenseDTOList
=
basicParams
.
getLicenseList
();
List
<
OrderBuyLicenseDTO
>
licenseListParams
=
EntityUtil
.
changeEntityListNew
(
OrderBuyLicenseDTO
.
class
,
orderBuyLicenseDTOList
);
if
(
basicParams
.
getOrderType
()
!=
null
&&
basicParams
.
getOrderType
().
intValue
()
==
4
&&
CollectionUtils
.
isEmpty
(
licenseListParams
))
{
if
(
basicParams
.
getOrderType
()
!=
null
&&
basicParams
.
getOrderType
().
intValue
()
==
4
&&
CollectionUtils
.
isEmpty
(
licenseListParams
))
{
//扩容
if
(!
basicParams
.
isCommitFlag
())
{
//获取基本数据信息
...
...
gic-platform-enterprise-service/src/main/resources/mapper/TabEnterpriseResourceRelMapper.xml
0 → 100644
View file @
7aa843f2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.gic.enterprise.dao.mapper.TabEnterpriseResourceRelMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.enterprise.entity.TabEnterpriseResourceRel"
>
<id
column=
"enterprise_resource_id"
jdbcType=
"INTEGER"
property=
"enterpriseResourceId"
/>
<result
column=
"resource_code"
jdbcType=
"VARCHAR"
property=
"resourceCode"
/>
<result
column=
"resource_name"
jdbcType=
"VARCHAR"
property=
"resourceName"
/>
<result
column=
"enterprise_id"
jdbcType=
"INTEGER"
property=
"enterpriseId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"resource_switch"
jdbcType=
"INTEGER"
property=
"resourceSwitch"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
enterprise_resource_id, resource_code, resource_name, enterprise_id, status, create_time,
update_time, resource_switch
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_enterprise_resource_rel
where enterprise_resource_id = #{enterpriseResourceId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from tab_enterprise_resource_rel
where enterprise_resource_id = #{enterpriseResourceId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.enterprise.entity.TabEnterpriseResourceRel"
>
insert into tab_enterprise_resource_rel (enterprise_resource_id, resource_code,
resource_name, enterprise_id, status,
create_time, update_time, resource_switch
)
values (#{enterpriseResourceId,jdbcType=INTEGER}, #{resourceCode,jdbcType=VARCHAR},
#{resourceName,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{resourceSwitch,jdbcType=INTEGER}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.enterprise.entity.TabEnterpriseResourceRel"
>
insert into tab_enterprise_resource_rel
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"enterpriseResourceId != null"
>
enterprise_resource_id,
</if>
<if
test=
"resourceCode != null"
>
resource_code,
</if>
<if
test=
"resourceName != null"
>
resource_name,
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"resourceSwitch != null"
>
resource_switch,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"enterpriseResourceId != null"
>
#{enterpriseResourceId,jdbcType=INTEGER},
</if>
<if
test=
"resourceCode != null"
>
#{resourceCode,jdbcType=VARCHAR},
</if>
<if
test=
"resourceName != null"
>
#{resourceName,jdbcType=VARCHAR},
</if>
<if
test=
"enterpriseId != null"
>
#{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"resourceSwitch != null"
>
#{resourceSwitch,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.enterprise.entity.TabEnterpriseResourceRel"
>
update tab_enterprise_resource_rel
<set>
<if
test=
"resourceCode != null"
>
resource_code = #{resourceCode,jdbcType=VARCHAR},
</if>
<if
test=
"resourceName != null"
>
resource_name = #{resourceName,jdbcType=VARCHAR},
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
status = #{status,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=
"resourceSwitch != null"
>
resource_switch = #{resourceSwitch,jdbcType=INTEGER},
</if>
</set>
where enterprise_resource_id = #{enterpriseResourceId,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.enterprise.entity.TabEnterpriseResourceRel"
>
update tab_enterprise_resource_rel
set resource_code = #{resourceCode,jdbcType=VARCHAR},
resource_name = #{resourceName,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
resource_switch = #{resourceSwitch,jdbcType=INTEGER}
where enterprise_resource_id = #{enterpriseResourceId,jdbcType=INTEGER}
</update>
<update
id=
"deleteResource"
>
update tab_enterprise_resource_rel set status = 0
where status = 1
and enterprise_id = #{enterpriseId}
and resource_code = {resourceCode}
</update>
<select
id=
"getByEnterpriseId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
></include>
from tab_enterprise_resource_rel
where status = 1
and enterprise_id = #{enterpriseId}
</select>
</mapper>
\ No newline at end of file
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/EnterpriseController.java
View file @
7aa843f2
...
...
@@ -14,6 +14,7 @@ import com.gic.enterprise.service.EnterpriseApiService;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
com.gic.enterprise.utils.UserDetail
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
com.gic.enterprise.web.vo.EnterpriseResourceRelVO
;
import
com.gic.enterprise.web.vo.EnterpriseVO
;
import
com.gic.enterprise.web.vo.HomePageEnterpriseInfoVO
;
import
com.gic.marketing.api.dto.sms.EnterpriseSmsSignDTO
;
...
...
@@ -36,10 +37,10 @@ public class EnterpriseController {
private
BillingAccountApiService
billingAccountApiService
;
@RequestMapping
(
"get-enterprise-by-name"
)
public
RestResponse
getEnterpriseByName
(
String
enterpriseName
){
if
(
StringUtils
.
isNotBlank
(
enterpriseName
))
{
public
RestResponse
getEnterpriseByName
(
String
enterpriseName
)
{
if
(
StringUtils
.
isNotBlank
(
enterpriseName
))
{
ServiceResponse
<
EnterpriseDTO
>
enterprise
=
this
.
enterpriseApiService
.
getEnterpriseByName
(
enterpriseName
);
if
(
enterprise
.
isSuccess
())
{
if
(
enterprise
.
isSuccess
())
{
return
RestResponse
.
success
(
enterprise
.
getResult
());
}
}
...
...
@@ -56,7 +57,8 @@ public class EnterpriseController {
enterpriseVO
.
setUser
(
user
.
getResult
());
ServiceResponse
<
SmsApplicationDTO
>
enterpriseSmsApp
=
smsOuterApiService
.
getEnterpriseSmsApp
(
enterpriseId
);
enterpriseVO
.
setSmsApplication
(
enterpriseSmsApp
.
getResult
());
ServiceResponse
<
Page
<
EnterpriseSmsSignDTO
>>
serviceResponse
=
smsOuterApiService
.
listSmsSignByEid
(
enterpriseId
,
new
Page
<>(
1
,
Integer
.
MAX_VALUE
));
ServiceResponse
<
Page
<
EnterpriseSmsSignDTO
>>
serviceResponse
=
smsOuterApiService
.
listSmsSignByEid
(
enterpriseId
,
new
Page
<>(
1
,
Integer
.
MAX_VALUE
));
enterpriseVO
.
setSmsSignList
(
serviceResponse
.
getResult
().
getResult
());
return
RestResponse
.
success
(
enterpriseVO
);
}
...
...
@@ -64,11 +66,13 @@ public class EnterpriseController {
@RequestMapping
(
"/get-enterprise-info"
)
public
RestResponse
getEnterpriseInfo
()
{
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
return
ResultControllerUtils
.
commonResult
(
this
.
enterpriseApiService
.
getEnterpriseById
(
enterpriseId
));
return
ResultControllerUtils
.
commonResult
(
this
.
enterpriseApiService
.
getBusinessFrontRes
(
enterpriseId
),
EnterpriseResourceRelVO
.
class
);
}
@RequestMapping
(
"/update-enterprise"
)
public
RestResponse
updateEnterprise
(
String
enterpriseName
,
String
companyName
,
String
areaId
,
String
address
,
String
logo
)
{
public
RestResponse
updateEnterprise
(
String
enterpriseName
,
String
companyName
,
String
areaId
,
String
address
,
String
logo
)
{
EnterpriseDTO
enterpriseDTO
=
new
EnterpriseDTO
();
enterpriseDTO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
enterpriseDTO
.
setEnterpriseName
(
enterpriseName
);
...
...
@@ -83,9 +87,11 @@ public class EnterpriseController {
@RequestMapping
(
"home-page-enterprise-info"
)
public
RestResponse
getHomePageEnterpriseInfo
()
{
UserDetail
userDetail
=
UserDetailUtils
.
getUserDetail
();
ServiceResponse
<
BillingAccountDTO
>
result
=
billingAccountApiService
.
getByEnterpriseId
(
userDetail
.
getEnterpriseId
());
ServiceResponse
<
BillingAccountDTO
>
result
=
billingAccountApiService
.
getByEnterpriseId
(
userDetail
.
getEnterpriseId
());
if
(
result
.
isSuccess
())
{
HomePageEnterpriseInfoVO
vo
=
EntityUtil
.
changeEntityNew
(
HomePageEnterpriseInfoVO
.
class
,
userDetail
.
getEnterpriseInfo
());
HomePageEnterpriseInfoVO
vo
=
EntityUtil
.
changeEntityNew
(
HomePageEnterpriseInfoVO
.
class
,
userDetail
.
getEnterpriseInfo
());
vo
.
setAccountBalance
(
result
.
getResult
().
getAccountBalance
());
return
RestResponse
.
success
(
vo
);
}
...
...
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/vo/EnterpriseResourceRelVO.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
enterprise
.
web
.
vo
;
import
java.io.Serializable
;
public
class
EnterpriseResourceRelVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5487780284908775239L
;
/**
* 前置资源code
*/
private
String
resourceCode
;
/**
* 前置资源名称
*/
private
String
resourceName
;
/**
* 是否拥有权限,1:有 0:无
*/
private
Integer
resourceSwitch
;
public
String
getResourceCode
()
{
return
resourceCode
;
}
public
void
setResourceCode
(
String
resourceCode
)
{
this
.
resourceCode
=
resourceCode
;
}
public
String
getResourceName
()
{
return
resourceName
;
}
public
void
setResourceName
(
String
resourceName
)
{
this
.
resourceName
=
resourceName
;
}
public
Integer
getResourceSwitch
()
{
return
resourceSwitch
;
}
public
void
setResourceSwitch
(
Integer
resourceSwitch
)
{
this
.
resourceSwitch
=
resourceSwitch
;
}
}
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/EnterpriseController.java
View file @
7aa843f2
...
...
@@ -7,6 +7,7 @@ import java.util.List;
import
java.util.Map
;
import
com.gic.auth.constant.UserConstants
;
import
com.gic.enterprise.dto.EnterpriseResourceRelDTO
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.utils.AutoCreatePasswordUtils
;
import
com.gic.enterprise.utils.UserDetailUtils
;
...
...
@@ -104,7 +105,11 @@ public class EnterpriseController {
@RequestMapping
(
"/save-enterprise"
)
public
RestResponse
saveEnterprise
(
@Validated
({
EnterpriseDTO
.
SaveEnterpriseValid
.
class
})
EnterpriseDTO
enterpriseDTO
,
@Validated
({
UserDTO
.
UserQoValid
.
class
})
UserDTO
userDTO
)
{
@Validated
({
UserDTO
.
UserQoValid
.
class
})
UserDTO
userDTO
,
String
resourceJson
)
{
//前置资源解析
if
(
StringUtils
.
isNotBlank
(
resourceJson
))
{
enterpriseDTO
.
setResourcesList
(
JSON
.
parseArray
(
resourceJson
,
EnterpriseResourceRelDTO
.
class
));
}
//处理密码
String
password
=
UserPasswordUtil
.
validPassword
(
userDTO
.
getPasswordType
(),
userDTO
.
getPassword
(),
userDTO
.
getConfirmPassword
());
...
...
@@ -195,6 +200,9 @@ public class EnterpriseController {
@RequestMapping
(
"/edit-resource-switch"
)
public
RestResponse
editResourceSwitch
(
Integer
enterpriseId
,
String
resources
)
{
if
(
StringUtils
.
isBlank
(
resources
))
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"资源配置不能为空"
);
}
return
ResultControllerUtils
.
commonResult
(
enterpriseApiService
.
editResourceSwitch
(
enterpriseId
,
resources
));
}
...
...
@@ -234,11 +242,9 @@ public class EnterpriseController {
}
else
{
LOGGER
.
warn
(
enterpriseResult
.
getMessage
());
}
String
[]
smsArr
=
new
String
[]
{
enterpriseName
,
userDTO
.
getPhoneNumber
(),
autoPassword
};
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICpassword001"
,
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
String
[]
smsArr
=
new
String
[]
{
enterpriseName
,
userDTO
.
getPhoneNumber
(),
autoPassword
};
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICpassword001"
,
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
}
...
...
@@ -288,6 +294,16 @@ public class EnterpriseController {
//商户信息
EnterpriseDTO
enterpriseDTO
=
enterpriseResult
.
getResult
();
EnterpriseInfo
enterpriseInfo
=
EntityUtil
.
changeEntityNew
(
EnterpriseInfo
.
class
,
enterpriseDTO
);
//商户前置资源
ServiceResponse
<
List
<
EnterpriseResourceRelDTO
>>
resourceResult
=
enterpriseApiService
.
getBusinessFrontRes
(
enterpriseId
);
if
(
resourceResult
.
isSuccess
())
{
List
<
EnterpriseResourceRelDTO
>
resourceList
=
resourceResult
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
resourceList
))
{
enterpriseInfo
.
setResourceList
(
EntityUtil
.
changeEntityListNew
(
EnterpriseResourceRelVO
.
class
,
resourceList
));
}
}
ServiceResponse
<
ApplicationTokenDTO
>
result
=
appTokenApiService
.
getGicEnterpriseBaseApp
(
Long
.
valueOf
(
enterpriseId
));
...
...
gic-platform-operation-web/src/main/java/com/gic/operation/web/vo/enterprise/EnterpriseInfo.java
View file @
7aa843f2
...
...
@@ -2,6 +2,7 @@ package com.gic.operation.web.vo.enterprise;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
public
class
EnterpriseInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3884124549083437916L
;
...
...
@@ -43,6 +44,8 @@ public class EnterpriseInfo implements Serializable{
*/
private
Integer
goodsResource
;
private
List
<
EnterpriseResourceRelVO
>
resourceList
;
public
String
getEnterpriseName
()
{
return
enterpriseName
;
...
...
@@ -131,4 +134,12 @@ public class EnterpriseInfo implements Serializable{
public
void
setGoodsResource
(
Integer
goodsResource
)
{
this
.
goodsResource
=
goodsResource
;
}
public
List
<
EnterpriseResourceRelVO
>
getResourceList
()
{
return
resourceList
;
}
public
void
setResourceList
(
List
<
EnterpriseResourceRelVO
>
resourceList
)
{
this
.
resourceList
=
resourceList
;
}
}
gic-platform-operation-web/src/main/java/com/gic/operation/web/vo/enterprise/EnterpriseResourceRelVO.java
0 → 100644
View file @
7aa843f2
package
com
.
gic
.
operation
.
web
.
vo
.
enterprise
;
import
java.io.Serializable
;
public
class
EnterpriseResourceRelVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
198779764454300701L
;
/**
* 前置资源code
*/
private
String
resourceCode
;
/**
* 前置资源名称
*/
private
String
resourceName
;
/**
* 是否拥有权限,1:有 0:无
*/
private
Integer
resourceSwitch
;
public
String
getResourceCode
()
{
return
resourceCode
;
}
public
void
setResourceCode
(
String
resourceCode
)
{
this
.
resourceCode
=
resourceCode
;
}
public
String
getResourceName
()
{
return
resourceName
;
}
public
void
setResourceName
(
String
resourceName
)
{
this
.
resourceName
=
resourceName
;
}
public
Integer
getResourceSwitch
()
{
return
resourceSwitch
;
}
public
void
setResourceSwitch
(
Integer
resourceSwitch
)
{
this
.
resourceSwitch
=
resourceSwitch
;
}
}
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