Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
Project
Project
Details
Activity
Releases
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
micro_app
gk
Commits
bbb22a80
Commit
bbb22a80
authored
Jul 02, 2024
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
悦行冬奥路接口提交1
parent
03d37e37
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
943 additions
and
9 deletions
+943
-9
JoyfulRichTextBean.java
...m/dlbridge/jadp/plugins/cmpt/bean/JoyfulRichTextBean.java
+12
-0
CmptSettingMapper.java
...ridge/jadp/plugins/cmpt/dao/mapper/CmptSettingMapper.java
+3
-1
CmptSettingMapper.xml
...bridge/jadp/plugins/cmpt/dao/mapper/CmptSettingMapper.xml
+13
-2
JoyfulCheckinRecordsMapper.java
...p/plugins/cmpt/dao/mapper/JoyfulCheckinRecordsMapper.java
+18
-0
JoyfulCheckinRecordsMapper.xml
...dp/plugins/cmpt/dao/mapper/JoyfulCheckinRecordsMapper.xml
+31
-0
JoyfulRichTextMapper.java
...ge/jadp/plugins/cmpt/dao/mapper/JoyfulRichTextMapper.java
+24
-0
JoyfulRichTextMapper.xml
...dge/jadp/plugins/cmpt/dao/mapper/JoyfulRichTextMapper.xml
+120
-0
UserPointMapper.java
...lbridge/jadp/plugins/cmpt/dao/mapper/UserPointMapper.java
+19
-0
UserPointMapper.xml
...dlbridge/jadp/plugins/cmpt/dao/mapper/UserPointMapper.xml
+27
-0
CmptSetting.java
...com/dlbridge/jadp/plugins/cmpt/dao/model/CmptSetting.java
+8
-2
JoyfulCheckinRecords.java
...dge/jadp/plugins/cmpt/dao/model/JoyfulCheckinRecords.java
+11
-0
JoyfulRichText.java
.../dlbridge/jadp/plugins/cmpt/dao/model/JoyfulRichText.java
+22
-0
PointRecord.java
...com/dlbridge/jadp/plugins/cmpt/dao/model/PointRecord.java
+10
-0
UserPoint.java
...a/com/dlbridge/jadp/plugins/cmpt/dao/model/UserPoint.java
+11
-0
CmptSettingService.java
...lbridge/jadp/plugins/cmpt/service/CmptSettingService.java
+10
-1
JoyfulCheckinRecordsService.java
...adp/plugins/cmpt/service/JoyfulCheckinRecordsService.java
+44
-0
JoyfulRichTextService.java
...idge/jadp/plugins/cmpt/service/JoyfulRichTextService.java
+119
-0
PointService.java
.../com/dlbridge/jadp/plugins/cmpt/service/PointService.java
+66
-0
WeatherService.java
...om/dlbridge/jadp/plugins/cmpt/service/WeatherService.java
+60
-0
GpsUtil.java
...in/java/com/dlbridge/jadp/plugins/cmpt/utils/GpsUtil.java
+114
-0
JoyfulRoadController.java
.../dlbridge/jadp/plugins/cmpt/web/JoyfulRoadController.java
+198
-0
MicroApiController.java
...om/dlbridge/jadp/plugins/cmpt/web/MicroApiController.java
+2
-2
application-dev.properties
src/main/resources/application-dev.properties
+1
-1
No files found.
src/main/java/com/dlbridge/jadp/plugins/cmpt/bean/JoyfulRichTextBean.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
bean
;
import
lombok.Data
;
@Data
public
class
JoyfulRichTextBean
{
private
String
type
;
private
String
title
;
private
String
lng
;
private
String
lat
;
private
String
distance
;
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptSettingMapper.java
View file @
bbb22a80
...
...
@@ -61,4 +61,6 @@ public interface CmptSettingMapper {
Func
getFuncById
(
String
id
);
int
updateByType
(
@Param
(
"setting"
)
CmptSetting
cmptSetting
);
}
int
updCmptsettingName
(
CmptSetting
cmptSetting
);
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptSettingMapper.xml
View file @
bbb22a80
...
...
@@ -241,5 +241,16 @@
where id=#{id}
</select>
</mapper>
<update
id=
"updCmptsettingName"
>
UPDATE
gksite.gk_cmptsetting
SET
name = #{name}
,name_web = #{name}
,update_by = #{updateById}
,update_date = now()
WHERE
type = #{type}
AND cmptid = #{cmptId}
</update>
</mapper>
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/JoyfulCheckinRecordsMapper.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
mapper
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 活动签到打卡记录
*
* @author LI
*/
public
interface
JoyfulCheckinRecordsMapper
{
int
insJoyfulCheckinRecords
(
JoyfulCheckinRecords
joyfulCheckinRecords
);
List
<
JoyfulCheckinRecords
>
getJoyfulCheckinRecordsList
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"offset"
)
int
offset
,
@Param
(
"pageCount"
)
int
pageCount
);
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/JoyfulCheckinRecordsMapper.xml
0 → 100644
View file @
bbb22a80
<?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.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulCheckinRecordsMapper"
>
<insert
id=
"insJoyfulCheckinRecords"
>
INSERT INTO gksite.joyful_checkin_records (
userId
,activity_id
,checkin_time
) VALUES (
#{userId}
,#{activityId}
,now()
)
</insert>
<select
id=
"getJoyfulCheckinRecordsList"
resultType=
"com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords"
>
SELECT
t2.title
,DATE_FORMAT(t1.checkin_time,'%Y/%m/%d %H:%i:%s') AS checkinTime
FROM
gksite.joyful_checkin_records t1
INNER JOIN gksite.joyful_rich_text t2
ON t1.activity_id = t2.id
AND t2.del_flg = '0'
WHERE
t1.userId = #{userId}
ORDER BY t1.checkin_time DESC
LIMIT #{offset}, #{pageCount}
</select>
</mapper>
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/JoyfulRichTextMapper.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
mapper
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 用户积分
*
* @author LI
*/
public
interface
JoyfulRichTextMapper
{
int
insJoyfulRichText
(
JoyfulRichText
joyfulRichText
);
int
updJoyfulRichText
(
JoyfulRichText
joyfulRichText
);
int
delJoyfulRichText
(
JoyfulRichText
joyfulRichText
);
List
<
JoyfulRichText
>
getJoyfulRichTextById
(
@Param
(
"id"
)
String
id
);
List
<
JoyfulRichText
>
getJoyfulRichTextList
(
@Param
(
"type"
)
String
type
,
@Param
(
"title"
)
String
title
);
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/JoyfulRichTextMapper.xml
0 → 100644
View file @
bbb22a80
<?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.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulRichTextMapper"
>
<insert
id=
"insJoyfulRichText"
>
INSERT INTO gksite.joyful_rich_text(
userId
,type
,title
,address
,lng
,lat
,content
,img_url
,remark1
,remark2
,remark3
,remark4
,status
,del_flg
,create_time
,create_user
) VALUES (
#{userId}
,#{type}
,#{title}
,#{address}
,#{lng}
,#{lat}
,#{content}
,#{imgUrl}
,#{remark1}
,#{remark2}
,#{remark3}
,#{remark4}
,#{status}
,'0'
,now()
,#{userId}
)
</insert>
<update
id=
"updJoyfulRichText"
>
UPDATE
gksite.joyful_rich_text
SET
userId = #{userId}
,type = #{type}
,title = #{title}
,address = #{address}
,lng = #{lng}
,lat = #{lat}
,content = #{content}
,img_url = #{imgUrl}
,remark1 = #{remark1}
,remark2 = #{remark2}
,remark3 = #{remark3}
,remark4 = #{remark4}
,status = #{status}
,update_time = now()
,update_user = #{userId}
WHERE
id = #{id}
</update>
<update
id=
"delJoyfulRichText"
>
UPDATE
gksite.joyful_rich_text
SET
del_flg = '1'
,update_time = now()
,update_user = #{userId}
WHERE
id = #{id}
</update>
<select
id=
"getJoyfulRichTextById"
resultType=
"com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText"
>
SELECT
id
,userId
,type
,title
,address
,lng
,lat
,content
,img_url AS imgUrl
,remark1
,remark2
,remark3
,remark4
FROM
gksite.joyful_rich_text
WHERE
id = #{id}
</select>
<select
id=
"getJoyfulRichTextList"
resultType=
"com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText"
>
SELECT
title
,address
,lng
,lat
,img_url AS imgUrl
,remark1
,remark2
,remark3
,remark4
FROM
gksite.joyful_rich_text
WHERE
del_flg = '0'
<if
test=
"type != null and type != ''"
>
AND type = #{type}
</if>
<if
test=
"title != null and title != ''"
>
AND title like concat('%',#{title},'%')
</if>
</select>
</mapper>
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/UserPointMapper.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
mapper
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.PointRecord
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.UserPoint
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 用户积分
*
* @author LI
*/
public
interface
UserPointMapper
{
List
<
UserPoint
>
getPoint
(
@Param
(
"userId"
)
String
userId
);
List
<
PointRecord
>
getPointRecord
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"isNegative"
)
String
isNegative
,
@Param
(
"offset"
)
int
offset
,
@Param
(
"pageCount"
)
int
pageCount
);
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/UserPointMapper.xml
0 → 100644
View file @
bbb22a80
<?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.dlbridge.jadp.plugins.cmpt.dao.mapper.UserPointMapper"
>
<select
id=
"getPoint"
resultType=
"com.dlbridge.jadp.plugins.cmpt.dao.model.UserPoint"
>
SELECT
point
FROM
raceenroll.point
WHERE
userId = #{userId}
</select>
<select
id=
"getPointRecord"
resultType=
"com.dlbridge.jadp.plugins.cmpt.dao.model.PointRecord"
>
SELECT
typeName
,IF(isNegative = '1', -1 * point, point) as point
,DATE_FORMAT(createTime,'%Y/%m/%d %H:%i:%s') AS createTime
FROM
raceenroll.pointrecord
WHERE
userId = #{userId}
AND isNegative = #{isNegative}
ORDER BY createTime DESC
LIMIT #{offset}, #{pageCount}
</select>
</mapper>
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/model/CmptSetting.java
View file @
bbb22a80
...
...
@@ -2,7 +2,6 @@ package com.dlbridge.jadp.plugins.cmpt.dao.model;
import
com.dlbridge.jadp.common.persistence.JaapRecord
;
public
class
CmptSetting
extends
JaapRecord
<
CmptSetting
>
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -16,6 +15,7 @@ public class CmptSetting extends JaapRecord<CmptSetting> {
private
String
seq
;
// 顺序
private
String
style
;
private
int
status
;
private
String
updateById
;
public
String
getNameWeb
()
{
return
nameWeb
;
...
...
@@ -89,5 +89,11 @@ public class CmptSetting extends JaapRecord<CmptSetting> {
this
.
status
=
status
;
}
public
String
getUpdateById
()
{
return
updateById
;
}
}
public
void
setUpdateById
(
String
updateById
)
{
this
.
updateById
=
updateById
;
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/model/JoyfulCheckinRecords.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
model
;
import
lombok.Data
;
@Data
public
class
JoyfulCheckinRecords
{
private
String
userId
;
private
String
activityId
;
private
String
checkinTime
;
private
String
title
;
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/model/JoyfulRichText.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
model
;
import
lombok.Data
;
@Data
public
class
JoyfulRichText
{
private
String
id
;
private
String
userId
;
private
String
type
;
private
String
title
;
private
String
address
;
private
String
lng
;
private
String
lat
;
private
String
content
;
private
String
imgUrl
;
private
String
remark1
;
private
String
remark2
;
private
String
remark3
;
private
String
remark4
;
private
String
status
;
private
String
delFlg
;
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/model/PointRecord.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
model
;
import
lombok.Data
;
@Data
public
class
PointRecord
{
private
int
point
;
private
String
createTime
;
private
String
typeName
;
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/model/UserPoint.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
model
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
UserPoint
{
private
List
<
PointRecord
>
pointRecordList
;
private
int
point
;
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/CmptSettingService.java
View file @
bbb22a80
...
...
@@ -125,4 +125,13 @@ public class CmptSettingService {
public
int
updateByType
(
CmptSetting
cmptSetting
)
{
return
cmptSettingMapper
.
updateByType
(
cmptSetting
);
}
}
/**
* 模块名称修改
* @param cmptSetting
* @return
*/
public
int
updCmptsettingName
(
CmptSetting
cmptSetting
)
{
return
cmptSettingMapper
.
updCmptsettingName
(
cmptSetting
);
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/JoyfulCheckinRecordsService.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
service
;
import
com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulCheckinRecordsMapper
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 活动签到打卡记录
*
* @author LI
*/
@Service
public
class
JoyfulCheckinRecordsService
{
@Resource
JoyfulCheckinRecordsMapper
joyfulCheckinRecordsMapper
;
/**
* 活动签到打卡记录 追加
*
* @param joyfulCheckinRecords
* @return
*/
public
int
insJoyfulCheckinRecords
(
JoyfulCheckinRecords
joyfulCheckinRecords
)
{
return
joyfulCheckinRecordsMapper
.
insJoyfulCheckinRecords
(
joyfulCheckinRecords
);
}
/**
* 活动签到打卡记录 条件检索
*
* @param userId
* @param pageNo
* @param pageCount
* @return
*/
public
List
<
JoyfulCheckinRecords
>
getJoyfulCheckinRecordsList
(
String
userId
,
int
pageNo
,
int
pageCount
)
{
int
offset
=
PointService
.
getOffset
(
pageNo
,
pageCount
);
List
<
JoyfulCheckinRecords
>
joyfulCheckinRecordsList
=
joyfulCheckinRecordsMapper
.
getJoyfulCheckinRecordsList
(
userId
,
offset
,
pageCount
);
return
joyfulCheckinRecordsList
;
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/JoyfulRichTextService.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
service
;
import
com.dlbridge.jadp.plugins.cmpt.bean.JoyfulRichTextBean
;
import
com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulRichTextMapper
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText
;
import
com.dlbridge.jadp.plugins.cmpt.utils.GpsUtil
;
import
com.dlbridge.jadp.plugins.cmpt.utils.QRCodeUtil
;
import
com.google.gson.Gson
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.awt.image.BufferedImage
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 积分信息
*
* @author LI
*/
@Service
public
class
JoyfulRichTextService
{
@Resource
JoyfulRichTextMapper
joyfulRichTextMapper
;
/**
* 悦行冬奥路富文本表 追加
*
* @param joyfulRichText
* @return
*/
public
int
insJoyfulRichText
(
JoyfulRichText
joyfulRichText
)
{
return
joyfulRichTextMapper
.
insJoyfulRichText
(
joyfulRichText
);
}
/**
* 悦行冬奥路富文本表 修改
*
* @param joyfulRichText
* @return
*/
public
int
updJoyfulRichText
(
JoyfulRichText
joyfulRichText
)
{
return
joyfulRichTextMapper
.
updJoyfulRichText
(
joyfulRichText
);
}
/**
* 悦行冬奥路富文本表 逻辑删除
*
* @param joyfulRichText
* @return
*/
public
int
delJoyfulRichText
(
JoyfulRichText
joyfulRichText
)
{
return
joyfulRichTextMapper
.
delJoyfulRichText
(
joyfulRichText
);
}
/**
* 悦行冬奥路富文本表 主键检索
*
* @param id
* @return
*/
public
JoyfulRichText
getJoyfulRichText
(
String
id
)
{
List
<
JoyfulRichText
>
joyfulRichTextList
=
joyfulRichTextMapper
.
getJoyfulRichTextById
(
id
);
if
(
joyfulRichTextList
.
isEmpty
())
{
return
null
;
}
return
joyfulRichTextList
.
get
(
0
);
}
/**
* 悦行冬奥路富文本表 条件检索
*
* @param joyfulRichTextBean
* @return
*/
public
List
<
JoyfulRichText
>
getJoyfulRichTextList
(
JoyfulRichTextBean
joyfulRichTextBean
)
{
List
<
JoyfulRichText
>
joyfulRichTextList
=
joyfulRichTextMapper
.
getJoyfulRichTextList
(
joyfulRichTextBean
.
getType
(),
joyfulRichTextBean
.
getTitle
());
if
(
StringUtils
.
isNotBlank
(
joyfulRichTextBean
.
getDistance
()))
{
joyfulRichTextList
=
joyfulRichTextList
.
stream
().
filter
(
model
->
this
.
notGtDistance
(
model
,
joyfulRichTextBean
)).
collect
(
Collectors
.
toList
());
}
return
joyfulRichTextList
;
}
/**
* 生成签到二维码
*
* @param id
* @return
*/
public
BufferedImage
getJoyfulRichTextQrCode
(
int
id
)
{
Map
<
String
,
Integer
>
map
=
new
HashMap
();
map
.
put
(
"id"
,
id
);
Gson
gson
=
new
Gson
();
String
json
=
gson
.
toJson
(
map
);
return
QRCodeUtil
.
getBufferedImage
(
null
,
json
);
}
private
boolean
notGtDistance
(
JoyfulRichText
model
,
JoyfulRichTextBean
bean
)
{
double
distance
=
GpsUtil
.
getDistance
(
Double
.
parseDouble
(
model
.
getLat
()),
Double
.
parseDouble
(
model
.
getLng
()),
Double
.
parseDouble
(
bean
.
getLat
()),
Double
.
parseDouble
(
bean
.
getLng
()));
return
distance
<=
Double
.
parseDouble
(
bean
.
getDistance
())
*
1000.0
;
}
public
static
List
subList
(
List
list
,
int
fromIndex
,
int
toIndex
)
{
if
(
fromIndex
<
list
.
size
())
{
if
(
toIndex
<
list
.
size
())
{
return
list
.
subList
(
fromIndex
,
toIndex
);
}
else
{
return
list
.
subList
(
fromIndex
,
list
.
size
());
}
}
else
{
return
new
ArrayList
();
}
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/PointService.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
service
;
import
com.dlbridge.jadp.plugins.cmpt.dao.mapper.UserPointMapper
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.PointRecord
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.UserPoint
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 积分信息
*
* @author LI
*/
@Service
public
class
PointService
{
// 0:获得积分
public
static
final
String
IS_NEGATIVE_0
=
"0"
;
// 1:抵扣积分
public
static
final
String
IS_NEGATIVE_1
=
"1"
;
@Resource
UserPointMapper
userPointMapper
;
/**
* 用户总积分
*
* @param userId
* @param isNegative 0:获得积分,1:抵扣积分
* @param pageNo
* @param pageCount
* @return
*/
public
UserPoint
getUserPoint
(
String
userId
,
String
isNegative
,
int
pageNo
,
int
pageCount
)
{
List
<
UserPoint
>
userPointList
=
userPointMapper
.
getPoint
(
userId
);
if
(
userPointList
.
isEmpty
())
{
return
null
;
}
UserPoint
userPoint
=
userPointList
.
get
(
0
);
List
<
PointRecord
>
pointRecordList
=
this
.
getPointRecord
(
userId
,
isNegative
,
pageNo
,
pageCount
);
userPoint
.
setPointRecordList
(
pointRecordList
);
return
userPoint
;
}
/**
* 用户积分流水
*
* @param userId
* @param isNegative 0:获得积分,1:抵扣积分
* @param pageNo
* @param pageCount
*/
public
List
<
PointRecord
>
getPointRecord
(
String
userId
,
String
isNegative
,
int
pageNo
,
int
pageCount
)
{
int
offset
=
getOffset
(
pageNo
,
pageCount
);
return
userPointMapper
.
getPointRecord
(
userId
,
isNegative
,
offset
,
pageCount
);
}
public
static
int
getOffset
(
int
pageNo
,
int
pageCount
)
{
pageNo
=
pageNo
-
1
;
if
(
pageNo
<
0
)
{
pageNo
=
0
;
}
return
pageNo
*
pageCount
;
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/WeatherService.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
service
;
import
com.dlbridge.jadp.plugins.cmpt.utils.HttpUtil
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 天气信息
*
* @author LI
*/
@Service
public
class
WeatherService
{
private
final
String
KEY
=
"H8S2C41LnZZJ2MKxOTD0r7jf1LBR4PIO"
;
/**
* 当前天气
*
* @param areacode
* @return
*/
public
Map
<
String
,
Object
>
getWeatherNow
(
String
areacode
)
{
String
url
=
"https://gfapi.mlogcn.com/weather/v001/now"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"areacode"
,
areacode
);
map
.
put
(
"key"
,
KEY
);
String
json
=
HttpUtil
.
doGet
(
url
,
map
);
return
getWeather
(
json
);
}
/**
* 近期天气
*
* @param areacode
* @param days
* @return
*/
public
Map
<
String
,
Object
>
getWeatherDay
(
String
areacode
,
String
days
)
{
String
url
=
"https://gfapi.mlogcn.com/weather/v001/day"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"areacode"
,
areacode
);
map
.
put
(
"days"
,
days
);
map
.
put
(
"key"
,
KEY
);
String
json
=
HttpUtil
.
doGet
(
url
,
map
);
return
getWeather
(
json
);
}
private
static
Map
<
String
,
Object
>
getWeather
(
String
json
)
{
Gson
gson
=
new
Gson
();
Map
<
String
,
Object
>
map
=
gson
.
fromJson
(
json
,
new
TypeToken
<
Map
<
String
,
Object
>>()
{
}.
getType
());
map
.
replace
(
"status"
,
((
Double
)
map
.
get
(
"status"
)).
intValue
());
return
map
;
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/utils/GpsUtil.java
0 → 100644
View file @
bbb22a80
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
utils
;
/**
* <p>
* 百度地图计算两坐标点之间距离计算
* </p>
*
* @author Linc
* @since 2021/12/21
*/
public
class
GpsUtil
{
private
static
double
DEF_PI
=
3.14159265359
;
// PI
private
static
double
DEF_2PI
=
6.28318530712
;
// 2*PI
private
static
double
DEF_PI180
=
0.01745329252
;
// PI/180.0
public
static
double
DEF_R
=
6370693.5
;
// radius of earth
/**
* 两个经纬度点之间的距离。适用于近距离,单位m
*
* @param lng1 经度1
* @param lat1 纬度1
* @param lng2 经度2
* @param lat2 纬度2
* @return
*/
public
static
double
getShortDistance
(
double
lng1
,
double
lat1
,
double
lng2
,
double
lat2
)
{
double
ew1
,
ns1
,
ew2
,
ns2
;
double
dx
,
dy
,
dew
;
double
distance
;
// 角度转换为弧度
ew1
=
lng1
*
DEF_PI180
;
ns1
=
lat1
*
DEF_PI180
;
ew2
=
lng2
*
DEF_PI180
;
ns2
=
lat2
*
DEF_PI180
;
// 经度差
dew
=
ew1
-
ew2
;
// 若跨东经和西经180 度,进行调整
if
(
dew
>
DEF_PI
)
dew
=
DEF_2PI
-
dew
;
else
if
(
dew
<
-
DEF_PI
)
dew
=
DEF_2PI
+
dew
;
dx
=
DEF_R
*
Math
.
cos
(
ns1
)
*
dew
;
// 东西方向长度(在纬度圈上的投影长度)
dy
=
DEF_R
*
(
ns1
-
ns2
);
// 南北方向长度(在经度圈上的投影长度)
// 勾股定理求斜边长
distance
=
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
return
distance
;
}
/**
* 适用于远距离
*
* @param lon1
* @param lat1
* @param lon2
* @param lat2
* @return
*/
public
static
double
getLongDistance
(
double
lon1
,
double
lat1
,
double
lon2
,
double
lat2
)
{
double
ew1
,
ns1
,
ew2
,
ns2
;
double
distance
;
// 角度转换为弧度
ew1
=
lon1
*
DEF_PI180
;
ns1
=
lat1
*
DEF_PI180
;
ew2
=
lon2
*
DEF_PI180
;
ns2
=
lat2
*
DEF_PI180
;
// 求大圆劣弧与球心所夹的角(弧度)
distance
=
Math
.
sin
(
ns1
)
*
Math
.
sin
(
ns2
)
+
Math
.
cos
(
ns1
)
*
Math
.
cos
(
ns2
)
*
Math
.
cos
(
ew1
-
ew2
);
// 调整到[-1..1]范围内,避免溢出
if
(
distance
>
1.0
)
distance
=
1.0
;
else
if
(
distance
<
-
1.0
)
distance
=
-
1.0
;
// 求大圆劣弧长度
distance
=
DEF_R
*
Math
.
acos
(
distance
);
return
distance
;
}
/**
* 计算两点的经纬度距离
* 不要在意怎么算的 合并过的
* 减少内存的回收
*
* @param lat1
* @param lng1
* @param lat2
* @param lng2
* @return 单位 米
*/
public
static
double
getDistance
(
double
lat1
,
double
lng1
,
double
lat2
,
double
lng2
)
{
double
a
,
b
,
R
=
6378137
;
// 地球半径
lat1
=
lat1
*
Math
.
PI
/
180.0
;
lat2
=
lat2
*
Math
.
PI
/
180.0
;
a
=
lat1
-
lat2
;
b
=
(
lng1
-
lng2
)
*
Math
.
PI
/
180.0
;
return
2
*
R
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2.0
),
2
)
+
Math
.
cos
(
lat1
)
*
Math
.
cos
(
lat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2.0
),
2
)));
}
public
static
void
main
(
String
[]
args
)
{
double
mLat1
=
40.839055962860584
;
// point1纬度
double
mLon1
=
115.37932204082608
;
// point1经度
double
mLat2
=
40.871667684987187
;
// point2纬度
double
mLon2
=
115.42866764590144
;
// point2经度
double
distance
=
GpsUtil
.
getShortDistance
(
mLon1
,
mLat1
,
mLon2
,
mLat2
);
double
distance2
=
GpsUtil
.
getDistance
(
mLat1
,
mLon1
,
mLat2
,
mLon2
);
System
.
out
.
println
(
distance
);
System
.
out
.
println
(
distance2
);
// double distance2 = GpsUtil.getLongDistance(mLon1, mLat1, mLon2, mLat2);
// System.out.println(distance2);
}
}
\ No newline at end of file
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/JoyfulRoadController.java
0 → 100644
View file @
bbb22a80
This diff is collapsed.
Click to expand it.
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/MicroApiController.java
View file @
bbb22a80
...
...
@@ -630,10 +630,10 @@ public class MicroApiController {
if
(
jsoninfo
.
getString
(
"unionId"
)
!=
null
&&
!
"null"
.
equals
(
jsoninfo
.
getString
(
"unionId"
))){
url
=
geexekURL
+
"registerInfo/saveOrUpdateByUnionId.do?unionId="
+
jsoninfo
.
getString
(
"unionId"
)
+
"&userName="
+
name
+
"&nickName="
+
name
+
"&headImgUrl="
+
imgUrl
+
"&userFrom=3"
;
"&userName="
+
name
+
"&nickName="
+
name
+
"&userFrom=3"
;
}
else
{
url
=
geexekURL
+
"registerInfo/saveOrUpdateByOpenId.do?openId="
+
openid
+
"&userName="
+
name
+
"&nickName="
+
name
+
"&headImgUrl="
+
imgUrl
+
"&userFrom=3"
;
"&userName="
+
name
+
"&nickName="
+
name
+
"&userFrom=3"
;
}
log
.
info
(
"=====请求的URL:"
+
url
);
...
...
src/main/resources/application-dev.properties
View file @
bbb22a80
...
...
@@ -13,7 +13,7 @@ mybatis.mapperLocations=classpath:com/dlbridge/jadp/plugins/**/**.xml
mybatis.configuration.map-underscore-to-camel-case
=
true
mybatis.configuration.jdbc-type-for-null
=
null
spring.profiles.active
=
dev
server.port
=
9
090
server.port
=
9
802
charset_name
=
UTF-8
#\u8BBE\u7F6E\u73AF\u5883\u914D\u7F6E
#spring.profiles.active=dev
...
...
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