Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
15ecb5f8
Commit
15ecb5f8
authored
Apr 30, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wdz' into 'develop'
新增展示所有籍贯接口,删除根据籍贯id显示籍贯名接口 See merge request 8timerv2/8timerapiv200!66
parents
03794abb
cc2988f4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
110 deletions
+108
-110
pom.xml
+1
-1
src/main/java/cn/timer/api/controller/yggl/YgglController.java
+85
-70
src/main/java/cn/timer/api/dto/yggl/YgAreaDto.java
+1
-13
src/main/java/cn/timer/api/dto/yggl/YgCityDto.java
+5
-12
src/main/java/cn/timer/api/dto/yggl/YgProDto.java
+13
-14
src/main/java/cn/timer/api/dto/yggl/YgjgDto.java
+3
-0
No files found.
pom.xml
View file @
15ecb5f8
...
@@ -231,7 +231,7 @@
...
@@ -231,7 +231,7 @@
<dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
4.6.1
</version>
<version>
5.3.2
</version>
</dependency>
</dependency>
<!-- lombok -->
<!-- lombok -->
...
...
src/main/java/cn/timer/api/controller/yggl/YgglController.java
View file @
15ecb5f8
...
@@ -43,6 +43,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -43,6 +43,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.github.pagehelper.util.StringUtil
;
import
com.github.pagehelper.util.StringUtil
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.BetweenFormater.Level
;
import
cn.hutool.core.date.BetweenFormater.Level
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
...
@@ -1608,8 +1610,89 @@ public class YgglController {
...
@@ -1608,8 +1610,89 @@ public class YgglController {
return
ResultUtil
.
data
(
mz
,
"展示该民族"
);
return
ResultUtil
.
data
(
mz
,
"展示该民族"
);
}
}
/**
* 展示籍贯/展示所有籍贯
*
* @param
* @return
*/
@PostMapping
(
value
=
"/jg"
)
@ApiOperation
(
value
=
"展示籍贯所有省市区"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
60
)
public
Result
<
List
<
YgjgDto
>>
selectjgs
(
@CurrentUser
UserBean
userBean
)
{
List
<
YgjgDto
>
oldfather
=
new
ArrayList
<
YgjgDto
>();
//老父亲
List
<
YgProDto
>
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
).
list
();
//super继承人
List
<
YgCityDto
>
city
=
new
LambdaQueryChainWrapper
<
YgCityDto
>(
ygCityDtoMapper
).
list
();
List
<
YgAreaDto
>
area
=
new
LambdaQueryChainWrapper
<
YgAreaDto
>(
ygAreaDtoMapper
).
list
();
for
(
YgProDto
p
:
pro
)
{
Map
<
String
,
Object
>
map
=
BeanUtil
.
beanToMap
(
p
);
//设置别名对应bean
HashMap
<
String
,
String
>
mapping
=
CollUtil
.
newHashMap
();
mapping
.
put
(
"id"
,
"jgid"
);
mapping
.
put
(
"name"
,
"jgname"
);
YgjgDto
ygproDto
=
BeanUtil
.
mapToBean
(
map
,
YgjgDto
.
class
,
CopyOptions
.
create
().
setFieldMapping
(
mapping
));
//添加cityList
//给一个upid
List
<
YgCityDto
>
outcity
=
uptocityList
(
city
,
ygproDto
.
getJgid
());
//新建一个篮子
List
<
YgjgDto
>
cityDtos
=
new
ArrayList
<
YgjgDto
>();
for
(
YgCityDto
c
:
outcity
)
{
Map
<
String
,
Object
>
map2
=
BeanUtil
.
beanToMap
(
c
);
HashMap
<
String
,
String
>
mapping2
=
CollUtil
.
newHashMap
();
mapping2
.
put
(
"id"
,
"jgid"
);
mapping2
.
put
(
"name"
,
"jgname"
);
mapping2
.
put
(
"province"
,
"upid"
);
YgjgDto
ygcityDto
=
BeanUtil
.
mapToBean
(
map2
,
YgjgDto
.
class
,
CopyOptions
.
create
().
setFieldMapping
(
mapping2
));
//把果实收起来
cityDtos
.
add
(
ygcityDto
);
List
<
YgAreaDto
>
outarea
=
uptoareaList
(
area
,
ygcityDto
.
getJgid
());
List
<
YgjgDto
>
areaDtos
=
new
ArrayList
<
YgjgDto
>();
for
(
YgAreaDto
a
:
outarea
)
{
Map
<
String
,
Object
>
map3
=
BeanUtil
.
beanToMap
(
a
);
HashMap
<
String
,
String
>
mapping3
=
CollUtil
.
newHashMap
();
mapping3
.
put
(
"id"
,
"jgid"
);
mapping3
.
put
(
"name"
,
"jgname"
);
mapping3
.
put
(
"city"
,
"upid"
);
YgjgDto
ygjgDto3
=
BeanUtil
.
mapToBean
(
map3
,
YgjgDto
.
class
,
CopyOptions
.
create
().
setFieldMapping
(
mapping3
));
areaDtos
.
add
(
ygjgDto3
);
}
ygcityDto
.
setYgjgDtoList
(
areaDtos
);
areaDtos
.
add
(
ygcityDto
);
}
ygproDto
.
setYgjgDtoList
(
cityDtos
);
oldfather
.
add
(
ygproDto
);
}
return
ResultUtil
.
data
(
oldfather
,
"老父亲出来了"
);
}
//根据上级id抽取出list
public
List
<
YgCityDto
>
uptocityList
(
List
<
YgCityDto
>
city
,
Integer
jgid
)
{
List
<
YgCityDto
>
outcity
=
new
ArrayList
<
YgCityDto
>();
for
(
YgCityDto
c
:
city
)
{
if
(
c
.
getProvince
().
equals
(
jgid
))
{
outcity
.
add
(
c
);
}
}
city
.
removeAll
(
outcity
);
return
outcity
;
}
public
List
<
YgAreaDto
>
uptoareaList
(
List
<
YgAreaDto
>
area
,
Integer
jgid
)
{
List
<
YgAreaDto
>
outarea
=
new
ArrayList
<
YgAreaDto
>();
for
(
YgAreaDto
a
:
area
)
{
if
(
a
.
getCity
().
equals
(
jgid
))
{
outarea
.
add
(
a
);
}
}
area
.
removeAll
(
outarea
);
return
outarea
;
}
/**
/**
...
@@ -1648,74 +1731,6 @@ public class YgglController {
...
@@ -1648,74 +1731,6 @@ public class YgglController {
return
ResultUtil
.
data
(
maps
,
"展示籍贯成功"
);
return
ResultUtil
.
data
(
maps
,
"展示籍贯成功"
);
}
}
/**
* 根据籍贯id显示籍贯名
*
* @param
* @return
*/
@PostMapping
(
value
=
"/jgprint"
)
@ApiOperation
(
value
=
"根据籍贯id显示籍贯城市名"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
61
)
public
Result
<
YgjgDto
>
selectjg
(
@CurrentUser
UserBean
userBean
,
@RequestBody
YgjgDto
jgcity
)
{
Integer
jgid
=
jgcity
.
getJgid
();
Integer
cid
=
jgcity
.
getType
();
if
(
jgid
!=
null
)
{
String
top
=
jgid
.
toString
().
substring
(
0
,
2
);
String
isPro
=
jgid
.
toString
().
substring
(
2
,
4
);
String
isCity
=
jgid
.
toString
().
substring
(
4
,
6
);
if
(
"00"
.
equals
(
isPro
))
{
YgProDto
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getName
).
eq
(
YgProDto:
:
getId
,
jgid
).
one
();
if
(
pro
!=
null
)
jgcity
.
setJgname
(
pro
.
getName
());
}
else
if
(
"00"
.
equals
(
isCity
))
{
YgProDto
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getName
).
eq
(
YgProDto:
:
getProvince
,
top
).
one
();
YgCityDto
city
=
new
LambdaQueryChainWrapper
<
YgCityDto
>(
ygCityDtoMapper
)
.
select
(
YgCityDto:
:
getId
,
YgCityDto:
:
getName
).
eq
(
YgCityDto:
:
getCity
,
jgid
).
one
();
if
(
city
!=
null
)
jgcity
.
setJgname
(
pro
.
getName
()
+
city
.
getName
());
}
YgProDto
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getName
).
eq
(
YgProDto:
:
getProvince
,
top
).
one
();
YgCityDto
city
=
new
LambdaQueryChainWrapper
<
YgCityDto
>(
ygCityDtoMapper
)
.
select
(
YgCityDto:
:
getId
,
YgCityDto:
:
getName
).
eq
(
YgCityDto:
:
getCity
,
Integer
.
parseInt
(
top
+
isPro
))
.
one
();
YgAreaDto
area
=
new
LambdaQueryChainWrapper
<
YgAreaDto
>(
ygAreaDtoMapper
)
.
select
(
YgAreaDto:
:
getId
,
YgAreaDto:
:
getName
).
eq
(
YgAreaDto:
:
getId
,
jgid
).
one
();
if
(
area
!=
null
)
jgcity
.
setJgname
(
pro
.
getName
()
+
city
.
getName
()
+
area
.
getName
());
}
if
(
cid
!=
null
)
{
String
top
=
cid
.
toString
().
substring
(
0
,
2
);
String
isPro
=
cid
.
toString
().
substring
(
2
,
4
);
String
isCity
=
cid
.
toString
().
substring
(
4
,
6
);
if
(
"00"
.
equals
(
isPro
))
{
YgProDto
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getName
).
eq
(
YgProDto:
:
getId
,
cid
).
one
();
if
(
pro
!=
null
)
jgcity
.
setCityname
(
pro
.
getName
());
}
else
if
(
"00"
.
equals
(
isCity
))
{
YgProDto
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getName
).
eq
(
YgProDto:
:
getProvince
,
top
).
one
();
YgCityDto
city
=
new
LambdaQueryChainWrapper
<
YgCityDto
>(
ygCityDtoMapper
)
.
select
(
YgCityDto:
:
getId
,
YgCityDto:
:
getName
).
eq
(
YgCityDto:
:
getCity
,
cid
).
one
();
if
(
city
!=
null
)
jgcity
.
setCityname
(
pro
.
getName
()
+
city
.
getName
());
}
YgProDto
pro
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getName
).
eq
(
YgProDto:
:
getProvince
,
top
).
one
();
YgCityDto
city
=
new
LambdaQueryChainWrapper
<
YgCityDto
>(
ygCityDtoMapper
)
.
select
(
YgCityDto:
:
getId
,
YgCityDto:
:
getName
).
eq
(
YgCityDto:
:
getCity
,
Integer
.
parseInt
(
top
+
isPro
))
.
one
();
YgAreaDto
area
=
new
LambdaQueryChainWrapper
<
YgAreaDto
>(
ygAreaDtoMapper
)
.
select
(
YgAreaDto:
:
getId
,
YgAreaDto:
:
getName
).
eq
(
YgAreaDto:
:
getId
,
cid
).
one
();
if
(
area
!=
null
)
jgcity
.
setCityname
(
pro
.
getName
()
+
city
.
getName
()
+
area
.
getName
());
}
return
ResultUtil
.
data
(
jgcity
);
}
/**
/**
* 查询员工列表
* 查询员工列表
...
...
src/main/java/cn/timer/api/dto/yggl/YgAreaDto.java
View file @
15ecb5f8
...
@@ -32,7 +32,7 @@ import lombok.NoArgsConstructor;
...
@@ -32,7 +32,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@NoArgsConstructor
@TableName
(
"pro_city_area_class"
)
@TableName
(
"pro_city_area_class"
)
@ApiModel
(
"籍贯:地区"
)
@ApiModel
(
"籍贯:地区"
)
public
class
YgAreaDto
implements
IYgjgDto
,
InitializingBean
{
public
class
YgAreaDto
{
@Id
@Id
@GeneratedValue
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@TableId
(
type
=
IdType
.
AUTO
)
...
@@ -48,18 +48,6 @@ public class YgAreaDto implements IYgjgDto,InitializingBean{
...
@@ -48,18 +48,6 @@ public class YgAreaDto implements IYgjgDto,InitializingBean{
@ApiModelProperty
(
value
=
"名字"
,
example
=
"名字"
)
@ApiModelProperty
(
value
=
"名字"
,
example
=
"名字"
)
private
String
name
;
private
String
name
;
@Autowired
private
YgAreaDtoMapper
ygAreaDtoMapper
;
public
List
<
String
>
exePunish
()
{
List
<
YgAreaDto
>
areaList
=
new
LambdaQueryChainWrapper
<
YgAreaDto
>(
ygAreaDtoMapper
).
orderByAsc
(
YgAreaDto:
:
getProvince
).
list
();
List
<
String
>
a
=
new
ArrayList
<
String
>();
for
(
YgAreaDto
area
:
areaList
)
{
a
.
add
(
area
.
getName
());
}
return
a
;
}
public
void
afterPropertiesSet
(){
PunishFactory
.
registerPunish
(
"area"
,
this
);
}
}
}
src/main/java/cn/timer/api/dto/yggl/YgCityDto.java
View file @
15ecb5f8
...
@@ -14,6 +14,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
...
@@ -14,6 +14,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
cn.hutool.core.clone.CloneRuntimeException
;
import
cn.hutool.core.clone.CloneSupport
;
import
cn.timer.api.dao.yggl.YgCityDtoMapper
;
import
cn.timer.api.dao.yggl.YgCityDtoMapper
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -32,7 +34,7 @@ import lombok.NoArgsConstructor;
...
@@ -32,7 +34,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@NoArgsConstructor
@TableName
(
"pro_city_class"
)
@TableName
(
"pro_city_class"
)
@ApiModel
(
"籍贯:城市"
)
@ApiModel
(
"籍贯:城市"
)
public
class
YgCityDto
implements
IYgjgDto
,
InitializingBean
{
public
class
YgCityDto
{
@Id
@Id
@GeneratedValue
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@TableId
(
type
=
IdType
.
AUTO
)
...
@@ -48,18 +50,9 @@ public class YgCityDto implements IYgjgDto,InitializingBean{
...
@@ -48,18 +50,9 @@ public class YgCityDto implements IYgjgDto,InitializingBean{
@ApiModelProperty
(
value
=
"名字"
,
example
=
"名字"
)
@ApiModelProperty
(
value
=
"名字"
,
example
=
"名字"
)
private
String
name
;
private
String
name
;
@Autowired
private
YgCityDtoMapper
ygCityDtoMapper
;
public
List
<
String
>
exePunish
()
{
List
<
YgCityDto
>
cityList
=
new
LambdaQueryChainWrapper
<
YgCityDto
>(
ygCityDtoMapper
).
orderByAsc
(
YgCityDto:
:
getProvince
).
list
();
List
<
String
>
c
=
new
ArrayList
<
String
>();
for
(
YgCityDto
city
:
cityList
)
{
c
.
add
(
city
.
getName
());
}
return
c
;
}
public
void
afterPropertiesSet
(){
PunishFactory
.
registerPunish
(
"city"
,
this
);
}
}
}
src/main/java/cn/timer/api/dto/yggl/YgProDto.java
View file @
15ecb5f8
...
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
...
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
cn.hutool.core.annotation.Alias
;
import
cn.timer.api.dao.yggl.YgProDtoMapper
;
import
cn.timer.api.dao.yggl.YgProDtoMapper
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -32,7 +33,16 @@ import lombok.NoArgsConstructor;
...
@@ -32,7 +33,16 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@NoArgsConstructor
@TableName
(
"province_class"
)
@TableName
(
"province_class"
)
@ApiModel
(
"籍贯:省份"
)
@ApiModel
(
"籍贯:省份"
)
public
class
YgProDto
implements
IYgjgDto
,
InitializingBean
{
public
class
YgProDto
{
/**
* @date 2020年4月29日
* @author 翁东州
* @方法中文名称:
*/
private
static
final
long
serialVersionUID
=
-
4557120773275283842L
;
@Id
@Id
@GeneratedValue
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@TableId
(
type
=
IdType
.
AUTO
)
...
@@ -45,20 +55,9 @@ public class YgProDto implements IYgjgDto,InitializingBean{
...
@@ -45,20 +55,9 @@ public class YgProDto implements IYgjgDto,InitializingBean{
@ApiModelProperty
(
value
=
"名字"
,
example
=
"名字"
)
@ApiModelProperty
(
value
=
"名字"
,
example
=
"名字"
)
private
String
name
;
private
String
name
;
@Autowired
private
YgProDtoMapper
ygProDtoMapper
;
public
List
<
String
>
exePunish
()
{
List
<
YgProDto
>
proList
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
).
orderByAsc
(
YgProDto:
:
getProvince
).
list
();
List
<
String
>
pList
=
new
ArrayList
<
String
>();
for
(
YgProDto
pro
:
proList
)
{
pList
.
add
(
pro
.
getName
());
}
return
pList
;
}
public
void
afterPropertiesSet
(){
System
.
out
.
println
(
"初始化注入成功!"
);
PunishFactory
.
registerPunish
(
"pro"
,
this
);
}
}
}
src/main/java/cn/timer/api/dto/yggl/YgjgDto.java
View file @
15ecb5f8
...
@@ -38,6 +38,9 @@ public class YgjgDto implements Serializable{
...
@@ -38,6 +38,9 @@ public class YgjgDto implements Serializable{
@ApiModelProperty
(
value
=
"省市区籍贯id"
,
example
=
"110000"
)
@ApiModelProperty
(
value
=
"省市区籍贯id"
,
example
=
"110000"
)
private
Integer
jgid
;
private
Integer
jgid
;
@ApiModelProperty
(
value
=
"上级id"
,
example
=
"110000"
)
private
Integer
upid
;
@Transient
@Transient
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
cityname
;
private
String
cityname
;
...
...
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