Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
fangxinjiang
yifu-mvp
Commits
e00c6397
Commit
e00c6397
authored
Jan 04, 2023
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
B端服务添加:字典区域调整
parent
73700e94
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
843 additions
and
32 deletions
+843
-32
BusFileVo.java
...in/java/com/yifu/cloud/plus/v1/business/vo/BusFileVo.java
+26
-0
SysBusDictController.java
...s/v1/business/controller/system/SysBusDictController.java
+112
-0
TBusAttaInfoController.java
...v1/business/controller/system/TBusAttaInfoController.java
+57
-0
SysBusDictMapper.java
...loud/plus/v1/business/mapper/system/SysBusDictMapper.java
+25
-0
TBusAttaInfoMapper.java
...ud/plus/v1/business/mapper/system/TBusAttaInfoMapper.java
+27
-0
SysBusDictServiceImpl.java
.../plus/v1/business/service/impl/SysBusDictServiceImpl.java
+77
-0
TBusAttaInfoServiceImpl.java
...lus/v1/business/service/impl/TBusAttaInfoServiceImpl.java
+164
-0
SysBusDictService.java
...ud/plus/v1/business/service/system/SysBusDictService.java
+36
-0
TBusAttaInfoService.java
.../plus/v1/business/service/system/TBusAttaInfoService.java
+47
-0
SysBusDictMapper.xml
...siness-biz/src/main/resources/mapper/SysBusDictMapper.xml
+47
-0
TBusAttaInfoMapper.xml
...ness-biz/src/main/resources/mapper/TBusAttaInfoMapper.xml
+72
-0
SysArea.java
...com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysArea.java
+2
-1
AreaVo.java
...java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/AreaVo.java
+25
-26
AreaController.java
...u/cloud/plus/v1/yifu/admin/controller/AreaController.java
+38
-4
SysAreaMapper.java
...m/yifu/cloud/plus/v1/yifu/admin/mapper/SysAreaMapper.java
+4
-0
SysAreaService.java
...yifu/cloud/plus/v1/yifu/admin/service/SysAreaService.java
+4
-0
SysAreaServiceImpl.java
...d/plus/v1/yifu/admin/service/impl/SysAreaServiceImpl.java
+69
-0
SysAreaMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysAreaMapper.xml
+11
-1
No files found.
yifu-business/yifu-business-api/src/main/java/com/yifu/cloud/plus/v1/business/vo/BusFileVo.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @description: 前端要求返回结构
* @author: hgw
* @create: 2021-8-12 17:02:43
**/
@Data
public
class
BusFileVo
implements
Serializable
{
private
String
uid
;
private
String
name
;
private
String
status
;
private
String
url
;
protected
String
type
;
public
BusFileVo
(
String
uid
,
String
name
,
String
url
)
{
this
.
uid
=
uid
;
this
.
name
=
name
;
this
.
status
=
"done"
;
this
.
url
=
url
;
}
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/controller/system/SysBusDictController.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
controller
.
system
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.business.entity.system.SysBusDict
;
import
com.yifu.cloud.plus.v1.business.service.system.SysBusDictService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.AllArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.Map
;
/**
* @author fxj
* @date 2021-08-18 14:51:15
*/
@RestController
@AllArgsConstructor
@RequestMapping
(
"/sysbusdict"
)
@Tag
(
name
=
"B端字典数据表"
)
public
class
SysBusDictController
{
private
final
SysBusDictService
sysBusDictService
;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysBusDict
* @return
*/
@Operation
(
description
=
"简单分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
SysBusDict
>>
getSysBusDictPage
(
Page
<
SysBusDict
>
page
,
SysBusDict
sysBusDict
)
{
return
new
R
<>(
sysBusDictService
.
getSysBusDictPage
(
page
,
sysBusDict
));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation
(
description
=
"id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
SysBusDict
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
new
R
<>(
sysBusDictService
.
getById
(
id
));
}
/**
* 新增记录
*
* @param sysBusDict
* @return R
*/
@Operation
(
description
=
"新增(yifu-hro-business:sysbusdict_add)"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('yifu-hro-business:sysbusdict_add')"
)
public
R
<
Boolean
>
save
(
@Valid
@RequestBody
SysBusDict
sysBusDict
)
{
return
new
R
<>(
sysBusDictService
.
save
(
sysBusDict
));
}
/**
* 修改记录
*
* @param sysBusDict
* @return R
*/
@Operation
(
description
=
"修改(yifu-hro-business:sysbusdict_edit)"
)
@SysLog
(
"修改"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('yifu-hro-business:sysbusdict_edit')"
)
public
R
<
Boolean
>
update
(
@RequestBody
SysBusDict
sysBusDict
)
{
return
new
R
<>(
sysBusDictService
.
updateById
(
sysBusDict
));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation
(
description
=
"删除(yifu-hro-business:sysbusdict_del)"
)
@SysLog
(
"删除"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('yifu-hro-business:sysbusdict_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
new
R
<>(
sysBusDictService
.
removeById
(
id
));
}
/**
* 获取字典map
* @param type type:0(key=value value=label) 1(key=lable value=value)
* @date 2021-08-24
* @author fxj
* @return
*/
@Operation
(
description
=
"B端字典表:返回 map 参数:type:0(key=value value=label) 1(key=lable value=value)"
)
@GetMapping
(
"/getBusiDicMap"
)
public
R
<
Map
<
String
,
String
>>
getBusiDicMap
(
@RequestParam
(
value
=
"type"
,
required
=
true
)
String
type
,
@RequestParam
(
value
=
"itemType"
,
required
=
true
)
String
itemType
)
{
return
sysBusDictService
.
getBusiDicMap
(
type
,
itemType
);
}
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/controller/system/TBusAttaInfoController.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
controller
.
system
;
import
com.yifu.cloud.plus.v1.business.entity.system.TBusAttaInfo
;
import
com.yifu.cloud.plus.v1.business.service.system.TBusAttaInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.AllArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* B端附件表
*
* @author hgw
* @date 2021-08-12 16:38:51
*/
@RestController
@AllArgsConstructor
@RequestMapping
(
"/tbusattainfo"
)
@Tag
(
name
=
"B端附件表"
)
public
class
TBusAttaInfoController
{
private
final
TBusAttaInfoService
tBusAttaInfoService
;
/**
* 获取附件list,一般传参relationId即可
*
* @param tBusAttaInfo B端附件表
* @return
*/
@Operation
(
description
=
"获取附件list,一般传参relationId即可"
)
@GetMapping
(
"/getBusAttaList"
)
public
R
<
List
<
TBusAttaInfo
>>
getBusAttaList
(
TBusAttaInfo
tBusAttaInfo
)
{
return
new
R
<>(
tBusAttaInfoService
.
getBusAttaList
(
tBusAttaInfo
));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation
(
description
=
"id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
TBusAttaInfo
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
new
R
<>(
tBusAttaInfoService
.
getUrlByid
(
id
));
}
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/mapper/system/SysBusDictMapper.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
mapper
.
system
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.business.entity.system.SysBusDict
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author fxj
* @date 2021-08-18 14:51:15
*/
@Mapper
public
interface
SysBusDictMapper
extends
BaseMapper
<
SysBusDict
>
{
/**
* 简单分页查询
*
* @param sysBusDict
* @return
*/
IPage
<
SysBusDict
>
getSysBusDictPage
(
Page
<
SysBusDict
>
page
,
@Param
(
"sysBusDict"
)
SysBusDict
sysBusDict
);
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/mapper/system/TBusAttaInfoMapper.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
mapper
.
system
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.business.entity.system.TBusAttaInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* B端附件表
*
* @author hgw
* @date 2021-08-12 16:38:51
*/
@Mapper
public
interface
TBusAttaInfoMapper
extends
BaseMapper
<
TBusAttaInfo
>
{
/**
* B端附件表简单分页查询
*
* @param tBusAttaInfo B端附件表
* @return
*/
List
<
TBusAttaInfo
>
getBusAttaList
(
@Param
(
"tBusAttaInfo"
)
TBusAttaInfo
tBusAttaInfo
);
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/service/impl/SysBusDictServiceImpl.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.business.entity.system.SysBusDict
;
import
com.yifu.cloud.plus.v1.business.mapper.system.SysBusDictMapper
;
import
com.yifu.cloud.plus.v1.business.service.system.SysBusDictService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author fxj
* @date 2021-08-18 14:51:15
*/
@Service
public
class
SysBusDictServiceImpl
extends
ServiceImpl
<
SysBusDictMapper
,
SysBusDict
>
implements
SysBusDictService
{
/**
* 简单分页查询
*
* @param sysBusDict
* @return
*/
@Override
public
IPage
<
SysBusDict
>
getSysBusDictPage
(
Page
<
SysBusDict
>
page
,
SysBusDict
sysBusDict
)
{
return
baseMapper
.
getSysBusDictPage
(
page
,
sysBusDict
);
}
/**
* 获取字典的MAP 数据
* @param itemType
* @param type 0 key = value 1 key = label
* @return
*/
@Override
public
Map
<
String
,
SysBusDict
>
getSysBusDictByItemType
(
String
itemType
,
String
type
)
{
Map
<
String
,
SysBusDict
>
busDictMap
=
new
HashMap
<>();
List
<
SysBusDict
>
dicts
=
baseMapper
.
selectList
(
Wrappers
.<
SysBusDict
>
query
()
.
lambda
().
eq
(
SysBusDict:
:
getItemType
,
itemType
));
if
(
Common
.
isNotNull
(
dicts
)){
for
(
SysBusDict
dict:
dicts
){
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
type
)){
busDictMap
.
put
(
dict
.
getValue
(),
dict
);
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
type
)){
busDictMap
.
put
(
dict
.
getLabel
(),
dict
);
}
}
}
return
busDictMap
;
}
@Override
public
R
<
Map
<
String
,
String
>>
getBusiDicMap
(
String
type
,
String
itemType
)
{
Map
<
String
,
String
>
dictMap
=
new
HashMap
<>();
List
<
SysBusDict
>
dicts
=
baseMapper
.
selectList
(
Wrappers
.<
SysBusDict
>
query
()
.
lambda
().
eq
(
SysBusDict:
:
getItemType
,
itemType
));
if
(
Common
.
isNotNull
(
dicts
)){
for
(
SysBusDict
dict:
dicts
){
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
type
)){
dictMap
.
put
(
dict
.
getValue
(),
dict
.
getLabel
());
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
type
)){
dictMap
.
put
(
dict
.
getLabel
(),
dict
.
getValue
());
}
}
}
return
R
.
ok
(
dictMap
,
CommonConstants
.
RESULT_DATA_SUCESS
);
}
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/service/impl/TBusAttaInfoServiceImpl.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.business.entity.system.TBusAttaInfo
;
import
com.yifu.cloud.plus.v1.business.mapper.system.TBusAttaInfoMapper
;
import
com.yifu.cloud.plus.v1.business.service.system.TBusAttaInfoService
;
import
com.yifu.cloud.plus.v1.business.vo.BusFileVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* B端附件表
*
* @author hgw
* @date 2021-08-12 16:38:51
*/
@Slf4j
@Service
public
class
TBusAttaInfoServiceImpl
extends
ServiceImpl
<
TBusAttaInfoMapper
,
TBusAttaInfo
>
implements
TBusAttaInfoService
{
@Autowired
private
OSSUtil
ossUtil
;
/**
* B端附件表简单分页查询
*
* @param tBusAttaInfo B端附件表
* @return list,含url
*/
@Override
public
List
<
TBusAttaInfo
>
getBusAttaList
(
TBusAttaInfo
tBusAttaInfo
)
{
List
<
TBusAttaInfo
>
list
=
baseMapper
.
getBusAttaList
(
tBusAttaInfo
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
for
(
TBusAttaInfo
info
:
list
)
{
this
.
setOssSrc
(
info
);
}
}
return
list
;
}
@Override
public
R
<
BusFileVo
>
uploadFile
(
@RequestBody
MultipartFile
file
,
String
filePath
,
Integer
type
,
String
domain
)
throws
IOException
{
if
(
null
==
file
)
{
return
R
.
failed
(
"文件异常,请重新上传!"
);
}
String
fileName
=
file
.
getOriginalFilename
();
if
(
Common
.
isEmpty
(
fileName
))
{
return
R
.
failed
(
"文件名不能为空!"
);
}
if
(
fileName
.
length
()
>
50
)
{
return
R
.
failed
(
"文件名不能超过50个字符!"
);
}
//filePath不传默认存储空间的根目录
//jpg,jpeg,png,bmp
String
key
;
if
(
Common
.
isNotNull
(
filePath
))
{
key
=
filePath
+
"/"
+
System
.
currentTimeMillis
()
+
fileName
;
}
else
{
key
=
System
.
currentTimeMillis
()
+
fileName
;
}
if
(!
Common
.
checkFile
(
key
))
{
return
R
.
failed
(
"非法上传类型!"
);
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
file
.
getInputStream
(),
key
,
null
);
BusFileVo
fileVo
;
TBusAttaInfo
busAtta
;
URL
url
;
if
(
flag
)
{
log
.
info
(
"文件:"
+
fileName
+
"上传至存储空间"
+
ossUtil
.
getBucketName
()
+
"成功!"
);
if
(
null
!=
type
)
{
busAtta
=
this
.
initTBusAttaInfo
(
fileName
,
key
,
file
.
getSize
(),
type
,
domain
);
try
{
this
.
save
(
busAtta
);
}
catch
(
Exception
e
)
{
log
.
error
(
"上传保存文件失败:"
+
e
.
getMessage
());
ossUtil
.
deleteObject
(
null
,
key
);
return
R
.
failed
(
"上传保存文件失败:"
+
e
.
getMessage
());
}
url
=
ossUtil
.
getObjectUrl
(
null
,
busAtta
.
getAttaSrc
());
fileVo
=
new
BusFileVo
(
busAtta
.
getId
(),
busAtta
.
getAttaName
(),
url
.
toString
().
replace
(
"http"
,
"https"
));
return
R
.
ok
(
fileVo
,
"success"
);
}
else
{
return
R
.
failed
(
"类型不可为空!"
);
}
}
else
{
return
R
.
failed
(
"fail:上传失败"
);
}
}
/**
* @Description: 初始化附件表
* @Author: hgw
* @Date: 2021/8/12 17:52
* @return: com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusAttaInfo
**/
private
TBusAttaInfo
initTBusAttaInfo
(
String
fileName
,
String
key
,
Long
fileSize
,
Integer
type
,
String
domain
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
TBusAttaInfo
empAtta
=
new
TBusAttaInfo
();
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
empAtta
;
}
char
point
=
'.'
;
char
slash
=
'/'
;
if
(
fileName
.
lastIndexOf
(
slash
)
>=
0
)
{
empAtta
.
setAttaName
(
fileName
.
substring
(
fileName
.
lastIndexOf
(
slash
)));
}
else
{
empAtta
.
setAttaName
(
fileName
);
}
if
(
key
.
lastIndexOf
(
point
)
>=
0
)
{
empAtta
.
setAttaType
(
key
.
substring
(
key
.
lastIndexOf
(
point
)));
}
empAtta
.
setAttaSize
(
fileSize
);
empAtta
.
setAttaSrc
(
key
);
empAtta
.
setCreateTime
(
LocalDateTime
.
now
());
empAtta
.
setCreateUserId
(
String
.
valueOf
(
user
.
getId
()));
empAtta
.
setCreateUserName
(
user
.
getNickname
());
empAtta
.
setRelationType
(
type
);
empAtta
.
setRelationId
(
domain
);
return
empAtta
;
}
/**
* @param id
* @Description: 单个查询url
* @Author: hgw
* @Date: 2021/8/20 14:37
* @return: com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusAttaInfo
**/
@Override
public
TBusAttaInfo
getUrlByid
(
String
id
)
{
TBusAttaInfo
busAtta
=
this
.
getById
(
id
);
if
(
null
!=
busAtta
)
{
this
.
setOssSrc
(
busAtta
);
}
return
busAtta
;
}
/**
* @param busAtta
* @Description: 获取附件的阿里云地址
* @Author: hgw
* @Date: 2021/8/20 14:36
* @return: void
**/
private
void
setOssSrc
(
TBusAttaInfo
busAtta
)
{
URL
url
=
ossUtil
.
getObjectUrl
(
null
,
busAtta
.
getAttaSrc
());
busAtta
.
setAttaSrc
(
url
.
toString
().
replace
(
"http"
,
"https"
));
}
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/service/system/SysBusDictService.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
service
.
system
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.business.entity.system.SysBusDict
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.util.Map
;
/**
* @author fxj
* @date 2021-08-18 14:51:15
*/
public
interface
SysBusDictService
extends
IService
<
SysBusDict
>
{
/**
* 简单分页查询
*
* @param sysBusDict
* @return
*/
IPage
<
SysBusDict
>
getSysBusDictPage
(
Page
<
SysBusDict
>
page
,
SysBusDict
sysBusDict
);
/**
* 获取B端字典数据Map
* @param itemType
* @param type 0 key = value 1 key = label
* @return
*/
Map
<
String
,
SysBusDict
>
getSysBusDictByItemType
(
String
itemType
,
String
type
);
R
<
Map
<
String
,
String
>>
getBusiDicMap
(
String
type
,
String
itemType
);
}
yifu-business/yifu-business-biz/src/main/java/com/yifu/cloud/plus/v1/business/service/system/TBusAttaInfoService.java
0 → 100644
View file @
e00c6397
package
com
.
yifu
.
cloud
.
plus
.
v1
.
business
.
service
.
system
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.business.entity.system.TBusAttaInfo
;
import
com.yifu.cloud.plus.v1.business.vo.BusFileVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.util.List
;
/**
* B端附件表
*
* @author hgw
* @date 2021-08-12 16:38:51
*/
public
interface
TBusAttaInfoService
extends
IService
<
TBusAttaInfo
>
{
/**
* @param tBusAttaInfo B端附件表
* @return list ,返回url
*/
List
<
TBusAttaInfo
>
getBusAttaList
(
TBusAttaInfo
tBusAttaInfo
);
/**
* @param file
* @param filePath
* @param type
* @param domain
* @Description: 附件上传
* @Author: hgw
* @Date: 2021/8/19 9:16
* @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrobusiness.api.dto.system.BusFileVo>
**/
R
<
BusFileVo
>
uploadFile
(
MultipartFile
file
,
String
filePath
,
Integer
type
,
String
domain
)
throws
IOException
;
/**
* @param id
* @Description: 单个查询,返回url
* @Author: hgw
* @Date: 2021/8/20 14:38
* @return: com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusAttaInfo
**/
TBusAttaInfo
getUrlByid
(
String
id
);
}
yifu-business/yifu-business-biz/src/main/resources/mapper/SysBusDictMapper.xml
0 → 100644
View file @
e00c6397
<?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.yifu.cloud.plus.v1.business.mapper.system.SysBusDictMapper"
>
<resultMap
id=
"sysBusDictMap"
type=
"com.yifu.cloud.plus.v1.business.entity.system.SysBusDict"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"label"
column=
"label"
/>
<result
property=
"value"
column=
"value"
/>
<result
property=
"itemType"
column=
"item_type"
/>
<result
property=
"status"
column=
"status"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.id,
a.label,
a.value,
a.item_type,
a.status
</sql>
<sql
id=
"sysBusDict_where"
>
<if
test=
"sysBusDict != null"
>
<if
test=
"sysBusDict.id != null and sysBusDict.id.trim() != ''"
>
AND a.id = #{sysBusDict.id}
</if>
<if
test=
"sysBusDict.label != null and sysBusDict.label.trim() != ''"
>
AND a.label = #{sysBusDict.label}
</if>
<if
test=
"sysBusDict.value != null and sysBusDict.value.trim() != ''"
>
AND a.value = #{sysBusDict.value}
</if>
<if
test=
"sysBusDict.itemType != null and sysBusDict.itemType.trim() != ''"
>
AND a.item_type = #{sysBusDict.itemType}
</if>
<if
test=
"sysBusDict.status != null and sysBusDict.status.trim() != ''"
>
AND a.status = #{sysBusDict.status}
</if>
</if>
</sql>
<!--sysBusDict简单分页查询-->
<select
id=
"getSysBusDictPage"
resultMap=
"sysBusDictMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM sys_bus_dict a
<where>
1=1
<include
refid=
"sysBusDict_where"
/>
</where>
</select>
</mapper>
yifu-business/yifu-business-biz/src/main/resources/mapper/TBusAttaInfoMapper.xml
0 → 100644
View file @
e00c6397
<?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.yifu.cloud.plus.v1.business.mapper.system.TBusAttaInfoMapper"
>
<resultMap
id=
"tBusAttaInfoMap"
type=
"com.yifu.cloud.plus.v1.business.entity.system.TBusAttaInfo"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"attaName"
column=
"atta_name"
/>
<result
property=
"attaSrc"
column=
"atta_src"
/>
<result
property=
"attaSize"
column=
"atta_size"
/>
<result
property=
"attaType"
column=
"atta_type"
/>
<result
property=
"createUserId"
column=
"create_user_id"
/>
<result
property=
"createUserName"
column=
"create_user_name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"relationId"
column=
"relation_id"
/>
<result
property=
"relationType"
column=
"relation_type"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.id,
a.atta_name,
a.atta_src,
a.atta_size,
a.atta_type,
a.create_user_id,
a.create_user_name,
a.create_time,
a.relation_id,
a.relation_type
</sql>
<sql
id=
"tBusAttaInfo_where"
>
<if
test=
"tBusAttaInfo != null"
>
<if
test=
"tBusAttaInfo.id != null and tBusAttaInfo.id.trim() != ''"
>
AND a.id = #{tBusAttaInfo.id}
</if>
<if
test=
"tBusAttaInfo.attaName != null and tBusAttaInfo.attaName.trim() != ''"
>
AND a.atta_name = #{tBusAttaInfo.attaName}
</if>
<if
test=
"tBusAttaInfo.attaSrc != null and tBusAttaInfo.attaSrc.trim() != ''"
>
AND a.atta_src = #{tBusAttaInfo.attaSrc}
</if>
<if
test=
"tBusAttaInfo.attaSize != null"
>
AND a.atta_size = #{tBusAttaInfo.attaSize}
</if>
<if
test=
"tBusAttaInfo.attaType != null and tBusAttaInfo.attaType.trim() != ''"
>
AND a.atta_type = #{tBusAttaInfo.attaType}
</if>
<if
test=
"tBusAttaInfo.createUserId != null and tBusAttaInfo.createUserId.trim() != ''"
>
AND a.create_user_id = #{tBusAttaInfo.createUserId}
</if>
<if
test=
"tBusAttaInfo.createUserName != null and tBusAttaInfo.createUserName.trim() != ''"
>
AND a.create_user_name = #{tBusAttaInfo.createUserName}
</if>
<if
test=
"tBusAttaInfo.createTime != null"
>
AND a.create_time = #{tBusAttaInfo.createTime}
</if>
<if
test=
"tBusAttaInfo.relationId != null and tBusAttaInfo.relationId.trim() != ''"
>
AND a.relation_id = #{tBusAttaInfo.relationId}
</if>
<if
test=
"tBusAttaInfo.relationType != null and tBusAttaInfo.relationType.trim() != ''"
>
AND a.relation_type = #{tBusAttaInfo.relationType}
</if>
</if>
</sql>
<!--list-->
<select
id=
"getBusAttaList"
resultMap=
"tBusAttaInfoMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_bus_atta_info a
<where>
1=1
<include
refid=
"tBusAttaInfo_where"
/>
</where>
</select>
</mapper>
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysArea.java
View file @
e00c6397
...
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
...
...
@@ -14,7 +15,7 @@ import java.time.LocalDateTime;
*/
@Data
@Schema
(
description
=
"区域"
)
public
class
SysArea
{
public
class
SysArea
implements
Serializable
{
private
Integer
id
;
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/AreaVo.java
View file @
e00c6397
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
api
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* @author lengleng
* @date 2020/2/10
*/
@Data
@Schema
(
description
=
"区域Vo"
)
public
class
AreaVo
{
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
AreaVo
extends
SysArea
{
private
static
final
long
serialVersionUID
=
1L
;
private
Integer
id
;
private
String
areaName
;
private
String
areaCode
;
private
Integer
parentId
;
private
LocalDateTime
updateDate
;
private
Integer
status
;
private
Integer
createUser
;
/**
*车牌简称
*/
private
String
areaShort
;
private
List
<
AreaVo
>
children
;
/**
* 角色id
*/
private
List
<
SysArea
>
sysAreaList
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/AreaController.java
View file @
e00c6397
...
...
@@ -27,17 +27,15 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* <p>
...
...
@@ -156,5 +154,41 @@ public class AreaController {
redisUtil
.
set
(
CacheConstants
.
AREA_VALUE_GROUP
,
labelIdMap
);
}
}
/**
* @Author fxj
* @Description 地区map
* @Date 14:56 2023/1/4
* @Param
* @return
**/
@Operation
(
description
=
"地区map"
)
@GetMapping
(
"/getAreaMap"
)
public
R
<
Map
<
Integer
,
SysArea
>>
getAreaMapUpms
()
{
return
new
R
<>(
sysAreaService
.
getSysAreaMap
());
}
/**
* @Author fxj
* @Description 区划树形结构
* @Date 15:09 2023/1/4
* @Param
* @return
**/
@Operation
(
description
=
"区划树形结构"
)
@GetMapping
(
"/tree"
)
public
R
getTree
()
{
return
new
R
<>(
sysAreaService
.
getAreaTree
());
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation
(
description
=
"id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
SysArea
>
getById
(
@PathVariable
(
"id"
)
Integer
id
)
{
return
new
R
<>(
sysAreaService
.
getById
(
id
));
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/mapper/SysAreaMapper.java
View file @
e00c6397
...
...
@@ -18,8 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* <p>
* 区域表 Mapper 接口
...
...
@@ -31,4 +34,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
SysAreaMapper
extends
BaseMapper
<
SysArea
>
{
List
<
AreaVo
>
getVoArea
();
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/SysAreaService.java
View file @
e00c6397
...
...
@@ -17,6 +17,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.util.List
;
...
...
@@ -49,4 +50,7 @@ public interface SysAreaService extends IService<SysArea> {
List
<
SysArea
>
getAllArea
();
Map
<
Integer
,
SysArea
>
getSysAreaMap
();
List
<
AreaVo
>
getAreaTree
();
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysAreaServiceImpl.java
View file @
e00c6397
...
...
@@ -18,13 +18,17 @@ package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.mapper.SysAreaMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ServiceNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -80,5 +84,70 @@ public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> impl
}
}
}
@Override
@Cacheable
(
value
=
ServiceNameConstants
.
UMPS_SERVICE
+
"_permanent"
,
key
=
"#root.targetClass+#root.methodName"
)
public
Map
<
Integer
,
SysArea
>
getSysAreaMap
()
{
List
<
SysArea
>
list
=
this
.
list
();
Map
<
Integer
,
SysArea
>
sysAreaMap
=
null
;
if
(
Common
.
isNotNull
(
list
)){
sysAreaMap
=
new
HashMap
();
for
(
SysArea
area
:
list
){
sysAreaMap
.
put
(
area
.
getId
(),
area
);
}
}
return
sysAreaMap
;
}
@Override
@Cacheable
(
value
=
ServiceNameConstants
.
UMPS_SERVICE
+
"_permanent"
,
key
=
"#root.targetClass+#root.methodName"
)
public
List
<
AreaVo
>
getAreaTree
()
{
List
<
AreaVo
>
pArea
=
new
ArrayList
<>();
List
<
AreaVo
>
list
=
baseMapper
.
getVoArea
();
if
(
Common
.
isNotNull
(
list
))
{
List
<
AreaVo
>
tArea
=
new
ArrayList
<>();
Map
<
Integer
,
AreaVo
>
pMap
=
new
HashMap
<>();
Map
<
Integer
,
AreaVo
>
cAreaMap
=
new
HashMap
<>();
for
(
AreaVo
area
:
list
)
{
if
(
CommonConstants
.
dingleDigitIntArray
[
0
]
==
area
.
getParentId
().
intValue
())
{
pArea
.
add
(
area
);
pMap
.
put
(
area
.
getId
(),
area
);
}
}
list
.
removeAll
(
pArea
);
for
(
AreaVo
area
:
list
)
{
if
(
null
!=
pMap
.
get
(
area
.
getParentId
()))
{
cAreaMap
.
put
(
area
.
getId
(),
area
);
}
else
{
tArea
.
add
(
area
);
}
}
AreaVo
tempArea
=
null
;
List
<
AreaVo
>
tempList
=
null
;
//所有县级节点挂到市级节点上
for
(
AreaVo
area
:
tArea
)
{
tempArea
=
cAreaMap
.
get
(
area
.
getParentId
());
tempList
=
tempArea
.
getChildren
();
if
(
null
==
tempList
)
{
tempList
=
new
ArrayList
<>();
tempList
.
add
(
area
);
tempArea
.
setChildren
(
tempList
);
}
else
{
tempList
.
add
(
area
);
}
}
for
(
AreaVo
area
:
cAreaMap
.
values
())
{
tempArea
=
pMap
.
get
(
area
.
getParentId
());
tempList
=
tempArea
.
getChildren
();
if
(
null
==
tempList
)
{
tempList
=
new
ArrayList
<>();
tempList
.
add
(
area
);
tempArea
.
setChildren
(
tempList
);
}
else
{
tempList
.
add
(
area
);
}
}
}
return
pArea
;
}
}
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysAreaMapper.xml
View file @
e00c6397
...
...
@@ -33,5 +33,15 @@
<result
property=
"createUser"
column=
"CREATE_USER"
/>
<result
property=
"areaShort"
column=
"AREA_SHORT"
/>
</resultMap>
<select
id=
"getVoArea"
resultType=
"com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo"
>
select id,
AREA_NAME,
AREA_CODE,
PARENT_ID,
UPDATE_DATE,
STATUS,
CREATE_USER,
AREA_SHORT
FROM sys_area
</select>
</mapper>
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