Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
antai-sport-http-server
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
antai-sport
antai-sport-http-server
Commits
4d866872
Commit
4d866872
authored
Apr 21, 2022
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文本编辑器和文件上传
parent
c6aec543
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
251 additions
and
0 deletions
+251
-0
SimpleMatchController.java
...usiness/simplematch/controller/SimpleMatchController.java
+15
-0
SimpleMatchConverter.java
.../business/simplematch/converter/SimpleMatchConverter.java
+12
-0
SimpleMatchResponseDTO.java
.../api/business/simplematch/dto/SimpleMatchResponseDTO.java
+13
-0
MapPathVO.java
...management/api/business/simplematch/dto/vo/MapPathVO.java
+13
-0
SimpleMatchVO.java
...gement/api/business/simplematch/dto/vo/SimpleMatchVO.java
+26
-0
SimpleMatchService.java
.../api/business/simplematch/service/SimpleMatchService.java
+66
-0
Map.java
...om/antai/sport/http/server/repository/map/entity/Map.java
+31
-0
MapPath.java
...ntai/sport/http/server/repository/map/entity/MapPath.java
+33
-0
MapMapper.java
...ai/sport/http/server/repository/map/mapper/MapMapper.java
+16
-0
MapPathMapper.java
...port/http/server/repository/map/mapper/MapPathMapper.java
+16
-0
MapMapper.xml
repository/src/main/resources/mapper/map/MapMapper.xml
+5
-0
MapPathMapper.xml
repository/src/main/resources/mapper/map/MapPathMapper.xml
+5
-0
No files found.
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/controller/SimpleMatchController.java
View file @
4d866872
...
...
@@ -3,6 +3,8 @@ package com.antai.sport.http.server.management.api.business.simplematch.controll
import
com.antai.sport.http.server.common.base.Result
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchListRequestDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchListResponseDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchResponseDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.SimpleMatchVO
;
import
com.antai.sport.http.server.management.api.business.simplematch.service.SimpleMatchService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -41,5 +43,18 @@ public class SimpleMatchController {
return
success
();
}
@ApiOperation
(
"获取用户数据"
)
@GetMapping
(
"/{matchId}"
)
public
ResponseEntity
<
Result
<
SimpleMatchResponseDTO
>>
getSimpleMatch
(
@PathVariable
(
"matchId"
)
Long
matchId
)
{
return
success
(
simpleMatchService
.
getSimpleMatch
(
matchId
));
}
@ApiOperation
(
"创建日常赛"
)
@PostMapping
(
""
)
public
ResponseEntity
<
Result
>
save
(
@RequestBody
SimpleMatchVO
simpleMatchVO
)
{
simpleMatchService
.
save
(
simpleMatchVO
);
return
success
();
}
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/converter/SimpleMatchConverter.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
management
.
api
.
business
.
simplematch
.
converter
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.SimpleMatchVO
;
import
com.antai.sport.http.server.repository.simplematch.entity.SimpleMatch
;
import
org.mapstruct.Mapper
;
@Mapper
(
componentModel
=
"spring"
)
public
interface
SimpleMatchConverter
{
SimpleMatchVO
toSimpleMatchVO
(
SimpleMatch
source
);
SimpleMatch
toSimpleMatch
(
SimpleMatchVO
source
);
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/dto/SimpleMatchResponseDTO.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
management
.
api
.
business
.
simplematch
.
dto
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.MapPathVO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.SimpleMatchVO
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SimpleMatchResponseDTO
{
private
SimpleMatchVO
simpleMatch
;
private
List
<
MapPathVO
>
mapList
;
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/dto/vo/MapPathVO.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
management
.
api
.
business
.
simplematch
.
dto
.
vo
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MapPathVO
{
private
Integer
id
;
private
String
key
;
private
String
name
;
List
<
MapPathVO
>
pathList
;
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/dto/vo/SimpleMatchVO.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
management
.
api
.
business
.
simplematch
.
dto
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
@Data
public
class
SimpleMatchVO
{
private
Long
id
;
private
String
name
;
private
String
logo
;
private
String
map
;
private
String
path
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
entryTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
endTime
;
private
BigDecimal
distance
;
private
BigDecimal
climbDistance
;
private
String
description
;
private
Integer
status
;
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/service/SimpleMatchService.java
View file @
4d866872
...
...
@@ -2,10 +2,18 @@ package com.antai.sport.http.server.management.api.business.simplematch.service;
import
com.antai.sport.http.server.common.exception.BusinessException
;
import
com.antai.sport.http.server.constants.DeleteStatus
;
import
com.antai.sport.http.server.management.api.business.simplematch.converter.SimpleMatchConverter
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchListRequestDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchListResponseDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchResponseDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.MapPathVO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.SimpleMatchListVO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.SimpleMatchVO
;
import
com.antai.sport.http.server.management.api.business.simplematch.mapper.SimpleMatchBusinessMapper
;
import
com.antai.sport.http.server.repository.map.entity.Map
;
import
com.antai.sport.http.server.repository.map.entity.MapPath
;
import
com.antai.sport.http.server.repository.map.mapper.MapMapper
;
import
com.antai.sport.http.server.repository.map.mapper.MapPathMapper
;
import
com.antai.sport.http.server.repository.simplematch.entity.SimpleMatch
;
import
com.antai.sport.http.server.repository.simplematch.mapper.SimpleMatchMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -15,6 +23,9 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
@Service
public
class
SimpleMatchService
{
...
...
@@ -22,6 +33,12 @@ public class SimpleMatchService {
private
SimpleMatchMapper
simpleMatchMapper
;
@Resource
private
SimpleMatchBusinessMapper
simpleMatchBusinessMapper
;
@Resource
private
MapMapper
mapMapper
;
@Resource
private
MapPathMapper
mapPathMapper
;
@Resource
private
SimpleMatchConverter
simpleMatchConverter
;
public
SimpleMatchListResponseDTO
getMatchList
(
SimpleMatchListRequestDTO
param
)
{
Page
<
SimpleMatchListVO
>
pageParam
=
new
Page
<>(
param
.
getPageNo
(),
param
.
getPageSize
());
...
...
@@ -57,4 +74,53 @@ public class SimpleMatchService {
simpleMatchMapper
.
updateById
(
simpleMatch
);
}
public
SimpleMatchResponseDTO
getSimpleMatch
(
Long
matchId
)
{
SimpleMatchResponseDTO
result
=
new
SimpleMatchResponseDTO
();
SimpleMatch
simpleMatch
;
if
(
matchId
==
null
||
matchId
==
0
)
{
simpleMatch
=
new
SimpleMatch
();
simpleMatch
.
setStatus
(
10
);
}
else
{
simpleMatch
=
simpleMatchMapper
.
selectById
(
matchId
);
if
(
simpleMatch
==
null
)
{
throw
new
BusinessException
(
"您查询的比赛不存在"
);
}
}
SimpleMatchVO
simpleMatchVO
=
simpleMatchConverter
.
toSimpleMatchVO
(
simpleMatch
);
result
.
setSimpleMatch
(
simpleMatchVO
);
List
<
Map
>
mapList
=
mapMapper
.
selectList
(
null
);
List
<
MapPath
>
mapPathList
=
mapPathMapper
.
selectList
(
null
);
HashMap
<
String
,
MapPathVO
>
mapPathVOHashMap
=
new
HashMap
<>();
List
<
MapPathVO
>
mapPathVOList
=
new
ArrayList
<>(
mapList
.
size
());
mapList
.
forEach
(
item
->
{
MapPathVO
mapVO
=
new
MapPathVO
();
mapVO
.
setId
(
item
.
getId
());
mapVO
.
setKey
(
item
.
getMapKey
());
mapVO
.
setName
(
item
.
getMapName
());
mapVO
.
setPathList
(
new
ArrayList
<>());
mapPathVOList
.
add
(
mapVO
);
mapPathVOHashMap
.
put
(
item
.
getMapKey
(),
mapVO
);
});
mapPathList
.
forEach
(
item
->
{
MapPathVO
mapPathVO
=
new
MapPathVO
();
mapPathVO
.
setId
(
item
.
getId
());
mapPathVO
.
setKey
(
item
.
getPathKey
());
mapPathVO
.
setName
(
item
.
getPathName
());
if
(
mapPathVOHashMap
.
containsKey
(
item
.
getMapKey
()))
{
mapPathVOHashMap
.
get
(
item
.
getMapKey
()).
getPathList
().
add
(
mapPathVO
);
}
});
result
.
setMapList
(
mapPathVOList
);
return
result
;
}
public
void
save
(
SimpleMatchVO
simpleMatchVO
)
{
SimpleMatch
simpleMatch
=
simpleMatchConverter
.
toSimpleMatch
(
simpleMatchVO
);
if
(
simpleMatch
.
getId
()
!=
null
&&
simpleMatch
.
getId
()
>
0
)
{
simpleMatchMapper
.
updateById
(
simpleMatch
);
}
else
{
simpleMatchMapper
.
insert
(
simpleMatch
);
}
}
}
repository/src/main/java/com/antai/sport/http/server/repository/map/entity/Map.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
repository
.
map
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.io.Serializable
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
*
* </p>
*
* @author liming
* @since 2022-04-21
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
Map
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
String
mapKey
;
private
String
mapName
;
}
repository/src/main/java/com/antai/sport/http/server/repository/map/entity/MapPath.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
repository
.
map
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.io.Serializable
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
*
* </p>
*
* @author liming
* @since 2022-04-21
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
MapPath
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
String
mapKey
;
private
String
pathKey
;
private
String
pathName
;
}
repository/src/main/java/com/antai/sport/http/server/repository/map/mapper/MapMapper.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
repository
.
map
.
mapper
;
import
com.antai.sport.http.server.repository.map.entity.Map
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author liming
* @since 2022-04-21
*/
public
interface
MapMapper
extends
BaseMapper
<
Map
>
{
}
repository/src/main/java/com/antai/sport/http/server/repository/map/mapper/MapPathMapper.java
0 → 100644
View file @
4d866872
package
com
.
antai
.
sport
.
http
.
server
.
repository
.
map
.
mapper
;
import
com.antai.sport.http.server.repository.map.entity.MapPath
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author liming
* @since 2022-04-21
*/
public
interface
MapPathMapper
extends
BaseMapper
<
MapPath
>
{
}
repository/src/main/resources/mapper/map/MapMapper.xml
0 → 100644
View file @
4d866872
<?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.antai.sport.http.server.repository.map.mapper.MapMapper"
>
</mapper>
repository/src/main/resources/mapper/map/MapPathMapper.xml
0 → 100644
View file @
4d866872
<?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.antai.sport.http.server.repository.map.mapper.MapPathMapper"
>
</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