Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
2454e585
Commit
2454e585
authored
Jun 27, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
d2cfcea9
f71b1822
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
608 additions
and
192 deletions
+608
-192
AppUserManage.java
...m/github/wxiaoqi/security/admin/entity/AppUserManage.java
+15
-0
AppUserManageBiz.java
...m/github/wxiaoqi/security/admin/biz/AppUserManageBiz.java
+100
-0
AppUserDetailMapper.java
...ub/wxiaoqi/security/admin/mapper/AppUserDetailMapper.java
+2
-1
AppUserLoginMapper.java
...hub/wxiaoqi/security/admin/mapper/AppUserLoginMapper.java
+1
-0
AppUserMapper.java
...m/github/wxiaoqi/security/admin/mapper/AppUserMapper.java
+3
-0
AppUsersManageController.java
...wxiaoqi/security/admin/rest/AppUsersManageController.java
+55
-0
AppUserDetailMapper.xml
...e-admin/src/main/resources/mapper/AppUserDetailMapper.xml
+86
-1
AppUserMapper.xml
...les/ace-admin/src/main/resources/mapper/AppUserMapper.xml
+2
-0
TourGoodDetailBiz.java
...in/java/com/xxfc/platform/tour/biz/TourGoodDetailBiz.java
+2
-0
TourGoodSpePriceMapper.java
...com/xxfc/platform/tour/mapper/TourGoodSpePriceMapper.java
+3
-0
TourUserController.java
.../java/com/xxfc/platform/tour/rest/TourUserController.java
+2
-2
TourGoodSpePriceMapper.xml
...rver/src/main/resources/mapper/TourGoodSpePriceMapper.xml
+5
-0
ITrafficViolationsFeign.java
.../xxfc/platform/universal/api/ITrafficViolationsFeign.java
+16
-0
ITrafficViolationsService.java
...xfc/platform/universal/api/ITrafficViolationsService.java
+0
-46
searchableCity.java
...va/com/xxfc/platform/universal/entity/searchableCity.java
+40
-0
ThirdFeign.java
...in/java/com/xxfc/platform/universal/feign/ThirdFeign.java
+23
-4
TrafficViolations.java
...ava/com/xxfc/platform/universal/vo/TrafficViolations.java
+23
-0
UniversalApplication.java
...ava/com/xxfc/platform/universal/UniversalApplication.java
+1
-1
TrafficViolationsController.java
...orm/universal/controller/TrafficViolationsController.java
+51
-33
TrafficViolationsService.java
.../platform/universal/service/TrafficViolationsService.java
+113
-78
application.properties
...niversal-server/src/main/resources/application.properties
+10
-11
AccompanyingItemController.java
...xfc/platform/vehicle/rest/AccompanyingItemController.java
+17
-11
AreaController.java
...n/java/com/xxfc/platform/vehicle/rest/AreaController.java
+7
-1
RegionTest.java
...r/src/test/java/com/xxfc/platform/vehicle/RegionTest.java
+31
-3
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppUserManage.java
0 → 100644
View file @
2454e585
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
entity
;
import
lombok.Data
;
import
javax.persistence.Column
;
@Data
public
class
AppUserManage
{
private
AppUserLogin
appUserLogin
;
private
AppUserDetail
appUserDetail
;
private
BaseUserMember
baseUserMember
;
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserManageBiz.java
0 → 100644
View file @
2454e585
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.entity.*
;
import
com.github.wxiaoqi.security.admin.mapper.*
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.apache.commons.beanutils.BeanUtilsBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
tk.mybatis.mapper.entity.Example
;
/**
* app用户管理业务逻辑层
*
* @author Administrator
*/
@Service
public
class
AppUserManageBiz
extends
BaseBiz
<
AppUserDetailMapper
,
AppUserDetail
>
{
@Autowired
private
AppUserLoginMapper
appUserLoginMapper
;
/**
* 根据条件查询
*
* @param appUserVo
* @return
*/
public
AppUserVo
findAllByQuery
(
AppUserVo
appUserVo
)
{
return
mapper
.
selectAppUserManage
(
appUserVo
);
}
@Transactional
public
void
deleteAppUser
(
Integer
id
)
{
AppUserLogin
appUserLogin
=
new
AppUserLogin
();
appUserLogin
.
setIsdel
(
1
);
Example
example
=
new
Example
(
AppUserLogin
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"id"
,
id
);
appUserLogin
.
setUpdatetime
(
System
.
currentTimeMillis
());
appUserLoginMapper
.
updateByExampleSelective
(
appUserLogin
,
example
);
AppUserDetail
appUserDetail
=
new
AppUserDetail
();
appUserDetail
.
setIsdel
(
1
);
appUserDetail
.
setUpdatetime
(
System
.
currentTimeMillis
());
Example
detailExample
=
new
Example
(
AppUserLogin
.
class
);
Example
.
Criteria
detailCriteria
=
detailExample
.
createCriteria
();
criteria
.
andEqualTo
(
"id"
,
id
);
mapper
.
updateByExampleSelective
(
appUserDetail
,
detailCriteria
);
}
public
AppUserVo
findOneById
(
Integer
id
)
{
return
mapper
.
getUserInfo
(
id
);
}
@Transactional
public
void
save
(
AppUserVo
appUserVo
)
{
AppUserLogin
appUserLogin
=
new
AppUserLogin
();
AppUserDetail
appUserDetail
=
new
AppUserDetail
();
try
{
BeanUtilsBean
.
getInstance
().
copyProperties
(
appUserLogin
,
appUserVo
);
BeanUtilsBean
.
getInstance
().
copyProperties
(
appUserDetail
,
appUserVo
);
if
(
appUserVo
.
getUserid
()
==
null
||
appUserVo
.
getUserid
()
==
0
)
{
//设置登录用户信息
appUserLogin
.
setIsdel
(
0
);
appUserLogin
.
setCreatetime
(
System
.
currentTimeMillis
());
appUserLogin
.
setCertificationStatus
(
0
);
appUserLogin
.
setStatus
(
0
);
//设置用户详情
appUserDetail
.
setIsdel
(
0
);
if
(
appUserDetail
.
getIsMember
()
==
null
)
{
appUserDetail
.
setIsMember
(
0
);
}
appUserLoginMapper
.
insertSelective
(
appUserLogin
);
mapper
.
insertSelective
(
appUserDetail
);
}
else
{
appUserLogin
.
setUpdatetime
(
System
.
currentTimeMillis
());
appUserDetail
.
setUpdatetime
(
System
.
currentTimeMillis
());
appUserLoginMapper
.
updateByPrimaryKeySelective
(
appUserLogin
);
mapper
.
updateByPrimaryKeySelective
(
appUserDetail
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserDetailMapper.java
View file @
2454e585
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.AppUserDetail
;
import
com.github.wxiaoqi.security.admin.entity.AppUserManage
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
...
...
@@ -10,5 +11,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
//查询用户信息
public
AppUserVo
getUserInfo
(
@Param
(
"userId"
)
Integer
userId
);
AppUserVo
selectAppUserManage
(
AppUserVo
appUserVo
);
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserLoginMapper.java
View file @
2454e585
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.AppUserLogin
;
import
com.github.wxiaoqi.security.admin.entity.AppUserManage
;
import
tk.mybatis.mapper.common.Mapper
;
public
interface
AppUserLoginMapper
extends
Mapper
<
AppUserLogin
>
{
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserMapper.java
View file @
2454e585
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.AppUser
;
import
com.github.wxiaoqi.security.admin.entity.AppUserManage
;
import
com.github.wxiaoqi.security.admin.entity.Group
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
...
...
@@ -17,4 +18,6 @@ public interface AppUserMapper extends Mapper<AppUser> {
int
insertAppUserGroup
(
@Param
(
"appUserId"
)
Integer
appUserId
,
@Param
(
"groups"
)
Set
<
Integer
>
groups
);
int
deleteAppUserGroup
(
Integer
appUserId
);
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUsersManageController.java
0 → 100644
View file @
2454e585
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.biz.AppUserManageBiz
;
import
com.github.wxiaoqi.security.admin.entity.AppUserManage
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
org.springframework.web.bind.annotation.*
;
/**
* app用户管理类
* @author Administrator
*/
@RestController
@RequestMapping
(
"appUsersManage"
)
public
class
AppUsersManageController
extends
BaseController
<
AppUserManageBiz
,
AppUserManage
>
{
/**
* 查询所有
* @return
*/
@GetMapping
(
"/findAll"
)
public
ObjectRestResponse
<
AppUserVo
>
findAllByQuery
(
@RequestBody
AppUserVo
appUserVo
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
findAllByQuery
(
appUserVo
));
}
/**
* 删除
* @param id
* @return
*/
@DeleteMapping
(
"/deleteById/{id}"
)
public
ObjectRestResponse
deleteById
(
@PathVariable
Integer
id
){
baseBiz
.
deleteAppUser
(
id
);
return
ObjectRestResponse
.
succ
();
}
/**
* 查询一条
* @param id
* @return
*/
@GetMapping
(
"/findOneById/{id}"
)
public
ObjectRestResponse
<
AppUserVo
>
findOneById
(
@PathVariable
Integer
id
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
findOneById
(
id
));
}
@PostMapping
(
"/save"
)
public
ObjectRestResponse
save
(
@RequestBody
AppUserVo
appUserVo
){
baseBiz
.
save
(
appUserVo
);
return
ObjectRestResponse
.
succ
();
}
}
ace-modules/ace-admin/src/main/resources/mapper/AppUserDetailMapper.xml
View file @
2454e585
...
...
@@ -28,6 +28,91 @@
<select
id=
"getUserInfo"
resultMap=
"AppUserVoMap"
>
select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.* from app_user_login l
left join app_user_detail d
on d.userid = l.id
where d.userid = #{userId} limit 1
where d.userid = #{userId} limit 1
</select>
<select
id=
"selectAppUserManage"
parameterType=
"Integer"
resultMap=
"AppUserVoMap"
>
select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.* from app_user_login l
left join app_user_detail d
on d.userid = l.id where 1=1
<if
test=
"id != null"
>
and d.id =#{id}
</if>
<if
test=
"userid != null"
>
and d.userid = #{userId}
</if>
<if
test=
"username != null"
>
and l.username=#{username}
</if>
<if
test=
"imUserd != null"
>
and l.im_userid=#{imUserid}
</if>
<if
test=
"wxOpenid != null"
>
and l.wx_openid=#{wxOpenid}
</if>
<if
test=
"unionid != null"
>
and l.unionid=#{unionid}
</if>
<if
test=
"openid != null"
>
and l.openid=#{openid}
</if>
<if
test=
"status != null"
>
and l.status=#{status}
</if>
<if
test=
"idNumber != null"
>
and l.id_number=#{idNumber}
</if>
<if
test=
"certificationStatus != null"
>
and l.certification_status=#{certificationStatus}
</if>
<if
test=
"isMember != null"
>
and d.is member=#{isMember}
</if>
<if
test=
"nickname != null"
>
and d.nickname=#{nickname}
</if>
<if
test=
"realname != null"
>
and d.realname=#{realname}
</if>
<if
test=
"email != null"
>
and d.email=#{email}
</if>
<if
test=
"sex != null"
>
and d.sex=#{sex}
</if>
<if
test=
"birthday != null"
>
and d.birthday=#{birthday}
</if>
<if
test=
"personSign != null"
>
and d.person_sign=#{personSign}
</if>
<if
test=
"remark != null"
>
and d.remark=#{remark}
</if>
</select>
</mapper>
\ No newline at end of file
ace-modules/ace-admin/src/main/resources/mapper/AppUserMapper.xml
View file @
2454e585
...
...
@@ -21,4 +21,6 @@
right join app_group_member agm on bg.id = agm.group_id
where user_id = #{id}
</select>
</mapper>
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodDetailBiz.java
View file @
2454e585
...
...
@@ -78,6 +78,8 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
//获取出行时间
List
<
TourDepartTimeVo
>
timelist
=
priceMapper
.
getAllByGoodId
(
id
);
detailVo
.
setTourDepartTimeVo
(
timelist
);
Integer
stock
=
priceMapper
.
getTotalStock
(
id
);
detailVo
.
setStock
(
stock
);
//获取出发地点
List
<
TourDepartVo
>
departList
=
siteMapper
.
getlistByGoodId
(
id
);
detailVo
.
setTourDepartVo
(
departList
);
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/mapper/TourGoodSpePriceMapper.java
View file @
2454e585
...
...
@@ -18,6 +18,9 @@ public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
List
<
TourDepartTimeVo
>
getAllByGoodId
(
@Param
(
"goodId"
)
Integer
goodId
);
//获取总库存
Integer
getTotalStock
(
@Param
(
"goodId"
)
Integer
goodId
);
//减库存
int
updStockById
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"number"
)
Integer
number
,
@Param
(
"type"
)
Integer
type
);
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourUserController.java
View file @
2454e585
...
...
@@ -34,7 +34,7 @@ public class TourUserController extends TourBaseController<TourUserBiz> {
@GetMapping
(
"/app/unauth/getTourUser/{isChild}"
)
public
ObjectRestResponse
findListByTourUserByIsChild
(
@PathVariable
int
isChild
){
AppUserDTO
userInfo
=
getUserInfo
();
Integer
id
=
userInfo
.
get
I
d
();
Integer
id
=
userInfo
.
get
Useri
d
();
List
<
TourUser
>
tourUsers
=
baseBiz
.
findListByTourUserByIsChild
(
id
,
isChild
);
return
ObjectRestResponse
.
succ
(
tourUsers
);
...
...
@@ -115,7 +115,7 @@ public class TourUserController extends TourBaseController<TourUserBiz> {
if
(
userInfo
==
null
||
userInfo
.
getUserid
()==
null
||
userInfo
.
getUserid
()==
0
)
{
ObjectRestResponse
.
createDefaultFail
();
}
Integer
id
=
userInfo
.
get
I
d
();
Integer
id
=
userInfo
.
get
Useri
d
();
List
<
TourUser
>
tourUsers
=
baseBiz
.
getTourUser
(
id
);
return
ObjectRestResponse
.
succ
(
tourUsers
);
}
...
...
xx-tour/xx-tour-server/src/main/resources/mapper/TourGoodSpePriceMapper.xml
View file @
2454e585
...
...
@@ -41,6 +41,11 @@
FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0 ORDER BY start_time
</select>
<!-- 获取出行时间 -->
<select
id=
"getTotalStock"
resultType=
"Integer"
>
SELECT IFNULL(SUM(stock),0) as stock FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0 and IFNULL(DATEDIFF(start_time,NOW()),0)>0
</select>
<!-- 减库存-->
<update
id=
"updStockById"
>
update tour_good_spe_price set
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/api/ITrafficViolationsFeign.java
0 → 100644
View file @
2454e585
package
com
.
xxfc
.
platform
.
universal
.
api
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.universal.model.JuheResult
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
//@FeignClient(name = "xx-universal")
@RequestMapping
(
"/3p/tv"
)
public
interface
ITrafficViolationsFeign
{
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/api/ITrafficViolationsService.java
deleted
100644 → 0
View file @
d2cfcea9
package
com
.
xxfc
.
platform
.
universal
.
api
;
import
com.xxfc.platform.universal.model.JuheResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
@FeignClient
(
"xx-third-party"
)
@RequestMapping
(
"3p/tv"
)
public
interface
ITrafficViolationsService
{
/**
* 获取支持的城市
* @param province
* @return
*/
@RequestMapping
(
value
=
"city"
,
method
=
RequestMethod
.
GET
)
JuheResult
getCityInfo
(
String
province
);
/**
* 查违章
* @param city 城市代码
* @param hphm 车牌号码
* @param hpzl 车辆类型 01:大车,02:小车
* @param engineno 发动机号
* @param classno 车架号
* @return
*/
@RequestMapping
(
value
=
"trafficViolations"
,
method
=
RequestMethod
.
GET
)
JuheResult
queryTrafficViolations
(
String
city
,
String
hphm
,
String
hpzl
,
String
engineno
,
String
classno
);
/**
* 获取剩余查询次数
* @return
*/
@RequestMapping
(
value
=
"balance"
,
method
=
RequestMethod
.
GET
)
JuheResult
getBalance
();
/**
* 根据车牌查归属地
* @param hphm 车牌号码
* @return
*/
@RequestMapping
(
value
=
"carPre"
,
method
=
RequestMethod
.
GET
)
JuheResult
carPre
(
String
hphm
);
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/searchableCity.java
0 → 100644
View file @
2454e585
package
com
.
xxfc
.
platform
.
universal
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
tk.mybatis.mapper.annotation.KeySql
;
import
tk.mybatis.mapper.code.IdentityDialect
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
java.util.Date
;
@Data
public
class
searchableCity
{
@Id
@KeySql
(
dialect
=
IdentityDialect
.
MYSQL
)
private
Integer
id
;
private
String
code
;
@Column
(
name
=
"city_name"
)
private
String
cityName
;
@Column
(
name
=
"create_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT-8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createDate
;
@Column
(
name
=
"update_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT-8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateDate
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/ThirdFeign.java
View file @
2454e585
...
...
@@ -5,11 +5,9 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import
com.xxfc.platform.universal.entity.OrderRefund
;
import
com.xxfc.platform.universal.vo.OrderPayVo
;
import
com.xxfc.platform.universal.vo.OrderRefundVo
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -30,4 +28,25 @@ public interface ThirdFeign {
@RequestMapping
(
value
=
"/refund/app/wx"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
<
String
>
refund
(
@RequestBody
OrderRefundVo
orderRefundVo
);
/**
* 获取支持的城市
* @return
*/
@GetMapping
(
"/city"
)
ObjectRestResponse
getCityInfo
();
/**
* 违章车辆查询
* @return
*/
@PostMapping
(
"/trafficViolations"
)
ObjectRestResponse
queryTrafficViolations
(
@RequestBody
TrafficViolations
trafficViolations
)
;
/**
* 车辆类型查询
* @return
*/
@GetMapping
(
"/LicensePlateType"
)
ObjectRestResponse
getLicensePlateType
();
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/TrafficViolations.java
0 → 100644
View file @
2454e585
package
com
.
xxfc
.
platform
.
universal
.
vo
;
import
lombok.Data
;
@Data
public
class
TrafficViolations
{
/**
* 车牌类型
*/
private
String
type
;
/**
* 车牌号码
*/
private
String
plateno
;
/**
* 发动机号
*/
private
String
engineno
;
/**
* 车架号
*/
private
String
frameno
;
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/UniversalApplication.java
View file @
2454e585
...
...
@@ -19,7 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAceCache
@EnableTransactionManagement
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.universal.mapper"
)
@EnableFeignClients
(
value
=
{
"com.
github.wxiaoqi.security.auth.client.feign"
,
"com.xxfc.platform"
,
"com.github.wxiaoqi.security.admin.feign
"
},
defaultConfiguration
=
HeaderConfig
.
class
)
@EnableFeignClients
(
value
=
{
"com.
xxfc.platform"
,
"com.github.wxiaoqi.security
"
},
defaultConfiguration
=
HeaderConfig
.
class
)
public
class
UniversalApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/TrafficViolationsController.java
View file @
2454e585
package
com
.
xxfc
.
platform
.
universal
.
controller
;
import
com.
xxfc.platform.universal.api.ITrafficViolationsService
;
import
com.
xxfc.platform.universal.model.JuheResult
;
import
com.
alibaba.fastjson.JSONObject
;
import
com.
github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.universal.service.TrafficViolationsService
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"3p/tv"
)
public
class
TrafficViolationsController
{
//implements ITrafficViolationsService {
// @Autowired
// TrafficViolationsService tvService;
//
// @Override
// @GetMapping("city")
// public JuheResult getCityInfo(String province) {
// return tvService.getCity(province);
// }
//
// @Override
// @GetMapping("trafficViolations")
// public JuheResult queryTrafficViolations(String city, String hphm, String hpzl, String engineno, String classno) {
// return tvService.queryViolations(city, hphm, hpzl, engineno, classno);
// }
//
// @Override
// @GetMapping("balance")
// public JuheResult getBalance() {
// return tvService.queryBalance();
// }
//
// @Override
// @GetMapping("carPre")
// public JuheResult carPre(String hphm) {
// return tvService.queryCityByHphm(hphm);
// }
@Autowired
TrafficViolationsService
tvService
;
/**
* 获取支持的城市
* @return
*/
@GetMapping
(
"/city"
)
public
ObjectRestResponse
getCityInfo
()
{
try
{
return
ObjectRestResponse
.
succ
(
JSONObject
.
parse
(
tvService
.
getCity
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
/**
* 违章车辆查询
* @return
*/
@PostMapping
(
"/trafficViolations"
)
public
ObjectRestResponse
queryTrafficViolations
(
@RequestBody
TrafficViolations
trafficViolations
)
{
try
{
return
ObjectRestResponse
.
succ
(
JSONObject
.
parse
(
tvService
.
queryViolations
(
trafficViolations
)));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
/**
* 车辆类型查询
* @return
*/
@GetMapping
(
"/LicensePlateType"
)
public
ObjectRestResponse
getLicensePlateType
()
{
try
{
return
ObjectRestResponse
.
succ
(
JSONObject
.
parse
(
tvService
.
getLicensePlateType
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/TrafficViolationsService.java
View file @
2454e585
package
com
.
xxfc
.
platform
.
universal
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.xxfc.platform.universal.model.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xxfc.platform.universal.entity.searchableCity
;
import
com.xxfc.platform.universal.utils.CertifHttpUtils
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Schedules
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.UnsupportedEncodingException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 违章查询
* 注意:调用"北京库斯曼科技有限公司"的接口,返回参是Unicode编码
*/
//
@Service
@Service
public
class
TrafficViolationsService
{
@Value
(
"${juhe.key}"
)
private
String
KEY
;
//支持的城市
private
static
final
String
URL_GET_CITY
=
"http://v.juhe.cn/wz/citys?"
+
"province={province}&dtype={dtype}&format={format}&callback={callback}&key={key}"
;
//查违章
private
static
final
String
URL_QUERY_WZ
=
"http://v.juhe.cn/wz/query?"
+
"dtype={dtype}&city={city}&hphm={hphm}&hpzl={hpzl}&engineno={engineno}&classno={classno}&key={key}"
;
//剩余次数
private
static
final
String
URL_BALANCE
=
"http://v.juhe.cn/wz/status?"
+
"dtype={dtype}&key={key}"
;
//根据车牌查城市
private
static
final
String
URL_CAR_PRE
=
"http://v.juhe.cn/wz/carPre?"
+
"hphm={hphm}&key={key}"
;
@Autowired
RestTemplate
restTemplate
;
@Value
(
"${ALIYUN.CODE}"
)
private
String
CODE
;
@Value
(
"${RETURN.TYPE}"
)
private
String
TYPE
;
private
static
final
String
CITY_HOST
=
"https://weizhang.market.alicloudapi.com"
;
private
static
final
String
CITY_PATH
=
"/wz/province"
;
private
static
final
String
CITY_METHOD
=
"GET"
;
private
static
final
String
VIOLATIONS_HOST
=
"https://weizhang.market.alicloudapi.com"
;
private
static
final
String
VIOLATIONS_PATH
=
"/wz/query"
;
private
static
final
String
VIOLATIONS_METHOD
=
"GET"
;
private
static
final
String
GET_LICENSE_PLATE_TYPE_HOST
=
"https://weizhang.market.alicloudapi.com"
;
private
static
final
String
GET_LICENSE_PLATE_TYPE_PATH
=
"/wz/type"
;
private
static
final
String
GET_LICENSE_PLATE_TYPE_METHOD
=
"GET"
;
private
static
final
String
TYPE_NAME
=
"type"
;
private
static
final
String
PLATENO_NAME
=
"plateno"
;
private
static
final
String
ENGINENO_NAME
=
"engineno"
;
private
static
final
String
FRAMENO_NAME
=
"frameno"
;
private
static
final
String
AUTHORIZATION
=
"Authorization"
;
/**
* 获取支持城市
* province string N 默认全部,省份简写,如:ZJ、JS
* dtype string N 返回数据格式:json或xml或jsonp,默认json
* format int N 格式选择1或2,默认1
* callback String N 返回格式选择jsonp时,必须传递
* {"resultcode":"101","reason":"error key","result":null,"error_code":10001}
* 支持城市
*
* @return
* @throws Exception type 返回参数类型
*/
public
JuheResult
<
Map
<
String
,
JuheTrafficViolationsProvinceInfo
>>
getCity
(
String
province
)
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"province"
,
province
==
null
?
""
:
province
);
paramsMap
.
put
(
"dtype"
,
"json"
);
paramsMap
.
put
(
"format"
,
""
);
paramsMap
.
put
(
"callback"
,
""
);
return
query
(
URL_GET_CITY
,
paramsMap
);
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
public
String
getCity
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>();
querys
.
put
(
TYPE_NAME
,
TYPE
);
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
CITY_HOST
,
CITY_PATH
,
CITY_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
String
result
=
EntityUtils
.
toString
(
entity
);
JSONObject
.
parseObject
(
result
,
searchableCity
.
class
);
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
/**
* 查违章
* dtype string 否 返回数据格式:默认:json
* city String 是 城市代码 *
* hphm String 是 号牌号码 完整7位 ,需要utf8 urlencode*
* hpzl String 是 号牌类型,默认02:小型车,01:大型车
* engineno String 否 发动机号 (具体是否需要根据城市接口中的参数填写)
* classno String 否 车架号 (具体是否需要根据城市接口中的参数填写)
* 违章车辆查询
*
* @param trafficViolations
* @return
*/
public
JuheResult
<
JuheTrafficViolationsInfo
>
queryViolations
(
String
city
,
String
hphm
,
String
hpzl
,
String
engineno
,
String
classno
)
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>(
);
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"dtype"
,
"json"
);
paramsMap
.
put
(
"city"
,
city
);
paramsMap
.
put
(
"hphm"
,
hphm
);
paramsMap
.
put
(
"hpzl"
,
hpzl
);
paramsMap
.
put
(
"engineno"
,
engineno
);
paramsMap
.
put
(
"classno"
,
classno
);
return
query
(
URL_QUERY_WZ
,
paramsMap
);
public
String
queryViolations
(
TrafficViolations
trafficViolations
)
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>(
);
querys
.
put
(
TYPE_NAME
,
trafficViolations
.
getType
()
);
querys
.
put
(
PLATENO_NAME
,
trafficViolations
.
getPlateno
()
);
querys
.
put
(
ENGINENO_NAME
,
trafficViolations
.
getEngineno
()
);
querys
.
put
(
FRAMENO_NAME
,
trafficViolations
.
getFrameno
()
);
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
VIOLATIONS_HOST
,
VIOLATIONS_PATH
,
VIOLATIONS_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
(
);
return
unicodeToString
(
EntityUtils
.
toString
(
entity
)
);
}
/**
* 查询剩余次数
* 查询车牌类型
*
* @return
* @throws Exception
*
*/
public
JuheResult
<
JuheTrafficViolationsBalanceInfo
>
queryBalance
()
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"dtype"
,
"json"
);
return
query
(
URL_BALANCE
,
paramsMap
);
public
String
getLicensePlateType
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
HashMap
<
String
,
String
>
querys
=
new
HashMap
<>();
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
GET_LICENSE_PLATE_TYPE_HOST
,
GET_LICENSE_PLATE_TYPE_PATH
,
GET_LICENSE_PLATE_TYPE_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
/**
* 根据车牌前缀查城市参数
* Unicode转汉字字符串
* @param str
* @return
*/
public
JuheResult
<
JuheCarPreInfo
>
queryCityByHphm
(
String
hphm
)
{
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"key"
,
KEY
);
paramsMap
.
put
(
"hphm"
,
hphm
);
return
query
(
URL_CAR_PRE
,
paramsMap
);
}
private
JuheResult
query
(
String
url
,
Map
<
String
,
String
>
paramsMap
)
{
try
{
String
responseStr
=
restTemplate
.
getForObject
(
url
,
String
.
class
,
paramsMap
);
return
JSON
.
parseObject
(
responseStr
,
JuheResult
.
class
);
}
catch
(
RestClientException
ex
)
{
JuheResult
result
=
new
JuheResult
();
result
.
setReason
(
"请求错误"
);
result
.
setResultcode
(
"500"
);
return
result
;
private
String
unicodeToString
(
String
str
)
{
Pattern
pattern
=
Pattern
.
compile
(
"(\\\\u(\\p{XDigit}{4}))"
);
Matcher
matcher
=
pattern
.
matcher
(
str
);
char
ch
;
while
(
matcher
.
find
())
{
String
group
=
matcher
.
group
(
2
);
ch
=
(
char
)
Integer
.
parseInt
(
group
,
16
);
String
group1
=
matcher
.
group
(
1
);
str
=
str
.
replace
(
group1
,
ch
+
""
);
}
return
str
;
}
}
xx-universal/xx-universal-server/src/main/resources/application.properties
View file @
2454e585
#\u8BA4\u8BC1\u63A5\u53E3\u9700\u8981\u643A\u5E26\u7684\u53C2\u6570
#A\u8BA4\u8BC1
#A-\u8BA4\u8BC1
certif.cHost
=
https://idcert.market.alicloudapi.com
certif.cPath
=
/idcard
certif.cMethod
=
GET
certif.cAppcode
=
acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u8EAB\u4EFD\u8BC1\u53F7\u5B57\u6BB5\u540D\u79F0
certif.idCardName
=
idCard
#\u59D3\u540D\u5B57\u6BB5\u540D\u79F0
certif.cName
=
name
#2.\u54CD\u5E94
#\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.certifRet
=
status
#\u8BA4\u8BC1\u6210\u529F\u7801
certif.certifResultCode
=
01
#B\u56FE\u7247\u89E3\u6790
#B-\u56FE\u7247\u89E3\u6790
certif.iHost
=
https://ocridcard.market.alicloudapi.com
certif.iPath
=
/idimages
certif.iPath
=
/idimages
certif.iMethod
=
POST
certif.iAppcode
=
acea1c8811f748b3a65815f11db357c4
certif.iAppcode
=
acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u56FE\u7247url\u5B57\u6BB5\u540D
certif.picName
=
image
...
...
@@ -34,7 +28,6 @@ certif.typeName=idCardSide
certif.frontParameter
=
front
#\u56FE\u7247\u80CC\u9762\u6807\u8BC6\u53C2\u6570
certif.backParameter
=
back
#2.\u54CD\u5E94
#\u56FE\u7247\u89E3\u6790\u54CD\u5E94\u643A\u5E26\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.imageRet
=
code
...
...
@@ -48,3 +41,9 @@ certif.numberName=code
certif.iName
=
name
#\u8EAB\u4EFD\u8BC1\u5230\u671F\u65F6\u95F4\u5B57\u6BB5\u540D
certif.expirationDateName
=
expiryDate
#C-\u8FDD\u7AE0\u8F66\u8F86\u67E5\u8BE2
#\u63A5\u53E3appcode
ALIYUN.CODE
=
acea1c8811f748b3a65815f11db357c4
#\u8FD4\u56DE\u53C2\u6570\u7C7B\u578B(HTML/JSON/JSONP/XML)
RETURN.TYPE
=
JSON
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/AccompanyingItemController.java
View file @
2454e585
...
...
@@ -13,33 +13,39 @@ import com.xxfc.platform.vehicle.pojo.AddOrUpdateAccompanyingItem;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.vehicle.pojo.QueryAccompanyItemVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @author Administrator
*/
@RestController
@RequestMapping
(
"/accompanyingItem"
)
@IgnoreClientToken
@Slf4j
public
class
AccompanyingItemController
extends
BaseController
<
AccompanyingItemBiz
>
{
@Autowired
AccompanyingItemBiz
accompanyingItemBiz
;
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
private
RestResponse
<
AccompanyingItem
>
get
(
@PathVariable
Integer
id
)
throws
Exception
{
/**
*
* @param id
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/{id}"
)
public
RestResponse
<
AccompanyingItem
>
get
(
@PathVariable
Integer
id
)
throws
Exception
{
return
RestResponse
.
codeAndData
(
RestResponse
.
SUC_CODE
,
baseBiz
.
get
(
id
));
}
@RequestMapping
(
value
=
"/all"
,
method
=
RequestMethod
.
GET
)
p
rivate
RestResponse
<
List
<
AccompanyingItem
>>
getAll
(){
return
RestResponse
.
codeAndData
(
RestResponse
.
SUC_CODE
,
accompanyingItem
Biz
.
getAll
());
p
ublic
RestResponse
<
List
<
AccompanyingItem
>>
getAll
(){
return
RestResponse
.
codeAndData
(
RestResponse
.
SUC_CODE
,
base
Biz
.
getAll
());
}
@RequestMapping
(
value
=
"/page"
,
method
=
RequestMethod
.
GET
)
p
rivate
RestResponse
<
PageDataVO
<
AccompanyingItem
>>
getByPage
(
@RequestParam
String
queryAccompanyItemVoJson
)
throws
Exception
{
p
ublic
RestResponse
<
PageDataVO
<
AccompanyingItem
>>
getByPage
(
@RequestParam
String
queryAccompanyItemVoJson
)
throws
Exception
{
QueryAccompanyItemVo
queryAccompanyItemVo
=
null
;
try
{
queryAccompanyItemVo
=
JSON
.
parseObject
(
queryAccompanyItemVoJson
,
QueryAccompanyItemVo
.
class
);
...
...
@@ -52,17 +58,17 @@ public class AccompanyingItemController extends BaseController<AccompanyingItemB
}
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
p
rivate
RestResponse
<
Integer
>
add
(
@RequestBody
AddOrUpdateAccompanyingItem
addOrUpdateAccompanyingItem
)
throws
Exception
{
p
ublic
RestResponse
<
Integer
>
add
(
@RequestBody
AddOrUpdateAccompanyingItem
addOrUpdateAccompanyingItem
)
throws
Exception
{
return
baseBiz
.
add
(
addOrUpdateAccompanyingItem
);
}
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
PUT
)
p
rivate
RestResponse
<
Integer
>
update
(
@RequestBody
AddOrUpdateAccompanyingItem
addOrUpdateAccompanyingItem
)
throws
Exception
{
p
ublic
RestResponse
<
Integer
>
update
(
@RequestBody
AddOrUpdateAccompanyingItem
addOrUpdateAccompanyingItem
)
throws
Exception
{
return
baseBiz
.
update
(
addOrUpdateAccompanyingItem
);
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
p
rivate
RestResponse
<
Integer
>
del
(
@PathVariable
Integer
id
)
throws
Exception
{
p
ublic
RestResponse
<
Integer
>
del
(
@PathVariable
Integer
id
)
throws
Exception
{
return
baseBiz
.
del
(
id
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/AreaController.java
View file @
2454e585
...
...
@@ -12,12 +12,18 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
/**
* 片区
*/
@RestController
@RequestMapping
(
"/area"
)
@Slf4j
@IgnoreClientToken
public
class
AreaController
extends
BaseController
<
AreaBiz
,
Area
>
{
/**
* 获取所有片区
* @return
*/
@GetMapping
(
"/findAll"
)
public
RestResponse
<
List
<
Area
>>
findAll
(){
return
RestResponse
.
suc
(
baseBiz
.
selectListAll
());
...
...
xx-vehicle/xx-vehicle-server/src/test/java/com/xxfc/platform/vehicle/RegionTest.java
View file @
2454e585
...
...
@@ -13,6 +13,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.github.stuxuhai.jpinyin.PinyinHelper
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.google.common.collect.Sets
;
import
com.mysql.cj.conf.RuntimeProperty
;
import
com.xxfc.platform.vehicle.VehicleApplication
;
import
com.xxfc.platform.vehicle.biz.SysRegionBiz
;
import
com.xxfc.platform.vehicle.constant.RedisKey
;
...
...
@@ -29,9 +31,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.io.PrintStream
;
import
java.util.*
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
={
VehicleApplication
.
class
})
...
...
@@ -163,4 +164,31 @@ public class RegionTest {
// }
@Test
public
void
testStream
(){
List
<
Integer
>
integers
=
Arrays
.
asList
(
1
,
3
,
5
,
7
,
9
,
9
);
HashSet
<
Integer
>
objects
=
new
HashSet
<>();
objects
.
addAll
(
integers
);
System
.
out
.
println
(
objects
);
System
.
out
.
println
(
"获取最小值"
);
Optional
<
Integer
>
min
=
objects
.
parallelStream
().
min
(
Integer:
:
compareTo
);
if
(
min
.
isPresent
())
{
System
.
out
.
println
(
min
.
get
());
}
System
.
out
.
println
(
"获取最大"
);
Optional
<
Integer
>
max
=
integers
.
parallelStream
().
max
(
Integer:
:
compareTo
);
if
(
max
.
isPresent
())
{
System
.
out
.
println
(
max
.
get
());
}
System
.
out
.
println
(
"排序"
);
integers
.
stream
().
sorted
().
forEach
(
elem
->
System
.
out
.
println
(
elem
));
System
.
out
.
println
(
"筛选"
);
integers
.
parallelStream
().
filter
(
e
->
e
>
1
).
filter
(
e
->
e
<
9
).
forEach
(
e
->
System
.
out
.
println
(
e
));
System
.
out
.
println
(
"list的总和为"
);
integers
.
stream
().
reduce
((
a
,
b
)
->
a
+
b
).
ifPresent
(
System
.
out
::
println
);
}
}
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