Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
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
吴学德
gdtel-gztel-school-center
Commits
edce0a6c
Commit
edce0a6c
authored
Mar 06, 2020
by
黄森林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app开发
parent
640da9e1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
615 additions
and
39 deletions
+615
-39
apply-net/src/main/java/com/winsun/controller/PackageNewClothes.java
+231
-15
apply-net/src/main/java/com/winsun/controller/PackageUpgradeController.java
+3
-4
common/src/main/java/com/winsun/constant/FilePath.java
+26
-14
common/src/main/java/com/winsun/mapper/PackageUpgradeMapper.java
+3
-0
common/src/main/java/com/winsun/utils/HttpHelper.java
+176
-0
common/src/main/java/com/winsun/utils/MD5Utils.java
+53
-0
common/src/main/java/com/winsun/utils/XbkUtil.java
+123
-0
service-manager/src/main/java/com/winsun/controller/PackageController.java
+0
-6
No files found.
apply-net/src/main/java/com/winsun/controller/PackageNewClothes.java
View file @
edce0a6c
package
com
.
winsun
.
controller
;
package
com
.
winsun
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.bean.Order
;
import
com.winsun.bean.Order
;
import
com.winsun.bean.Package
;
import
com.winsun.bean.Package
;
import
com.winsun.bean.School
;
import
com.winsun.bean.SysUser
;
import
com.winsun.bean.SysUser
;
import
com.winsun.constant.FilePath
;
import
com.winsun.constant.OrderStatus
;
import
com.winsun.constant.OrderStatus
;
import
com.winsun.constant.UserType
;
import
com.winsun.constant.UserType
;
import
com.winsun.mapper.*
;
import
com.winsun.mapper.*
;
import
com.winsun.utils.IDCardUtil
;
import
com.winsun.utils.FileUtil
;
import
com.winsun.utils.XbkUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -33,18 +39,20 @@ public class PackageNewClothes {
...
@@ -33,18 +39,20 @@ public class PackageNewClothes {
private
static
PackageMapper
packageMapper
;
private
static
PackageMapper
packageMapper
;
private
static
SchoolMapper
schoolMapper
;
private
static
OrderMapper
orderMapper
;
private
static
OrderMapper
orderMapper
;
private
static
SysUserMapper
userMapper
;
private
static
SysUserMapper
userMapper
;
@Autowired
@Autowired
public
PackageNewClothes
(
PackageUpgradeMapper
packageUpgradeMapper
,
PackageMapper
packageMapper
,
OrderMapper
orderMapper
public
PackageNewClothes
(
PackageUpgradeMapper
packageUpgradeMapper
,
PackageMapper
packageMapper
,
,
SysUserMapper
userMapper
)
{
OrderMapper
orderMapper
,
SchoolMapper
schoolMapper
,
SysUserMapper
userMapper
)
{
PackageNewClothes
.
packageUpgradeMapper
=
packageUpgradeMapper
;
PackageNewClothes
.
packageUpgradeMapper
=
packageUpgradeMapper
;
PackageNewClothes
.
packageMapper
=
packageMapper
;
PackageNewClothes
.
packageMapper
=
packageMapper
;
PackageNewClothes
.
orderMapper
=
orderMapper
;
PackageNewClothes
.
orderMapper
=
orderMapper
;
PackageNewClothes
.
userMapper
=
userMapper
;
PackageNewClothes
.
userMapper
=
userMapper
;
PackageNewClothes
.
schoolMapper
=
schoolMapper
;
}
}
/**
/**
...
@@ -66,6 +74,31 @@ public class PackageNewClothes {
...
@@ -66,6 +74,31 @@ public class PackageNewClothes {
}
}
/**
/**
* 手机号码获取 JT0001
*
* @param cardId 套餐ID
* @param partner 用户ID
* @return
*/
@RequestMapping
(
value
=
"getNumber"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
JSONObject
>
getNumber
(
@RequestParam
(
"cardId"
)
String
cardId
,
@RequestParam
(
"partner"
)
String
partner
,
@RequestParam
(
value
=
"contNumber"
,
required
=
false
)
String
contNumber
){
Package
aPackage
=
packageMapper
.
selectById
(
cardId
);
String
schoolId
=
packageUpgradeMapper
.
selectSchoolId
(
partner
);
School
school
=
schoolMapper
.
selectById
(
schoolId
);
String
xbId
=
aPackage
.
getXbId
();
String
netId
=
school
.
getNetId
();
JSONObject
jsonObject
=
null
;
try
{
jsonObject
=
XbkUtil
.
getNumberJT0001
(
contNumber
,
xbId
,
netId
);
}
catch
(
Exception
e
){
log
.
info
(
"JT0001获取手机号码接口异常"
,
e
.
getMessage
());
ResponseData
.
error
(
"手机号码获取失败,请重新获取。"
);
}
return
ResponseData
.
success
(
jsonObject
);
}
/**
* 查询套餐详情
* 查询套餐详情
*
*
* @param packageId
* @param packageId
...
@@ -101,10 +134,40 @@ public class PackageNewClothes {
...
@@ -101,10 +134,40 @@ public class PackageNewClothes {
,
@RequestParam
(
"customerName"
)
String
customerName
,
@RequestParam
(
"partner"
)
String
partner
,
@RequestParam
(
"customerName"
)
String
customerName
,
@RequestParam
(
"partner"
)
String
partner
,
@RequestParam
(
value
=
"idCardzs"
)
String
idCardzs
,
@RequestParam
(
value
=
"idCardz"
)
String
idCardz
,
@RequestParam
(
value
=
"idCardf"
)
String
idCardf
,
@RequestParam
(
value
=
"idCardzs"
)
String
idCardzs
,
@RequestParam
(
value
=
"idCardz"
)
String
idCardz
,
@RequestParam
(
value
=
"idCardf"
)
String
idCardf
,
@RequestParam
(
value
=
"remarks"
,
required
=
false
)
String
remarks
,
@RequestParam
(
value
=
"kapin"
)
String
kapin
,
@RequestParam
(
value
=
"remarks"
,
required
=
false
)
String
remarks
,
@RequestParam
(
value
=
"kapin"
)
String
kapin
,
@RequestParam
(
value
=
"idCard"
)
String
idCard
,
@RequestParam
(
value
=
"userSchool"
)
String
userSchool
)
{
,
@RequestParam
(
value
=
"idCard"
)
String
idCard
,
@RequestParam
(
value
=
"userSchool"
)
String
userSchool
){
if
(
contactNumber
.
length
()
!=
11
)
{
if
(
contactNumber
.
length
()
!=
11
)
{
return
ResponseData
.
error
(
"联系号码有误,请重新输入"
);
return
ResponseData
.
error
(
"联系号码有误,请重新输入"
);
}
}
/**
* 身份证验证
*/
JSONObject
jsonObject
=
null
;
try
{
jsonObject
=
XbkUtil
.
idCardCheckJT0005
(
idCard
,
customerName
);
}
catch
(
Exception
e
){
log
.
info
(
"身份证验证接口调用异常"
,
e
.
getMessage
());
}
if
(
jsonObject
==
null
){
return
ResponseData
.
error
(
"身份证验证失败。"
);
}
if
(
"1"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"姓名和身份证信息不匹配。"
);
}
if
(!
"0"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"身份证验证失败。"
);
}
Integer
i
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
10
));
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
timeDate
=
new
Date
();
Integer
age
=
Integer
.
parseInt
(
dateFormat
.
format
(
timeDate
.
getTime
()));
Integer
time16
=
Integer
.
parseInt
(
String
.
valueOf
(
i
+
16
)
+
idCard
.
substring
(
10
,
14
));
Integer
time25
=
Integer
.
parseInt
(
String
.
valueOf
(
i
+
25
)
+
idCard
.
substring
(
10
,
14
));
if
(
age
<
time16
)
{
return
ResponseData
.
error
(
"根据工信部要求,未满16周岁的用户,应由法定代理人代为办理线上入网,如有疑问请联系客服,谢谢。"
);
}
if
(
age
>
time25
)
{
return
ResponseData
.
error
(
"您已满25周岁,不符合办理条件,如有疑问请联系客服,谢谢。"
);
}
Calendar
instance
=
Calendar
.
getInstance
();
Calendar
instance
=
Calendar
.
getInstance
();
instance
.
add
(
Calendar
.
DATE
,
-
94
);
instance
.
add
(
Calendar
.
DATE
,
-
94
);
Date
time
=
instance
.
getTime
();
Date
time
=
instance
.
getTime
();
...
@@ -115,7 +178,7 @@ public class PackageNewClothes {
...
@@ -115,7 +178,7 @@ public class PackageNewClothes {
wrapper
.
eq
(
"user_type"
,
UserType
.
NEWCUSTOMER
.
getId
());
wrapper
.
eq
(
"user_type"
,
UserType
.
NEWCUSTOMER
.
getId
());
List
<
Order
>
orders
=
orderMapper
.
selectList
(
wrapper
);
List
<
Order
>
orders
=
orderMapper
.
selectList
(
wrapper
);
if
(
orders
.
size
()
!=
0
)
{
if
(
orders
.
size
()
!=
0
)
{
return
ResponseData
.
error
(
""
);
return
ResponseData
.
error
(
"
您已经存在新开卡的订单,不能再重复开卡!
"
);
}
}
SysUser
sysUser
=
userMapper
.
selectById
(
partner
);
SysUser
sysUser
=
userMapper
.
selectById
(
partner
);
Order
order
=
new
Order
();
Order
order
=
new
Order
();
...
@@ -133,11 +196,11 @@ public class PackageNewClothes {
...
@@ -133,11 +196,11 @@ public class PackageNewClothes {
order
.
setIdCardzs
(
idCardzs
);
order
.
setIdCardzs
(
idCardzs
);
order
.
setIdCardz
(
idCardz
);
order
.
setIdCardz
(
idCardz
);
order
.
setIdCardf
(
idCardf
);
order
.
setIdCardf
(
idCardf
);
order
.
setStudenCard
(
studentCard
);
order
.
setRemarks
(
remarks
);
order
.
setRemarks
(
remarks
);
Date
date
=
new
Date
();
Date
date
=
new
Date
();
order
.
setCreateTime
(
date
);
order
.
setCreateTime
(
date
);
order
.
setUserType
(
UserType
.
NEWCUSTOMER
.
getId
());
order
.
setUserType
(
UserType
.
NEWCUSTOMER
.
getId
());
order
.
setTjType
(
0
);
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
format
=
yyyyMMdd
.
format
(
date
);
String
format
=
yyyyMMdd
.
format
(
date
);
String
s
=
String
.
valueOf
((
int
)
((
Math
.
random
()
*
9
+
1
)
*
1000
));
String
s
=
String
.
valueOf
((
int
)
((
Math
.
random
()
*
9
+
1
)
*
1000
));
...
@@ -155,7 +218,7 @@ public class PackageNewClothes {
...
@@ -155,7 +218,7 @@ public class PackageNewClothes {
packageUpgradeMapper
.
inserOrderHis
(
id
,
"资料已提交"
,
date
);
packageUpgradeMapper
.
inserOrderHis
(
id
,
"资料已提交"
,
date
);
return
ResponseData
.
success
(
id
);
return
ResponseData
.
success
(
id
);
}
}
return
ResponseData
.
error
(
"
升级
失败!"
);
return
ResponseData
.
error
(
"
开卡
失败!"
);
}
}
/**
/**
...
@@ -193,8 +256,21 @@ public class PackageNewClothes {
...
@@ -193,8 +256,21 @@ public class PackageNewClothes {
/**
/**
* 身份证验证
* 身份证验证
*/
*/
if
(!
IDCardUtil
.
IDCardValidate
(
idCard
))
{
JSONObject
jsonObject1
=
null
;
return
ResponseData
.
error
(
"身份证输入错误!"
);
try
{
jsonObject1
=
XbkUtil
.
idCardCheckJT0005
(
idCard
,
customerName
);
}
catch
(
Exception
e
){
log
.
info
(
"身份证验证接口调用异常"
,
e
.
getMessage
());
}
if
(
jsonObject1
==
null
){
log
.
info
(
"身份证验证接口调用异常"
);
return
ResponseData
.
error
(
"身份证验证失败。"
);
}
if
(
"1"
.
equals
(
jsonObject1
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"姓名和身份证信息不匹配。"
);
}
if
(!
"0"
.
equals
(
jsonObject1
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"身份证验证失败。"
);
}
}
Integer
i
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
10
));
Integer
i
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
10
));
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
...
@@ -218,7 +294,7 @@ public class PackageNewClothes {
...
@@ -218,7 +294,7 @@ public class PackageNewClothes {
wrapper
.
eq
(
"user_type"
,
UserType
.
NEWCUSTOMER
.
getId
());
wrapper
.
eq
(
"user_type"
,
UserType
.
NEWCUSTOMER
.
getId
());
List
<
Order
>
orders
=
orderMapper
.
selectList
(
wrapper
);
List
<
Order
>
orders
=
orderMapper
.
selectList
(
wrapper
);
if
(
orders
.
size
()
!=
0
)
{
if
(
orders
.
size
()
!=
0
)
{
return
ResponseData
.
error
(
""
);
return
ResponseData
.
error
(
"
您已经存在新开卡的订单,不能再重复开卡!
"
);
}
}
SysUser
sysUser
=
userMapper
.
selectById
(
partner
);
SysUser
sysUser
=
userMapper
.
selectById
(
partner
);
Order
order
=
new
Order
();
Order
order
=
new
Order
();
...
@@ -243,7 +319,6 @@ public class PackageNewClothes {
...
@@ -243,7 +319,6 @@ public class PackageNewClothes {
Date
date
=
new
Date
();
Date
date
=
new
Date
();
order
.
setCreateTime
(
date
);
order
.
setCreateTime
(
date
);
order
.
setUserType
(
UserType
.
NEWCUSTOMER
.
getId
());
order
.
setUserType
(
UserType
.
NEWCUSTOMER
.
getId
());
order
.
setTjType
(
0
);
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
format
=
yyyyMMdd
.
format
(
date
);
String
format
=
yyyyMMdd
.
format
(
date
);
String
s
=
String
.
valueOf
((
int
)
((
Math
.
random
()
*
9
+
1
)
*
1000
));
String
s
=
String
.
valueOf
((
int
)
((
Math
.
random
()
*
9
+
1
)
*
1000
));
...
@@ -261,18 +336,159 @@ public class PackageNewClothes {
...
@@ -261,18 +336,159 @@ public class PackageNewClothes {
packageUpgradeMapper
.
inserOrderHis
(
id
,
"资料已提交"
,
date
);
packageUpgradeMapper
.
inserOrderHis
(
id
,
"资料已提交"
,
date
);
return
ResponseData
.
success
(
id
);
return
ResponseData
.
success
(
id
);
}
}
return
ResponseData
.
error
(
"
升级
失败!"
);
return
ResponseData
.
error
(
"
开卡
失败!"
);
}
}
/**
/**
* 新开手机卡 小白卡
* 新开手机卡 小白卡
*
*
* @param site 地址
* @param kapin 套餐名
* @param studentCard 学生卡
* @param remarks 备注
* @param customerName 用户姓名
* @param contactNumber 联系电话
* @param cardId 套餐ID
* @param partner 用户ID
* @param idCard 用户身份证
* @param userSchool 学校
* @param addRess 详细地址
* @param businessNumber 办理号码
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"XiaoBaiCard"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"XiaoBaiCard"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
XiaoBaiCard
()
{
public
ResponseData
<
String
>
XiaoBaiCard
(
@RequestParam
(
"contactNumber"
)
String
contactNumber
,
@RequestParam
(
"site"
)
String
site
return
null
;
,
@RequestParam
(
"studentCard"
)
String
studentCard
,
@RequestParam
(
"cardId"
)
String
cardId
,
@RequestParam
(
"addRess"
)
String
addRess
}
,
@RequestParam
(
"customerName"
)
String
customerName
,
@RequestParam
(
"partner"
)
String
partner
,
@RequestParam
(
"businessNumber"
)
String
businessNumber
,
@RequestParam
(
value
=
"remarks"
,
required
=
false
)
String
remarks
,
@RequestParam
(
value
=
"kapin"
)
String
kapin
,
@RequestParam
(
value
=
"idCard"
)
String
idCard
,
@RequestParam
(
value
=
"userSchool"
)
String
userSchool
)
{
if
(
contactNumber
.
length
()
!=
11
)
{
return
ResponseData
.
error
(
"联系号码有误,请重新输入"
);
}
String
schoolId
=
packageUpgradeMapper
.
selectSchoolId
(
partner
);
School
school
=
schoolMapper
.
selectById
(
schoolId
);
String
netId
=
school
.
getNetId
();
Package
aPackage
=
packageMapper
.
selectById
(
cardId
);
String
xbId
=
aPackage
.
getXbId
();
/**
* 小白卡下单
*/
JSONObject
jsonObject
=
null
;
try
{
jsonObject
=
XbkUtil
.
xbkOrderJT0002
(
cardId
,
partner
,
businessNumber
,
idCard
,
customerName
,
contactNumber
,
xbId
,
netId
);
}
catch
(
Exception
e
){
log
.
info
(
"小白卡下单接口调用异常"
,
e
.
getMessage
());
}
if
(
jsonObject
==
null
){
return
ResponseData
.
error
(
"小白卡下单失败,如有疑问请联系客服,谢谢。"
);
}
if
(!
"0"
.
equals
(
jsonObject
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"小白卡下单失败,如有疑问请联系客服,谢谢。"
);
}
Map
map
=
JSON
.
parseObject
(
jsonObject
.
getString
(
"dataArray"
),
HashMap
.
class
);
/**
* 身份证验证
*/
JSONObject
jsonObject1
=
null
;
try
{
jsonObject1
=
XbkUtil
.
idCardCheckJT0005
(
idCard
,
customerName
);
}
catch
(
Exception
e
){
log
.
info
(
"身份证验证接口调用异常"
,
e
.
getMessage
());
}
if
(
jsonObject1
==
null
){
log
.
info
(
"身份证验证接口调用异常"
);
return
ResponseData
.
error
(
"身份证验证失败。"
);
}
if
(
"1"
.
equals
(
jsonObject1
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"姓名和身份证信息不匹配。"
);
}
if
(!
"0"
.
equals
(
jsonObject1
.
getString
(
"code"
)))
{
return
ResponseData
.
error
(
"身份证验证失败。"
);
}
Integer
i
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
10
));
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
timeDate
=
new
Date
();
Integer
age
=
Integer
.
parseInt
(
dateFormat
.
format
(
timeDate
.
getTime
()));
Integer
time16
=
Integer
.
parseInt
(
String
.
valueOf
(
i
+
16
)
+
idCard
.
substring
(
10
,
14
));
Integer
time25
=
Integer
.
parseInt
(
String
.
valueOf
(
i
+
25
)
+
idCard
.
substring
(
10
,
14
));
if
(
age
<
time16
)
{
return
ResponseData
.
error
(
"根据工信部要求,未满16周岁的用户,应由法定代理人代为办理线上入网,如有疑问请联系客服,谢谢。"
);
}
if
(
age
>
time25
)
{
return
ResponseData
.
error
(
"您已满25周岁,不符合办理条件,如有疑问请联系客服,谢谢。"
);
}
Calendar
instance
=
Calendar
.
getInstance
();
instance
.
add
(
Calendar
.
DATE
,
-
94
);
Date
time
=
instance
.
getTime
();
Wrapper
<
Order
>
wrapper
=
new
EntityWrapper
();
wrapper
.
eq
(
"hehuoren_id"
,
partner
);
wrapper
.
gt
(
"create_time"
,
time
);
wrapper
.
ne
(
"order_status"
,
OrderStatus
.
ACCEPTEXCEPTCION
.
getName
());
wrapper
.
eq
(
"user_type"
,
UserType
.
NEWCUSTOMER
.
getId
());
List
<
Order
>
orders
=
orderMapper
.
selectList
(
wrapper
);
if
(
orders
.
size
()
!=
0
)
{
return
ResponseData
.
error
(
"您已经存在新开卡的订单,不能再重复开卡!"
);
}
SysUser
sysUser
=
userMapper
.
selectById
(
partner
);
Order
order
=
new
Order
();
String
id
=
UUID
.
randomUUID
().
toString
();
order
.
setId
(
id
);
order
.
setIdCard
(
idCard
);
order
.
setXbOrderId
(
map
.
get
(
"orderCode"
).
toString
());
order
.
setOrderStatus
(
"待识别"
);
order
.
setUserSchool
(
userSchool
);
order
.
setHehuorenId
(
partner
);
order
.
setSite
(
site
);
order
.
setKapin
(
kapin
);
order
.
setPackageId
(
cardId
);
order
.
setCustomerName
(
customerName
);
order
.
setContactNumber
(
contactNumber
);
order
.
setRemarks
(
remarks
);
order
.
setAddress
(
addRess
);
order
.
setStudenCard
(
studentCard
);
order
.
setBusinessNumber
(
businessNumber
);
Date
date
=
new
Date
();
order
.
setCreateTime
(
date
);
order
.
setUserType
(
UserType
.
NEWCUSTOMER
.
getId
());
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
format
=
yyyyMMdd
.
format
(
date
);
String
s
=
String
.
valueOf
((
int
)
((
Math
.
random
()
*
9
+
1
)
*
1000
));
order
.
setOrderNumber
(
"YRYM"
+
format
+
s
);
order
.
setHehuorenArea
(
sysUser
.
getSubstName
());
order
.
setHehuorenName
(
sysUser
.
getName
());
order
.
setHehuorenSchool
(
school
.
getSchoolName
());
order
.
setHehuorenPhone
(
sysUser
.
getPhone
());
List
<
String
>
userId
=
packageUpgradeMapper
.
selectsupervisorBySchool
(
schoolId
);
SysUser
user
=
userMapper
.
selectById
(
userId
.
get
(
0
));
order
.
setSupervisorName
(
user
.
getName
());
order
.
setLzgh
(
school
.
getLzgh
());
Integer
insert
=
orderMapper
.
insert
(
order
);
// MessageUtil.sent(contactNumber,"4","");
if
(
insert
==
1
)
{
packageUpgradeMapper
.
inserOrderHis
(
id
,
"资料提交成功,等待上传证件"
,
date
);
return
ResponseData
.
success
(
id
);
}
return
ResponseData
.
error
(
"开卡失败!"
);
}
/**
* 上传图片
* @param file
* @return
*/
@RequestMapping
(
value
=
"uploadPictures"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
uploadPictures
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
"partner"
)
String
partner
)
{
Date
date
=
new
Date
();
String
originalFilename
=
file
.
getOriginalFilename
();
String
picturesType
=
originalFilename
.
substring
(
originalFilename
.
indexOf
(
"."
),
originalFilename
.
length
());
String
backgroundpath
=
FilePath
.
IDCARD
.
getValue
()+
partner
;
String
fileName
=
date
.
getTime
()+
picturesType
;
boolean
makefile
=
FileUtil
.
makefile
(
backgroundpath
,
file
,
fileName
);
if
(!
makefile
){
return
ResponseData
.
error
(
"上传失败!"
);
}
return
ResponseData
.
success
(
backgroundpath
+
"/"
+
fileName
,
"上传成功"
);
}
}
}
apply-net/src/main/java/com/winsun/controller/PackageUpgradeController.java
View file @
edce0a6c
...
@@ -249,6 +249,7 @@ public class PackageUpgradeController extends BaseController {
...
@@ -249,6 +249,7 @@ public class PackageUpgradeController extends BaseController {
order
.
setHehuorenSchool
(
schoolName
);
order
.
setHehuorenSchool
(
schoolName
);
order
.
setHehuorenPhone
(
sysUser
.
getPhone
());
order
.
setHehuorenPhone
(
sysUser
.
getPhone
());
Integer
insert
=
orderMapper
.
insert
(
order
);
Integer
insert
=
orderMapper
.
insert
(
order
);
packageUpgradeMapper
.
inserOrderHis
(
id
,
"下单成功"
,
date
);
// MessageUtil.sent(contactNumber,"4","");
// MessageUtil.sent(contactNumber,"4","");
if
(
StringUtils
.
isNotBlank
(
mark
))
{
if
(
StringUtils
.
isNotBlank
(
mark
))
{
String
id1
=
UUID
.
randomUUID
().
toString
();
String
id1
=
UUID
.
randomUUID
().
toString
();
...
@@ -267,14 +268,12 @@ public class PackageUpgradeController extends BaseController {
...
@@ -267,14 +268,12 @@ public class PackageUpgradeController extends BaseController {
yangChengTong
.
setContactPhone
(
contactNumber
);
yangChengTong
.
setContactPhone
(
contactNumber
);
yangChengTong
.
setCustomerPhone
(
businessNumber
);
yangChengTong
.
setCustomerPhone
(
businessNumber
);
insert
+=
yangChengTongrMapper
.
insert
(
yangChengTong
);
insert
+=
yangChengTongrMapper
.
insert
(
yangChengTong
);
packageUpgradeMapper
.
inserOrderHis
(
id1
,
"下单成功"
,
date
);
return
ResponseData
.
success
(
id
+
":"
+
id1
,
"下单成功!"
);
}
}
if
(
insert
==
1
)
{
if
(
insert
==
1
)
{
packageUpgradeMapper
.
inserOrderHis
(
id
,
"下单成功"
,
date
);
return
ResponseData
.
success
(
id
);
return
ResponseData
.
success
(
id
);
}
}
if
(
insert
==
3
)
{
return
ResponseData
.
success
(
"下单成功!"
);
}
return
ResponseData
.
error
(
"升级失败!"
);
return
ResponseData
.
error
(
"升级失败!"
);
}
}
...
...
common/src/main/java/com/winsun/constant/FilePath.java
View file @
edce0a6c
package
com
.
winsun
.
constant
;
package
com
.
winsun
.
constant
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
*
@Author xuede
*
排序
* @
Date 2020/3/6 9:31
* @
author Liph
* @
Version 1.0
* @
datetime 2019-09-19/9/27 11:19
*/
*/
public
enum
FilePath
{
public
enum
FilePath
{
//
BACKGROUNDIMG
(
"套餐背景图片基础路径"
,
"BackgroundImg"
);
BACKGROUNDIMG
(
"套餐背景图片基础路径"
,
"BackgroundImg"
),
IDCARD
(
"身份证明"
,
"packageNewClothes/images/idCard/"
);
FilePath
(
String
name
,
String
value
){
FilePath
(
String
id
,
String
value
)
{
this
.
name
=
name
;
this
.
id
=
id
;
this
.
value
=
value
;
this
.
value
=
value
;
};
private
static
final
Map
<
String
,
FilePath
>
DATAS
=
new
HashMap
<>();
static
{
Arrays
.
asList
(
values
()).
forEach
(
data
->
DATAS
.
put
(
data
.
getId
(),
data
));
}
}
private
String
name
;
private
String
id
;
private
String
value
;
private
String
value
;
public
String
getId
()
{
public
String
getName
()
{
return
id
;
return
name
;
}
}
public
String
getValue
()
{
public
String
getValue
()
{
return
value
;
return
value
;
}
}
public
static
FilePath
findById
(
String
id
)
{
return
DATAS
.
getOrDefault
(
id
,
null
);
}
}
}
common/src/main/java/com/winsun/mapper/PackageUpgradeMapper.java
View file @
edce0a6c
...
@@ -36,6 +36,9 @@ public interface PackageUpgradeMapper extends BaseMapper<PackageUpgrade> {
...
@@ -36,6 +36,9 @@ public interface PackageUpgradeMapper extends BaseMapper<PackageUpgrade> {
@Select
(
"select school_name schoolName from `hhr_school` where id = #{schoolId}"
)
@Select
(
"select school_name schoolName from `hhr_school` where id = #{schoolId}"
)
String
selectSchoolById
(
String
schoolId
);
String
selectSchoolById
(
String
schoolId
);
@Select
(
"select user_id userId from `hhr_supervisor_school` where school = #{schoolId} ORDER BY user_id asc"
)
List
<
String
>
selectsupervisorBySchool
(
String
schoolId
);
@Select
(
"select package_id packageId from `hhr_school_package` where school_id = #{schoolId}"
)
@Select
(
"select package_id packageId from `hhr_school_package` where school_id = #{schoolId}"
)
List
<
String
>
selectPackageId
(
String
schoolId
);
List
<
String
>
selectPackageId
(
String
schoolId
);
...
...
common/src/main/java/com/winsun/utils/HttpHelper.java
0 → 100644
View file @
edce0a6c
package
com
.
winsun
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.protocol.BasicHttpContext
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
/**
* HTTP请求封装
*
*
*/
public
class
HttpHelper
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
HttpHelper
.
class
);
/**
* @desc :1.发起GET请求
*
* @param url
* @return JSONObject
* @throws Exception
*/
public
static
JSONObject
doGet
(
String
url
)
throws
Exception
{
//1.生成一个请求
HttpGet
httpGet
=
new
HttpGet
(
url
);
//2.配置请求的属性
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
50000
).
setConnectTimeout
(
50000
).
build
();
//2000
httpGet
.
setConfig
(
requestConfig
);
//3.发起请求,获取响应信息
//3.1 创建httpClient
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
null
;
try
{
//3.2 发起请求,获取响应信息
response
=
httpClient
.
execute
(
httpGet
,
new
BasicHttpContext
());
//如果返回结果的code不等于200,说明出错了
if
(
response
.
getStatusLine
().
getStatusCode
()
!=
200
)
{
/* log.info("request url failed, http code=" + response.getStatusLine().getStatusCode()
+ ", url=" + url);*/
return
null
;
}
//4.解析请求结果
HttpEntity
entity
=
response
.
getEntity
();
//reponse返回的数据在entity中
if
(
entity
!=
null
)
{
String
resultStr
=
EntityUtils
.
toString
(
entity
,
"utf-8"
);
//将数据转化为string格式
// log.info("GET请求结果:"+resultStr);
JSONObject
result
=
JSON
.
parseObject
(
resultStr
);
//将String转换为 JSONObject
if
(
result
.
getInteger
(
"errcode"
)==
null
)
{
return
result
;
}
else
if
(
0
==
result
.
getInteger
(
"errcode"
))
{
return
result
;
}
else
{
// log.info("request url=" + url + ",return value="+resultStr);
// log.info(resultStr);
int
errCode
=
result
.
getInteger
(
"errcode"
);
String
errMsg
=
result
.
getString
(
"errmsg"
);
throw
new
Exception
(
"error code:"
+
errCode
+
", error message:"
+
errMsg
);
}
}
}
catch
(
IOException
e
)
{
log
.
info
(
e
.
getMessage
());
}
finally
{
if
(
response
!=
null
)
try
{
response
.
close
();
//释放资源
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(
httpClient
!=
null
){
httpClient
.
close
();
}
}
return
null
;
}
/** 2.发起POST请求
* @desc :
*
* @param url 请求url
* @param data 请求参数(json)
* @return
* @throws Exception JSONObject
*/
public
static
JSONObject
doPost
(
String
url
,
String
data
)
throws
Exception
{
//1.生成一个请求
HttpPost
httpPost
=
new
HttpPost
(
url
);
//2.配置请求属性
//2.1 设置请求超时时间
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
100000
).
setConnectTimeout
(
100000
).
build
();
httpPost
.
setConfig
(
requestConfig
);
//2.2 设置数据传输格式-json
httpPost
.
addHeader
(
"Content-Type"
,
"application/json"
);
//2.3 设置请求实体,封装了请求参数
StringEntity
requestEntity
=
new
StringEntity
(
data
,
"utf-8"
);
httpPost
.
setEntity
(
requestEntity
);
//3.发起请求,获取响应信息
//3.1 创建httpClient
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
null
;
try
{
//3.3 发起请求,获取响应
response
=
httpClient
.
execute
(
httpPost
,
new
BasicHttpContext
());
if
(
response
.
getStatusLine
().
getStatusCode
()
!=
200
)
{
log
.
info
(
"request url failed, http code="
+
response
.
getStatusLine
().
getStatusCode
()
+
", url="
+
url
);
return
null
;
}
//获取响应内容
HttpEntity
entity
=
response
.
getEntity
();
if
(
entity
!=
null
)
{
String
resultStr
=
EntityUtils
.
toString
(
entity
,
"utf-8"
);
// log.info("POST请求结果:"+resultStr);
//解析响应内容
JSONObject
result
=
JSON
.
parseObject
(
resultStr
);
if
(
result
.
getInteger
(
"errcode"
)==
null
)
{
return
result
;
}
else
if
(
0
==
result
.
getInteger
(
"errcode"
))
{
return
result
;
}
else
{
/* log.info("request url=" + url + ",return value="+resultStr);*/
//log.info(resultStr);
int
errCode
=
result
.
getInteger
(
"errcode"
);
String
errMsg
=
result
.
getString
(
"errmsg"
);
throw
new
Exception
(
"error code:"
+
errCode
+
", error message:"
+
errMsg
);
}
}
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
finally
{
if
(
response
!=
null
)
try
{
response
.
close
();
//释放资源
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(
httpClient
!=
null
){
httpClient
.
close
();
}
}
return
null
;
}
}
common/src/main/java/com/winsun/utils/MD5Utils.java
0 → 100644
View file @
edce0a6c
package
com
.
winsun
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
java.math.BigInteger
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
@Slf4j
public
class
MD5Utils
{
/**
* 使用md5的算法进行加密
*/
public
static
String
md5
(
String
plainText
)
{
byte
[]
secretBytes
=
null
;
try
{
secretBytes
=
MessageDigest
.
getInstance
(
"md5"
).
digest
(
plainText
.
getBytes
());
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
RuntimeException
(
"没有md5这个算法!"
);
}
// 16进制数字
String
md5code
=
new
BigInteger
(
1
,
secretBytes
).
toString
(
16
);
// 如果生成数字未满32位,需要前面补0
for
(
int
i
=
0
;
i
<
32
-
md5code
.
length
();
i
++)
{
md5code
=
"0"
+
md5code
;
}
return
md5code
;
}
public
static
String
getDigestStr
(
String
info
)
{
try
{
byte
[]
res
=
info
.
getBytes
();
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
byte
[]
result
=
md
.
digest
(
res
);
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
{
md
.
update
(
result
[
i
]);
}
byte
[]
hash
=
md
.
digest
();
StringBuffer
d
=
new
StringBuffer
(
""
);
for
(
int
i
=
0
;
i
<
hash
.
length
;
i
++)
{
int
v
=
hash
[
i
]
&
0xFF
;
if
(
v
<
16
)
{
d
.
append
(
"0"
);
}
d
.
append
(
Integer
.
toString
(
v
,
16
).
toUpperCase
());
}
return
d
.
toString
();
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
common/src/main/java/com/winsun/utils/XbkUtil.java
0 → 100644
View file @
edce0a6c
package
com
.
winsun
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 小白卡调取接口工具类
* @Author: chancy
* @Date: 2020/3/5 16:26
*/
@Slf4j
public
class
XbkUtil
{
public
static
JSONObject
xbkCreate
(
Map
<
String
,
Object
>
map
,
String
type
){
Map
<
String
,
Object
>
mapParm
=
new
HashMap
<>();
Date
now
=
new
Date
();
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
String
tablename
=
dateFormat
.
format
(
now
);
mapParm
.
put
(
"sysNum"
,
10026
);
mapParm
.
put
(
"intfCode"
,
type
);
mapParm
.
put
(
"eventTime"
,
tablename
);
String
s
=
MD5Utils
.
md5
(
tablename
+
"gzxy951753@.123"
);
mapParm
.
put
(
"sign"
,
s
.
toUpperCase
());
JSONObject
jsonObject
=
httpDoPost
(
map
,
mapParm
,
type
);
return
jsonObject
;
}
public
static
JSONObject
httpDoPost
(
Map
<
String
,
Object
>
map
,
Map
<
String
,
Object
>
mapParm
,
String
type
){
mapParm
.
put
(
"param"
,
map
);
JSONObject
json
=
new
JSONObject
(
mapParm
);
JSONObject
jsonObject
=
null
;
try
{
jsonObject
=
HttpHelper
.
doPost
(
"http://enter.gd189.cn:9090/o2oweb/outMain/service.do"
,
json
.
toString
());
}
catch
(
Exception
e
){
log
.
info
(
type
+
"调取接口异常"
,
e
.
getMessage
());
}
return
jsonObject
;
}
/**
* 小白下单接口 JT0002
*
*
* @param customerName 用户姓名
* @param contactNumber 联系电话
* @param idCard 用户身份证
* @param businessNumber 办理号码
* @param cardId 套餐ID
* @param partner 用户ID
* @return
*/
public
static
JSONObject
xbkOrderJT0002
(
String
cardId
,
String
partner
,
String
businessNumber
,
String
idCard
,
String
customerName
,
String
contactNumber
,
String
xbId
,
String
netId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"prodId"
,
xbId
);
map
.
put
(
"coUserId"
,
netId
);
map
.
put
(
"phoneNumber"
,
businessNumber
);
map
.
put
(
"isDelivery"
,
"0"
);
map
.
put
(
"custName"
,
customerName
);
map
.
put
(
"idCardNo"
,
idCard
);
map
.
put
(
"contactNumber"
,
contactNumber
);
map
.
put
(
"sendSms"
,
"0"
);
map
.
put
(
"openChannel"
,
"WECHAT"
);
String
type
=
"JT0002"
;
JSONObject
jsonObject
=
XbkUtil
.
xbkCreate
(
map
,
type
);
return
jsonObject
;
}
/**
* 身份证校验 JT0005
*
* @param customerName 用户姓名
* @param idCard 用户身份证
* @return
*/
public
static
JSONObject
idCardCheckJT0005
(
String
idCard
,
String
customerName
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"custName"
,
customerName
);
map
.
put
(
"idCardNo"
,
idCard
);
String
type
=
"JT0005"
;
JSONObject
jsonObject
=
XbkUtil
.
xbkCreate
(
map
,
type
);
return
jsonObject
;
}
/**
* 订单详情 JT0006
*
* @param orderCode 订单编号
* @return
*/
public
static
JSONObject
orderInfoJT0006
(
String
orderCode
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"orderCode"
,
orderCode
);
String
type
=
"JT0006"
;
JSONObject
jsonObject
=
XbkUtil
.
xbkCreate
(
map
,
type
);
return
jsonObject
;
}
/**
* 手机号码获取 JT0001
*
* @return
*/
public
static
JSONObject
getNumberJT0001
(
String
contNumber
,
String
xbId
,
String
netId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"prodId"
,
xbId
);
map
.
put
(
"coUserId"
,
netId
);
map
.
put
(
"pageIndex"
,
"0"
);
map
.
put
(
"pageSize"
,
"6"
);
if
(
StringUtils
.
isNotBlank
(
contNumber
))
{
map
.
put
(
"contNumber"
,
contNumber
);
}
String
type
=
"JT0001"
;
JSONObject
jsonObject
=
XbkUtil
.
xbkCreate
(
map
,
type
);
return
jsonObject
;
}
}
service-manager/src/main/java/com/winsun/controller/PackageController.java
View file @
edce0a6c
package
com
.
winsun
.
controller
;
package
com
.
winsun
.
controller
;
import
com.alibaba.druid.sql.visitor.functions.If
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.enums.SqlLike
;
import
com.baomidou.mybatisplus.enums.SqlLike
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
...
@@ -9,7 +7,6 @@ import com.baomidou.mybatisplus.plugins.Page;
...
@@ -9,7 +7,6 @@ import com.baomidou.mybatisplus.plugins.Page;
import
com.winsun.auth.core.annotion.Permission
;
import
com.winsun.auth.core.annotion.Permission
;
import
com.winsun.auth.core.base.controller.BaseController
;
import
com.winsun.auth.core.base.controller.BaseController
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.auth.core.shiro.ShiroUser
;
import
com.winsun.bean.Package
;
import
com.winsun.bean.Package
;
import
com.winsun.bean.SchoolPackage
;
import
com.winsun.bean.SchoolPackage
;
import
com.winsun.constant.FilePath
;
import
com.winsun.constant.FilePath
;
...
@@ -26,9 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -26,9 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.*
;
import
java.util.*
;
/**
/**
...
...
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