Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
55936645
Commit
55936645
authored
Apr 27, 2020
by
东州 翁
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of 120.24.24.239:8timerv2/8timerapiv200 into wdz
parents
da99dd4f
7600ebcf
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
331 additions
and
114 deletions
+331
-114
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxInvoiceData.java
+3
-1
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxOrderRecord.java
+0
-16
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxRemainingQuantity.java
+0
-14
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxScene.java
+6
-5
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxUseRecord.java
+8
-15
src/main/java/cn/timer/api/callback/wx/WxCallBackController.java
+5
-0
src/main/java/cn/timer/api/controller/LoginController.java
+47
-11
src/main/java/cn/timer/api/controller/dzht/DzhtController2.java
+51
-11
src/main/java/cn/timer/api/controller/htzz/HtzzController.java
+30
-6
src/main/java/cn/timer/api/controller/qyzx/QyzxBusinessController.java
+73
-31
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+106
-2
src/main/java/cn/timer/api/utils/schedule/RemindUtil.java
+2
-2
No files found.
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxInvoiceData.java
View file @
55936645
...
...
@@ -80,7 +80,9 @@ public class QyzxInvoiceData extends Model<QyzxInvoiceData>{
private
String
consigneePhone
;
@ApiModelProperty
(
value
=
"邮箱"
,
example
=
"13144400255@163.com"
)
private
String
email
;
@ApiModelProperty
(
value
=
"收货地址"
,
example
=
"白云东平伯曼酒店"
)
@ApiModelProperty
(
value
=
"收货地址省市区"
,
example
=
"广东省/广州市/白云区"
)
private
String
shippingArea
;
@ApiModelProperty
(
value
=
"收货详细地址"
,
example
=
"白云东平伯曼酒店"
)
private
String
shippingAddress
;
@ApiModelProperty
(
value
=
"邮编"
,
example
=
"510080"
)
private
String
zipCode
;
...
...
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxOrderRecord.java
View file @
55936645
...
...
@@ -75,15 +75,6 @@ public class QyzxOrderRecord extends Model<QyzxOrderRecord>{
@ApiModelProperty
(
value
=
"公司"
,
example
=
"117"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"排序"
,
example
=
""
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"模块状态"
,
example
=
"默认0-开启,1-关闭"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"是否删除"
,
example
=
"默认0-未删除,1-删除"
)
private
Integer
isDelete
;
@TableField
(
fill
=
FieldFill
.
INSERT
)
@ApiModelProperty
(
value
=
"创建时间 "
,
example
=
""
)
private
Date
createTime
;
...
...
@@ -91,11 +82,4 @@ public class QyzxOrderRecord extends Model<QyzxOrderRecord>{
@ApiModelProperty
(
value
=
"创建人 "
,
example
=
""
)
private
Integer
createUser
;
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
@ApiModelProperty
(
value
=
"修改时间 "
,
example
=
""
)
private
Date
modifyTime
;
@ApiModelProperty
(
value
=
"修改人 "
,
example
=
""
)
private
Integer
modifyUser
;
}
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxRemainingQuantity.java
View file @
55936645
...
...
@@ -85,12 +85,6 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty
(
value
=
"企业"
,
example
=
"117"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"排序"
,
example
=
""
)
private
String
sort
;
@ApiModelProperty
(
value
=
"模块状态"
,
example
=
"默认0-开启,1-关闭"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"是否删除"
,
example
=
"默认0-未删除,1-删除"
)
private
Integer
isDelete
;
...
...
@@ -101,12 +95,4 @@ public class QyzxRemainingQuantity extends Model<QyzxRemainingQuantity>{
@ApiModelProperty
(
value
=
"创建人 "
,
example
=
""
)
private
Integer
createUser
;
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
@ApiModelProperty
(
value
=
"修改时间 "
,
example
=
""
)
private
Date
modifyTime
;
@ApiModelProperty
(
value
=
"修改人 "
,
example
=
""
)
private
Integer
modifyUser
;
}
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxScene.java
View file @
55936645
...
...
@@ -20,13 +20,14 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public
enum
QyzxScene
{
MSG_LOGIN
(
1
,
"短信登录"
),
MSG_AUTHENTICATION
(
1
,
"短信身份验证"
),
MSG_LOGIN_CONFIRM
(
1
,
"短信登录确认"
),
MSG_REGISTER
(
1
,
"短信用户注册"
),
MSG_CHANGE_PWD
(
1
,
"修改密码"
),
MSG_CHANGE_UNAME
(
1
,
"修改用户名"
),
MSG_CHANGE_PHONE
(
1
,
"修改手机号"
),
MSG_CHANGE_IMP
(
1
,
"修改重要信息"
),
MSG_REMIND
(
1
,
"证照提醒"
),
CONTRACT_SINGLE
(
2
,
"
修改密码
"
),
CONTRACT_BOTH
(
2
,
"
用户注册
"
);
CONTRACT_SINGLE
(
2
,
"
单签
"
),
CONTRACT_BOTH
(
2
,
"
双方签
"
);
private
final
Integer
code
;
private
final
String
message
;
...
...
src/main/java/cn/timer/api/bean/qyzx/businessService/QyzxUseRecord.java
View file @
55936645
...
...
@@ -52,14 +52,17 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
@ApiModelProperty
(
value
=
"主键"
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"模块id"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"模块id
0-无 1-短信 2-电子合同 3-系统续费
"
,
example
=
"1"
)
private
Integer
pmid
;
@ApiModelProperty
(
value
=
"订单号"
,
example
=
"1"
)
private
String
orderNo
;
@ApiModelProperty
(
value
=
"使用场景"
,
example
=
"1"
)
private
Integer
scene
;
private
String
scene
;
@ApiModelProperty
(
value
=
"使用数量"
,
example
=
"1"
)
private
Integer
useNum
;
@ApiModelProperty
(
value
=
"原始总量"
,
example
=
"500"
)
private
Integer
originalTotalNum
;
...
...
@@ -67,12 +70,6 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
@ApiModelProperty
(
value
=
"当前总量"
,
example
=
"499"
)
private
Integer
nowTotalNum
;
@ApiModelProperty
(
value
=
"模块状态"
,
example
=
"默认0-开启,1-关闭"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"排序"
,
example
=
""
)
private
String
sort
;
@ApiModelProperty
(
value
=
"是否删除"
,
example
=
"默认0-未删除,1-删除"
)
private
Integer
isDelete
;
...
...
@@ -81,12 +78,8 @@ public class QyzxUseRecord extends Model<QyzxUseRecord>{
private
Date
createTime
;
@ApiModelProperty
(
value
=
"创建人 "
,
example
=
""
)
private
Integer
createUser
;
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
@ApiModelProperty
(
value
=
"修改时间 "
,
example
=
""
)
private
Date
modifyTime
;
private
String
createUser
;
@ApiModelProperty
(
value
=
"
修改人
"
,
example
=
""
)
private
Integer
modifyUser
;
@ApiModelProperty
(
value
=
"
使用人手机号
"
,
example
=
""
)
private
String
userPhone
;
}
src/main/java/cn/timer/api/callback/wx/WxCallBackController.java
View file @
55936645
...
...
@@ -81,6 +81,10 @@ public class WxCallBackController {
if
(!
env
.
equals
(
"dev"
)
&&
!
env
.
equals
(
"test"
))
{
return
ResultUtil
.
error
(
"请切换到开发/测试环境"
);
}
// TODO 加套餐 如果已经存在可用的套餐 ,怎么搞
updateAndInsert
(
orderNo
);
return
ResultUtil
.
data
(
orderNo
,
"购买成功"
);
}
...
...
@@ -119,6 +123,7 @@ public class WxCallBackController {
quantity
.
setCount
(
count
);
// 购买数量
quantity
.
setPmid
(
pmid
);
// 付费模块id
quantity
.
setPcid
(
pcid
);
// 付费内容id
quantity
.
setUnit
(
unit
);
quantity
.
setCreateUser
(
createdUser
);
quantity
.
setOrgCode
(
orgCode
);
quantity
.
insert
();
...
...
src/main/java/cn/timer/api/controller/LoginController.java
View file @
55936645
...
...
@@ -2,6 +2,7 @@ package cn.timer.api.controller;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Stream
;
...
...
@@ -29,7 +30,8 @@ import cn.hutool.core.util.StrUtil;
import
cn.timer.api.bean.qyzx.QyzxEmpEntAsso
;
import
cn.timer.api.bean.qyzx.QyzxEmpLogin
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.bean.qyzx.QyzxSms
;
import
cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.bean.zzgl.ZzglAuth
;
import
cn.timer.api.bean.zzgl.ZzglBmgwM
;
...
...
@@ -86,36 +88,70 @@ public class LoginController {
@ApiOperation
(
value
=
"1.发送验证码"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
String
>
sendCode
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
String
phone
=
entRegisterDto
.
getPhone
();
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Date
date
=
null
;
Integer
remainder
=
null
;
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
}
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :短信套餐已过期"
);
return
ResultUtil
.
error
(
"短信套餐已到期!"
);
}
// 6位随机数验证码
try
{
Integer
code
=
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
100000
);
AliyunSMS
aliyunSMS
=
new
AliyunSMS
();
String
phone
=
entRegisterDto
.
getPhone
();
if
(
phone
==
null
||
""
.
equals
(
phone
))
{
phone
=
entRegisterDto
.
getUsername
();
entRegisterDto
.
setPhone
(
phone
);
}
JSONObject
j
=
aliyunSMS
.
authCode
(
entRegisterDto
,
entRegisterDto
.
getTc
(),
code
);
// String bizId = (String) j.get("BizId");
// Integer type = entRegisterDto.getMessageType();
// 获取当前日期的字符串格式
String
today
=
DateUtil
.
today
();
// yyyy-MM-dd
today
=
today
.
replace
(
"-"
,
""
);
// 插入
// QyzxSms qyzxSms =
// QyzxSms.builder().orgCode(b?qyzxEmpLogin.getOrgId():null).messageType(type).content(content)
// .createTime(sendDate).phone(phone).build();
// qyzxSmsMapper.insert(qyzxSms);
String
message
=
(
String
)
j
.
get
(
"Message"
);
Thread
.
sleep
(
1000
);
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
parseObject
(
new
AliyunSMS
().
QuerySendDetails
(
phone
,
today
,
j
.
getString
(
"BizId"
)))
.
getJSONObject
(
"SmsSendDetailDTOs"
).
getJSONArray
(
"SmsSendDetailDTO"
).
get
(
0
);
String
templateCode
=
jsonObject
.
getString
(
"TemplateCode"
);
String
phoneNum
=
jsonObject
.
getString
(
"PhoneNum"
);
String
content
=
jsonObject
.
getString
(
"Content"
);
String
sendStatus
=
jsonObject
.
getString
(
"SendStatus"
);
String
sendDate
=
jsonObject
.
getString
(
"SendDate"
);
QyzxSms
qyzxSms
=
new
QyzxSms
();
qyzxSms
.
setContent
(
content
);
qyzxSms
.
setCreateTime
(
new
Date
());
qyzxSms
.
setMessageType
(
entRegisterDto
.
getTc
());
qyzxSms
.
setPhone
(
phoneNum
);
qyzxSms
.
setOrgCode
(
orgCode
);
qyzxSms
.
insert
();
String
message
=
j
.
getString
(
"Message"
);
if
(
"OK"
.
equals
(
message
))
{
session
.
setAttribute
(
phone
,
code
);
// redisTemplate.set(phone, code);
// redisTemplate.expire(phone, 60);
return
ResultUtil
.
success
(
"发送验证码成功"
);
return
ResultUtil
.
data
(
"发送验证码成功"
);
}
else
{
return
ResultUtil
.
error
(
"发送验证码失败"
);
}
...
...
src/main/java/cn/timer/api/controller/dzht/DzhtController2.java
View file @
55936645
...
...
@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -40,6 +41,7 @@ import cn.timer.api.bean.dzht.DzhtAssoQyyz;
import
cn.timer.api.bean.dzht.DzhtAssoQyzc
;
import
cn.timer.api.bean.dzht.DzhtAssoSdgzq
;
import
cn.timer.api.bean.dzht.DzhtAssoTpyz
;
import
cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
...
...
@@ -193,8 +195,7 @@ public class DzhtController2 {
public
Result
<
Object
>
orgTemplate
(
@CurrentUser
UserBean
userBean
,
@RequestBody
DzhtAssoQyyz
qyyz
)
{
String
orgId
=
DzhtAssoQyzc
.
builder
().
build
().
selectOne
(
// new QueryWrapper<DzhtAssoQyzc>().eq("third_party_user_id", qyyz.getThirdPartyUserId()).select("org_id"))
new
QueryWrapper
<
DzhtAssoQyzc
>().
eq
(
"org_code"
,
userBean
.
getOrgCode
()).
select
(
"org_id"
))
.
getOrgId
();
// 查询orgId
new
QueryWrapper
<
DzhtAssoQyzc
>().
eq
(
"org_code"
,
userBean
.
getOrgCode
()).
select
(
"org_id"
)).
getOrgId
();
// 查询orgId
// String orgId = "dfd84b9a58d345ea90f6711bad853435";// 测试公司账户
// 印章参数
String
alias
=
qyyz
.
getAlias
();
...
...
@@ -409,6 +410,25 @@ public class DzhtController2 {
@ApiOperation
(
value
=
"创建签署流程"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
signflows
(
@CurrentUser
UserBean
userBean
,
@RequestBody
DzhtAssoCjlc
lc
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
2
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Integer
remainder
=
null
;
Date
date
=
null
;
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
}
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
return
ResultUtil
.
error
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充值购买后使用"
);
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
return
ResultUtil
.
error
(
"企业 "
+
orgCode
+
" :电子合同套餐已过期"
);
}
// ConfigInfo cfgInfo = new ConfigInfo(null, "1,2", null, null);
// SignFlowStart sfs = new SignFlowStart(null, "测试签署流程开启", null, null, null,
// null, null, cfgInfo);
...
...
@@ -442,7 +462,7 @@ public class DzhtController2 {
lc
.
setFlowId
(
jsonObject
.
getString
(
"flowId"
));
lc
.
setCreater
(
userBean
.
getEmpNum
());
lc
.
setCreatedTime
(
new
Date
());
lc
.
setOrgCode
(
userBean
.
getOrgCode
()
);
lc
.
setOrgCode
(
orgCode
);
lc
.
insert
();
}
catch
(
DefineException
e1
)
{
e1
.
printStackTrace
();
...
...
@@ -647,9 +667,9 @@ public class DzhtController2 {
for
(
DzhtAssoSdgzq
sdgzq
:
sdgzqs
)
{
String
flowId
=
sdgzq
.
getFlowId
();
DzhtAssoCjlc
lc
=
DzhtAssoCjlc
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
DzhtAssoCjlc
>().
eq
(
"flow_id"
,
flowId
).
select
(
"business_scene"
));
sdgzq
.
setBusinessScene
(
lc
.
getBusinessScene
());
//文件主题
DzhtAssoCjlc
lc
=
DzhtAssoCjlc
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
DzhtAssoCjlc
>().
eq
(
"flow_id"
,
flowId
).
select
(
"business_scene"
));
sdgzq
.
setBusinessScene
(
lc
.
getBusinessScene
());
// 文件主题
String
fileId
=
sdgzq
.
getFileId
();
String
signerAccountId
=
sdgzq
.
getSignerAccountId
();
...
...
@@ -680,7 +700,7 @@ public class DzhtController2 {
.
selectOne
(
new
QueryWrapper
<
DzhtAssoGrzc
>().
eq
(
"account_id"
,
signerAccountId
));
if
(
grzc
!=
null
)
{
Integer
signerEmpNum
=
grzc
.
getEmpNum
();
sdgzq
.
setSignerEmpNum
(
signerEmpNum
);
//签署人员工号
sdgzq
.
setSignerEmpNum
(
signerEmpNum
);
//
签署人员工号
}
sdgzq
.
setCreater
(
userBean
.
getEmpNum
());
sdgzq
.
setCreatedTime
(
new
Date
());
...
...
@@ -797,6 +817,26 @@ public class DzhtController2 {
@PutMapping
(
"/startSignFlow"
)
@ApiOperation
(
value
=
"开启签署流程"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
startSignFlow
(
@CurrentUser
UserBean
userBean
,
@RequestParam
String
flowId
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
2
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Integer
remainder
=
null
;
Date
date
=
null
;
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
}
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
return
ResultUtil
.
error
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充值购买后使用"
);
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
return
ResultUtil
.
error
(
"企业 "
+
orgCode
+
" :电子合同套餐已过期"
);
}
try
{
TokenHelper
.
getTokenData
();
// 获取鉴权
SignHelper
.
startSignFlow
(
flowId
);
...
...
@@ -907,7 +947,8 @@ public class DzhtController2 {
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
query
)
{
com
.
github
.
pagehelper
.
Page
<
Object
>
page
=
PageHelper
.
startPage
(
currPage
,
pageSize
);
List
<
DzhtAssoCjlc
>
cjlcs
=
DzhtAssoCjlc
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DzhtAssoCjlc
>().
like
(
query
!=
null
,
"business_scene"
,
query
)
List
<
DzhtAssoCjlc
>
cjlcs
=
DzhtAssoCjlc
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
DzhtAssoCjlc
>().
like
(
query
!=
null
,
"business_scene"
,
query
)
.
eq
(
"org_code"
,
userBean
.
getOrgCode
()).
eq
(
"creater"
,
userBean
.
getEmpNum
()).
select
(
"flow_id"
));
List
<
Object
>
l
=
new
ArrayList
<
Object
>();
for
(
DzhtAssoCjlc
lc
:
cjlcs
)
{
...
...
@@ -968,13 +1009,12 @@ public class DzhtController2 {
public
Result
<
Object
>
getSdlc
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Integer
currPage
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
query
)
{
@RequestParam
(
required
=
false
)
String
query
)
{
List
<
JSONObject
>
json
=
new
ArrayList
<
JSONObject
>();
com
.
github
.
pagehelper
.
Page
<
Object
>
page
=
PageHelper
.
startPage
(
currPage
,
pageSize
);
List
<
DzhtAssoSdgzq
>
list
=
DzhtAssoSdgzq
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
DzhtAssoSdgzq
>()
.
select
(
"distinct flow_id"
)
.
selectList
(
new
QueryWrapper
<
DzhtAssoSdgzq
>().
select
(
"distinct flow_id"
)
.
eq
(
"signer_emp_num"
,
userBean
.
getEmpNum
()).
like
(
query
!=
null
,
"business_scene"
,
query
));
List
<
String
>
flowIdList
=
Lists
.
transform
(
list
,
newList
->
newList
.
getFlowId
());
for
(
String
flowId
:
flowIdList
)
{
...
...
src/main/java/cn/timer/api/controller/htzz/HtzzController.java
View file @
55936645
...
...
@@ -5,6 +5,7 @@ import java.util.Date;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -24,6 +26,7 @@ import cn.hutool.cron.CronUtil;
import
cn.hutool.cron.task.Task
;
import
cn.timer.api.bean.htzz.HtzzAdminZzda
;
import
cn.timer.api.bean.htzz.HtzzAssoHtgx
;
import
cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
...
...
@@ -36,6 +39,7 @@ import io.swagger.annotations.ApiOperation;
@Api
(
tags
=
"7.0合同证照"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/htzz"
,
produces
=
{
"application/json"
})
public
class
HtzzController
{
...
...
@@ -66,9 +70,29 @@ public class HtzzController {
@PostMapping
(
"/addzj"
)
@ApiOperation
(
value
=
"新增合同证件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
addzj
(
@CurrentUser
UserBean
userBean
,
@RequestBody
HtzzAdminZzda
zzda
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Date
date
=
null
;
Integer
remainder
=
null
;
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
}
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :短信套餐已过期"
);
return
ResultUtil
.
error
(
"短信套餐已到期!"
);
}
zzda
.
setTxkgType
(
1
);
zzda
.
setLrrid
(
userBean
.
getEmpNum
());
zzda
.
setLrsjTime
(
new
Date
());
zzda
.
setOrgCode
(
userBean
.
getOrgCode
()
);
zzda
.
setOrgCode
(
orgCode
);
zzda
.
insert
();
/**
...
...
@@ -79,7 +103,7 @@ public class HtzzController {
List
<
HtzzAssoHtgx
>
htgxs
=
new
ArrayList
<
HtzzAssoHtgx
>(
ids
.
length
);
for
(
Integer
id
:
ids
)
{
QueryWrapper
<
YgglMainEmp
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
select
(
"name"
,
"phone"
,
"emp_num"
).
eq
(
"emp_num"
,
id
).
eq
(
"org_code"
,
userBean
.
getOrgCode
()
);
queryWrapper
.
select
(
"name"
,
"phone"
,
"emp_num"
).
eq
(
"emp_num"
,
id
).
eq
(
"org_code"
,
orgCode
);
emp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
queryWrapper
);
HtzzAssoHtgx
htgx
=
HtzzAssoHtgx
.
builder
().
build
();
...
...
@@ -87,7 +111,7 @@ public class HtzzController {
htgx
.
setTzrid
(
emp
.
getEmpNum
());
htgx
.
setName
(
emp
.
getName
());
htgx
.
setPhone
(
emp
.
getPhone
());
htgx
.
setOrgCode
(
userBean
.
getOrgCode
()
);
htgx
.
setOrgCode
(
orgCode
);
htgx
.
insert
();
htgxs
.
add
(
htgx
);
}
...
...
@@ -129,8 +153,8 @@ public class HtzzController {
htzzQueryDto
.
getTotalPage
()
==
null
?
10
:
htzzQueryDto
.
getTotalPage
());
QueryWrapper
<
HtzzAdminZzda
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"lrrid"
,
userBean
.
getEmpNum
()).
eq
(
"org_code"
,
userBean
.
getOrgCode
())
.
select
(
"id"
,
"zjmc"
,
"czry"
,
"czrdh"
,
"fzrq"
,
"yxdqr"
,
"txkg_type"
).
eq
(
"is_delete"
,
0
)
queryWrapper
.
eq
(
"lrrid"
,
userBean
.
getEmpNum
()).
eq
(
"org_code"
,
userBean
.
getOrgCode
())
.
select
(
"id"
,
"zjmc"
,
"czry"
,
"czrdh"
,
"fzrq"
,
"yxdqr"
,
"txkg_type"
).
eq
(
"is_delete"
,
0
)
.
gt
(!
StrUtil
.
hasBlank
(
e
),
"yxdqr"
,
!
StrUtil
.
hasBlank
(
e
)
?
e
:
"9999-01-01 00:00:00"
)
.
and
(!
StrUtil
.
hasBlank
(
q
),
wq
->
wq
.
like
(
"zjmc"
,
q
).
or
().
like
(
"czry"
,
q
)).
orderByDesc
(
"lrsj_time"
);
...
...
@@ -223,7 +247,7 @@ public class HtzzController {
CronUtil
.
schedule
(
"*/2 * * 24 * *"
,
new
Task
()
{
@Override
public
void
execute
()
{
System
.
out
.
println
(
"start:"
+
new
Date
());
System
.
out
.
println
(
"start:"
+
new
Date
());
}
});
...
...
src/main/java/cn/timer/api/controller/qyzx/QyzxBusinessController.java
View file @
55936645
/**
* <p>Title: QyzxBusinessController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
* <p>Title: QyzxBusinessController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月22日
* @version 1.0
*/
package
cn
.
timer
.
api
.
controller
.
qyzx
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.transaction.Transactional
;
...
...
@@ -25,6 +28,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord
;
...
...
@@ -59,7 +63,7 @@ import io.swagger.annotations.ApiOperation;
public
class
QyzxBusinessController
{
@GetMapping
(
value
=
"/getAllQuantity"
)
@ApiOperation
(
value
=
"获取套餐余量信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"获取
全部
套餐余量信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
QyzxRemainingQuantity
>>
s
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxRemainingQuantity
>
list
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getIsDelete
,
0
)
...
...
@@ -68,14 +72,41 @@ public class QyzxBusinessController {
}
@GetMapping
(
value
=
"/getQuantity"
)
@ApiOperation
(
value
=
"获取套餐余量信息(
名称,数量,单位
)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
QyzxRemainingQuantity
>>
getQuantity
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxRemainingQuantity
>
qyzxRemainingQuantitys
=
QyzxRemainingQuantity
.
builder
().
build
()
@ApiOperation
(
value
=
"获取套餐余量信息(
数量
)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
Map
<
String
,
Object
>
>>
getQuantity
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxRemainingQuantity
>
qyzxRemainingQuantitys
1
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getIsDelete
,
0
)
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
select
(
QyzxRemainingQuantity:
:
getOrderNo
,
QyzxRemainingQuantity:
:
getContent
,
QyzxRemainingQuantity:
:
getRemainder
,
QyzxRemainingQuantity:
:
getUnit
));
return
ResultUtil
.
data
(
qyzxRemainingQuantitys
,
"获取成功"
);
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
select
(
QyzxRemainingQuantity:
:
getRemainder
));
Integer
remainder1
=
null
;
for
(
QyzxRemainingQuantity
qyzxRemainingQuantity
:
qyzxRemainingQuantitys1
)
{
remainder1
=
qyzxRemainingQuantity
.
getRemainder
();
if
(
qyzxRemainingQuantitys1
.
size
()
>
1
)
{
remainder1
+=
remainder1
;
}
}
List
<
QyzxRemainingQuantity
>
qyzxRemainingQuantitys2
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getIsDelete
,
0
)
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
2
).
select
(
QyzxRemainingQuantity:
:
getRemainder
));
Integer
remainder2
=
null
;
for
(
QyzxRemainingQuantity
qyzxRemainingQuantity
:
qyzxRemainingQuantitys2
)
{
remainder2
=
qyzxRemainingQuantity
.
getRemainder
();
if
(
qyzxRemainingQuantitys2
.
size
()
>
1
)
{
remainder2
+=
remainder2
;
}
}
Map
<
String
,
Object
>
map1
=
new
HashMap
<
String
,
Object
>();
map1
.
put
(
"message"
,
remainder1
);
Map
<
String
,
Object
>
map2
=
new
HashMap
<
String
,
Object
>();
map2
.
put
(
"contract"
,
remainder2
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
list
.
add
(
map1
);
list
.
add
(
map2
);
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
@GetMapping
(
value
=
"/getPayList/Contract"
)
...
...
@@ -83,8 +114,8 @@ public class QyzxBusinessController {
public
Result
<
List
<
QyzxPayContent
>>
getPayListwithContract
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxPayContent
>
list
=
QyzxPayContent
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxPayContent
>().
eq
(
QyzxPayContent:
:
getPmid
,
1
).
select
(
QyzxPayContent:
:
get
NowPrice
,
QyzxPayContent:
:
getOriginalPrice
,
QyzxPayContent:
:
getSpecification
,
QyzxPayContent:
:
getExpiration
));
QyzxPayContent:
:
get
Content
,
QyzxPayContent:
:
getNowPrice
,
QyzxPayContent:
:
getOriginalPrice
,
QyzxPayContent:
:
get
Specification
,
QyzxPayContent:
:
get
Expiration
));
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
...
...
@@ -93,8 +124,18 @@ public class QyzxBusinessController {
public
Result
<
List
<
QyzxPayContent
>>
getPayListWithMsg
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxPayContent
>
list
=
QyzxPayContent
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxPayContent
>().
eq
(
QyzxPayContent:
:
getPmid
,
2
).
select
(
QyzxPayContent:
:
getNowPrice
,
QyzxPayContent:
:
getOriginalPrice
,
QyzxPayContent:
:
getSpecification
,
QyzxPayContent:
:
getExpiration
));
QyzxPayContent:
:
getContent
,
QyzxPayContent:
:
getNowPrice
,
QyzxPayContent:
:
getOriginalPrice
,
QyzxPayContent:
:
getSpecification
,
QyzxPayContent:
:
getExpiration
));
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
@GetMapping
(
value
=
"/getPayList/System"
)
@ApiOperation
(
value
=
"获取系统续费商品列表"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
QyzxPayContent
>>
getPayListWithSystem
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxPayContent
>
list
=
QyzxPayContent
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxPayContent
>().
eq
(
QyzxPayContent:
:
getPmid
,
3
).
select
(
QyzxPayContent:
:
getContent
,
QyzxPayContent:
:
getNowPrice
,
QyzxPayContent:
:
getOriginalPrice
,
QyzxPayContent:
:
getSpecification
,
QyzxPayContent:
:
getExpiration
));
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
...
...
@@ -110,12 +151,16 @@ public class QyzxBusinessController {
qyzxOrderRecord
.
setOrderNo
(
orderNo
);
// 订单号
qyzxOrderRecord
.
setOrderStatus
(
0
);
// 订单状态-无
Integer
pmid
=
qyzxOrderRecord
.
getPmid
();
// 商品id
Integer
pcid
=
qyzxOrderRecord
.
getPcid
();
// 商品id
QyzxPayContent
qyzxPayContent
=
QyzxPayContent
.
builder
().
build
();
QyzxPayContent
qyzxPayContent2
=
qyzxPayContent
.
selectOne
(
Wrappers
.
lambdaQuery
(
qyzxPayContent
).
eq
(
QyzxPayContent:
:
getId
,
pc
id
).
select
(
QyzxPayContent:
:
getContent
,
QyzxPayContent
qyzxPayContent2
=
qyzxPayContent
.
selectOne
(
Wrappers
.
lambdaQuery
(
qyzxPayContent
)
.
eq
(
QyzxPayContent:
:
getId
,
pcid
).
eq
(
QyzxPayContent:
:
getPmid
,
pm
id
).
select
(
QyzxPayContent:
:
getContent
,
QyzxPayContent:
:
getSpecification
,
QyzxPayContent:
:
getUnit
,
QyzxPayContent:
:
getExpiration
,
QyzxPayContent:
:
getOriginalPrice
,
QyzxPayContent:
:
getNowPrice
));
if
(
qyzxPayContent2
==
null
)
{
return
ResultUtil
.
error
(
"商品不存在"
);
}
JSONObject
json
=
JSONUtil
.
parseObj
(
qyzxPayContent2
);
qyzxOrderRecord
.
setOrderDetail
(
json
.
toString
());
// 订单商品详情-json字符串
qyzxOrderRecord
.
insert
();
...
...
@@ -133,19 +178,16 @@ public class QyzxBusinessController {
public
Result
<
List
<
QyzxBuyRecord
>>
queryBuyRecord
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
query
,
@RequestParam
(
required
=
false
)
String
stime
,
@RequestParam
(
required
=
false
)
String
etime
)
{
@RequestParam
(
required
=
false
)
String
query
,
@RequestParam
(
required
=
false
)
String
s
,
@RequestParam
(
required
=
false
)
String
e
)
{
QueryWrapper
<
QyzxBuyRecord
>
queryWrapper
=
new
QueryWrapper
<>();
// queryWrapper.eq("org_code", userBean.getOrgCode())
// .between(!StrUtil.hasBlank(stime) && !StrUtil.hasBlank(etime), "create_time",
// !StrUtil.hasBlank(stime) ? stime : "1000-01-01 00:00:00",
// !StrUtil.hasBlank(etime) ? etime : "9999-01-01 00:00:00")
// .and(!StrUtil.hasBlank(query), wq -> wq.like("order_no", query).or().like("content", query));
queryWrapper
.
eq
(
"org_code"
,
userBean
.
getOrgCode
()).
and
(!
StrUtil
.
hasBlank
(
query
),
wq
->
wq
.
like
(
"order_no"
,
query
).
or
().
like
(
"content"
,
query
));
queryWrapper
.
between
(
s
!=
null
||
s
!=
""
&&
e
!=
null
||
e
!=
""
,
"create_time"
,
!
StrUtil
.
hasBlank
(
s
)
?
s
:
"1000-01-01 00:00:00"
,
!
StrUtil
.
hasBlank
(
e
)
?
e
:
"9999-01-01 00:00:00"
);
Page
<
Object
>
page
=
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
QyzxBuyRecord
>
list
=
QyzxBuyRecord
.
builder
().
build
().
selectList
(
queryWrapper
);
System
.
out
.
println
(
page
.
getTotal
());
return
ResultUtil
.
data
(
list
,
"查询成功"
);
return
ResultUtil
.
pageData
(
list
,
page
.
getTotal
(),
"查询成功"
);
}
@PostMapping
(
value
=
"/invoicing"
)
...
...
@@ -178,7 +220,7 @@ public class QyzxBusinessController {
@ApiOperation
(
value
=
"查询短信套餐余量"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
QyzxRemainingQuantity
>>
queryMsgRecord
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxRemainingQuantity
>
list
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
ne
(
QyzxRemainingQuantity:
:
getIsDelete
,
1
)
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
));
return
ResultUtil
.
data
(
list
,
"查询成功"
);
...
...
@@ -188,7 +230,7 @@ public class QyzxBusinessController {
@ApiOperation
(
value
=
"查询电子合同套餐余量"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
QyzxRemainingQuantity
>>
queryContractRecord
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxRemainingQuantity
>
list
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
ne
(
QyzxRemainingQuantity:
:
getIsDelete
,
1
)
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
2
));
return
ResultUtil
.
data
(
list
,
"查询成功"
);
...
...
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
55936645
package
cn
.
timer
.
api
.
utils
.
aliyun
;
import
java.util.Date
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -11,7 +14,13 @@ import com.aliyuncs.exceptions.ClientException;
import
com.aliyuncs.exceptions.ServerException
;
import
com.aliyuncs.http.MethodType
;
import
com.aliyuncs.profile.DefaultProfile
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
cn.timer.api.bean.qyzx.QyzxEmpLogin
;
import
cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity
;
import
cn.timer.api.bean.qyzx.businessService.QyzxScene
;
import
cn.timer.api.bean.qyzx.businessService.QyzxUseRecord
;
import
cn.timer.api.config.enums.PinType
;
import
cn.timer.api.dto.qyzx.EntRegisterDto
;
...
...
@@ -21,6 +30,7 @@ import cn.timer.api.dto.qyzx.EntRegisterDto;
* @author dsc
*
*/
@Transactional
public
class
AliyunSMS
{
final
static
String
CODE_NAME
=
"TemplateCode"
;
// 短信模板代码参数名
...
...
@@ -48,6 +58,26 @@ public class AliyunSMS {
String
phone
=
entRegisterDto
.
getPhone
();
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Integer
remainder
=
quantity
.
getRemainder
();
Date
date
=
quantity
.
getExpireDate
();
String
orderNo
=
quantity
.
getOrderNo
();
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
return
null
;
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :短信套餐已过期"
);
return
null
;
}
QyzxUseRecord
qyzxUseRecord
=
new
QyzxUseRecord
();
DefaultProfile
profile
=
DefaultProfile
.
getProfile
(
REGION_ID
,
ACCESSKEY_ID
,
SECRET
);
IAcsClient
client
=
new
DefaultAcsClient
(
profile
);
...
...
@@ -63,37 +93,65 @@ public class AliyunSMS {
switch
(
templateCode
)
{
case
1
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
AUTHENTICATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_AUTHENTICATION
.
getMessage
());
break
;
case
2
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
LOGIN_CONFIRMATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_LOGIN_CONFIRM
.
getMessage
());
break
;
case
3
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
LOGIN_ABNORMAL
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_LOGIN_CONFIRM
.
getMessage
());
break
;
case
4
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
REGISTER
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_REGISTER
.
getMessage
());
break
;
case
5
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
CHANGE_PASSWORD
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_CHANGE_PWD
.
getMessage
());
break
;
case
6
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
CHANGE_INFORMATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_CHANGE_IMP
.
getMessage
());
break
;
default
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
AUTHENTICATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_AUTHENTICATION
.
getMessage
());
}
// 【8小时人事管家】验证码934169,您正在尝试修改登录密码,请妥善保管账户信息。
request
.
putQueryParameter
(
TEMPLATE_PARAM
,
"{\"code\":\""
+
code
+
"\"}"
);
CommonResponse
response
=
null
;
String
a
=
null
;
try
{
response
=
client
.
getCommonResponse
(
request
);
a
=
response
.
getData
();
}
catch
(
ServerException
e
)
{
e
.
printStackTrace
();
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
}
return
JSONObject
.
parseObject
(
response
.
getData
());
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setUserPhone
(
phone
);
qyzxUseRecord
.
setOrderNo
(
orderNo
);
qyzxUseRecord
.
setUseNum
(
1
);
qyzxUseRecord
.
setPmid
(
quantity
.
getPmid
());
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
insert
();
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
return
JSONObject
.
parseObject
(
response
.
getData
());
// 代表请求成功
}
return
null
;
}
/**
...
...
@@ -138,9 +196,31 @@ public class AliyunSMS {
* @param htname 要提醒的东西的名字
* @param time 提醒的时间
* @param phone
* @return
*/
@SuppressWarnings
(
"deprecation"
)
public
static
void
remind
(
String
name
,
String
htname
,
String
time
,
String
phone
)
{
public
static
String
remind
(
String
name
,
String
htname
,
String
time
,
String
phone
)
{
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
)
.
orderByAsc
(
QyzxRemainingQuantity:
:
getExpireDate
));
Integer
remainder
=
quantity
.
getRemainder
();
Date
date
=
quantity
.
getExpireDate
();
String
orderNo
=
quantity
.
getOrderNo
();
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
return
"请先充值购买短信套餐!"
;
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :短信套餐已过期"
);
return
"套餐已过期"
;
}
DefaultProfile
profile
=
DefaultProfile
.
getProfile
(
REGION_ID
,
ACCESSKEY_ID
,
SECRET
);
IAcsClient
client
=
new
DefaultAcsClient
(
profile
);
...
...
@@ -155,14 +235,38 @@ public class AliyunSMS {
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
REMIND
.
getCode
());
request
.
putQueryParameter
(
TEMPLATE_PARAM
,
"{\"name\":\""
+
name
+
"\", \"htname\":\""
+
htname
+
"\",\"time\":\""
+
time
+
"\"}"
);
String
a
=
null
;
try
{
CommonResponse
response
=
client
.
getCommonResponse
(
request
);
System
.
out
.
println
(
response
.
getData
());
a
=
response
.
getData
();
}
catch
(
ServerException
e
)
{
e
.
printStackTrace
();
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
}
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
QyzxUseRecord
qyzxUseRecord
=
new
QyzxUseRecord
();
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setUserPhone
(
phone
);
qyzxUseRecord
.
setOrderNo
(
orderNo
);
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_REMIND
.
getMessage
());
qyzxUseRecord
.
setUseNum
(
1
);
qyzxUseRecord
.
setPmid
(
quantity
.
getPmid
());
qyzxUseRecord
.
insert
();
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
return
a
;
// 代表请求成功
}
return
"发送失败"
;
}
}
src/main/java/cn/timer/api/utils/schedule/RemindUtil.java
View file @
55936645
...
...
@@ -64,15 +64,15 @@ public class RemindUtil implements SchedulingConfigurer {
q
.
select
(
"id"
,
"zjmc"
,
"txkg_type"
,
"yxdqr"
).
eq
(
"id"
,
htgx
.
getHtid
()).
eq
(
"is_delete"
,
0
).
eq
(
"txkg_type"
,
0
);
HtzzAdminZzda
zzda
=
HtzzAdminZzda
.
builder
().
build
().
selectOne
(
q
);
if
(
zzda
!=
null
)
{
String
name
=
htgx
.
getName
();
// 员工姓名
String
phone
=
htgx
.
getPhone
();
// 员工手机
String
name
=
htgx
.
getName
();
// 员工姓名
String
htname
=
zzda
.
getZjmc
();
// 合同名称
Date
now
=
new
Date
();
// 当前时间
Date
dqsj
=
zzda
.
getYxdqr
();
// 到期时间
String
time
=
DateUtil
.
formatDate
(
dqsj
);
// 到期時間格式
Long
betweenDay
=
DateUtil
.
between
(
dqsj
,
now
,
DateUnit
.
DAY
);
// 时间差天数
Long
sjc
=
dqsj
.
getTime
()
-
now
.
getTime
();
// 时间差数值
System
.
err
.
println
(
betweenDay
);
System
.
err
.
println
(
name
+
" 的 "
+
htname
+
"还有: "
+
betweenDay
+
" 天到期"
);
if
(
sjc
>
0
)
{
if
(
betweenDay
<=
1
)
{
AliyunSMS
.
remind
(
name
,
htname
,
time
,
phone
);
// 少于1天短信提醒
...
...
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