Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-qyxzpt-report
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘良浪
xzxt-qyxzpt-report
Commits
4c4396f8
Commit
4c4396f8
authored
Dec 26, 2022
by
liulianglang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化
parent
1d848055
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
495 additions
and
121 deletions
+495
-121
src/main/java/org/springblade/common/core/ClipWords.java
+0
-0
src/main/java/org/springblade/common/core/WordsTpye.java
+0
-0
src/main/java/org/springblade/common/tool/CommonUtil.java
+0
-0
src/main/java/org/springblade/founder/tjfx/controller/AjTjController.java
+58
-0
src/main/java/org/springblade/founder/tjfx/entity/AjtjParam.java
+102
-0
src/main/java/org/springblade/founder/tjfx/entity/AjtjResult.java
+25
-0
src/main/java/org/springblade/founder/tjfx/entity/LianTj.java
+10
-0
src/main/java/org/springblade/founder/tjfx/mapper/AjtjMapper.java
+21
-0
src/main/java/org/springblade/founder/tjfx/mapper/AjtjMapper.xml
+69
-0
src/main/java/org/springblade/founder/tjfx/service/AjtjService.java
+19
-0
src/main/java/org/springblade/founder/tjfx/service/impl/AjtjServiceImpl.java
+58
-0
src/main/java/org/springblade/founder/utils/DateUtil.java
+12
-0
src/main/java/org/springblade/founder/utils/JxtUtil.java
+121
-121
No files found.
src/main/java/org/springblade/common/core/ClipWords.java
View file @
4c4396f8
This diff is collapsed.
Click to expand it.
src/main/java/org/springblade/common/core/WordsTpye.java
View file @
4c4396f8
This diff is collapsed.
Click to expand it.
src/main/java/org/springblade/common/tool/CommonUtil.java
View file @
4c4396f8
This diff is collapsed.
Click to expand it.
src/main/java/org/springblade/founder/tjfx/controller/AjTjController.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
controller
;
import
io.swagger.annotations.ApiOperation
;
import
org.springblade.founder.tjfx.entity.AjtjParam
;
import
org.springblade.founder.tjfx.entity.AjtjResult
;
import
org.springblade.founder.tjfx.entity.LianTj
;
import
org.springblade.founder.tjfx.service.AjtjService
;
import
org.springblade.founder.utils.R
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
value
=
"/ajtj"
)
public
class
AjTjController
{
@Autowired
private
AjtjService
ajtjService
;
@PostMapping
(
"/getFapafyuest"
)
@ApiOperation
(
value
=
"各月份立破案分月走势图"
,
notes
=
"各月份立破案分月走势图"
)
public
R
getFapafyuest
(
AjtjParam
ajtjParam
){
try
{
List
<
AjtjResult
>
result
=
ajtjService
.
getFapafyuest
(
ajtjParam
);
return
R
.
ok
().
data
(
"result"
,
result
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
R
.
error
(
e
.
getMessage
());
}
}
@PostMapping
(
"/getPayuest"
)
@ApiOperation
(
value
=
"各月份立破案分月走势图"
,
notes
=
"各月份立破案分月走势图"
)
public
R
getPayuest
(
AjtjParam
ajtjParam
){
try
{
List
<
AjtjResult
>
result
=
ajtjService
.
getPayuest
(
ajtjParam
);
return
R
.
ok
().
data
(
"result"
,
result
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
R
.
error
(
e
.
getMessage
());
}
}
@PostMapping
(
"/getlipoanzzt"
)
@ApiOperation
(
value
=
"各月份立破案柱状图"
,
notes
=
"各月份立破案柱状图"
)
public
R
getlipoanzzt
(
AjtjParam
ajtjParam
){
try
{
List
<
LianTj
>
result
=
ajtjService
.
getlipoanzzt
(
ajtjParam
);
return
R
.
ok
().
data
(
"result"
,
result
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
R
.
error
(
e
.
getMessage
());
}
}
}
src/main/java/org/springblade/founder/tjfx/entity/AjtjParam.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springblade.founder.utils.BaseModel
;
import
org.springblade.modules.system.entity.XzxtUser
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
AjtjParam
extends
BaseModel
{
@ApiModelProperty
(
value
=
"单位代码"
)
private
String
unitcode
;
@ApiModelProperty
(
value
=
"所属单位"
)
private
String
ssdw
;
@ApiModelProperty
(
value
=
"当前单位及下级单位"
)
private
List
<
List
<
String
>>
unitcodeList
;
@ApiModelProperty
(
value
=
"用户级别"
)
private
String
grade
;
@ApiModelProperty
(
value
=
"年份"
)
private
String
year
;
@ApiModelProperty
(
value
=
"月份"
)
private
String
month
;
@ApiModelProperty
(
value
=
"立案日期起始时间"
)
private
String
larqQssj
;
@ApiModelProperty
(
value
=
"立案日期结束时间"
)
private
String
larqJssj
;
@ApiModelProperty
(
value
=
"空-命案情况,zdsw-重大伤亡命案情况"
)
private
String
typeFlag
;
@ApiModelProperty
(
value
=
"查询的单位代码(如查看广州的发破案情况)"
)
private
String
searchUnitcode
;
@ApiModelProperty
(
value
=
"fa-发案 pa-破案 jrxzaj-今日新增案件数 ajbz-案件标注数"
)
private
String
type
;
@ApiModelProperty
(
value
=
"透视时传入需要透视的code值"
)
private
String
code
;
@ApiModelProperty
(
value
=
"案件性质"
)
private
String
ajxz
;
@ApiModelProperty
(
value
=
"作案动机"
)
private
String
zadj
;
@ApiModelProperty
(
value
=
"第几页"
)
private
int
page
;
@ApiModelProperty
(
value
=
"每页行数"
)
private
int
rows
;
@ApiModelProperty
(
value
=
"性别 1-男 2-女 9-未知"
)
private
String
xbdm
;
@ApiModelProperty
(
value
=
"年龄段代码 01:14岁以下 02:14岁-17岁 03:18岁-25岁 04:26岁-35岁 05:36岁-45岁 07:46岁-55岁 08:56岁-65岁 09:66岁-75岁 10:75岁以上"
)
private
String
nlddm
;
@ApiModelProperty
(
value
=
"是否导出判断标志,值为1时后台返回全量数据"
)
private
String
sfdc_pdbz
;
@ApiModelProperty
(
value
=
"嫌疑人特征代码,01-精神病人 02-未成年人 03-在逃 04-死亡 05-抓获 99-总数"
)
private
String
xyrtzdm
;
@ApiModelProperty
(
value
=
"地域分布代码,1010:城市 1020:农村"
)
private
String
dyfbdm
;
@ApiModelProperty
(
value
=
"工作台统计类型,01:今日命案新增 02:立案待审批 03:立案审批未通过 04:侦查终结待审批 05:侦查终结待审批未通过 06:立案即将超期 07:立案已超期 08:侦查终结即将超期 09:侦查终结已超期"
)
private
String
gzt_type
;
@ApiModelProperty
(
value
=
"当前用户单位代码的级别"
)
private
String
codeLevCol
;
@ApiModelProperty
(
value
=
"当前用户单位代码级别的下一个级别"
)
private
String
dscodeLevCol
;
@ApiModelProperty
(
value
=
"当前用户单位代码在第几级"
)
private
String
lev
;
@ApiModelProperty
(
value
=
"排序字段,默认传入空值,按照单位代码排序"
)
private
String
pxzd
;
@ApiModelProperty
(
value
=
"案件类型:xa现案,ja积案"
)
private
String
ajType
;
@ApiModelProperty
(
value
=
"案件类别代码"
)
private
String
ajlbdm
;
@ApiModelProperty
(
value
=
"行政区划代码"
)
private
String
xzqh
;
private
String
jabz
;
//现案判断标志
@ApiModelProperty
(
value
=
"行政区划列表"
)
private
List
<
String
>
xzqhList
;
public
void
setUser
(
XzxtUser
user
){
this
.
unitcode
=
user
.
getUnitcode
();
this
.
grade
=
user
.
getGrade
();
}
public
void
setUnitcodeList
(
List
<
String
>
dwList
)
{
this
.
unitcodeList
=
new
ArrayList
<>();
List
<
String
>
dws
=
new
ArrayList
<>();
if
(
dwList
.
size
()
<
1000
){
this
.
unitcodeList
.
add
(
dwList
);
return
;
}
for
(
String
dw
:
dwList
)
{
if
(
dws
.
size
()
<
1000
){
dws
.
add
(
dw
);
}
else
{
this
.
unitcodeList
.
add
(
new
ArrayList
<>(
dws
));
dws
.
clear
();
dws
.
add
(
dw
);
}
}
if
(!
dws
.
isEmpty
()){
this
.
unitcodeList
.
add
(
dws
);
}
}
}
src/main/java/org/springblade/founder/tjfx/entity/AjtjResult.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
entity
;
import
lombok.Data
;
@Data
public
class
AjtjResult
{
private
String
dwCode
;
private
String
dwName
;
private
String
faNum
;
private
String
lev
;
private
String
jd
;
private
String
wd
;
private
String
monthName
;
private
String
xalb
;
//小类别
private
String
xalbStr
;
//小类别翻译
private
String
ajlbdm
;
//案件类别
private
String
ajlbdmStr
;
//案件类别翻译
private
String
hjd
;
//户籍地
private
String
hjdStr
;
//户籍地翻译
private
String
count
;
//数量
private
String
code
;
private
String
name
;
private
String
num
;
}
src/main/java/org/springblade/founder/tjfx/entity/LianTj.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
entity
;
import
lombok.Data
;
@Data
public
class
LianTj
{
private
int
liaCount
;
private
int
poxanCount
;
private
int
pojanCount
;
}
src/main/java/org/springblade/founder/tjfx/mapper/AjtjMapper.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springblade.founder.tjfx.entity.AjtjParam
;
import
org.springblade.founder.tjfx.entity.AjtjResult
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
@Mapper
public
interface
AjtjMapper
{
//各月份发案数分析
List
<
AjtjResult
>
getFapafyuest
(
AjtjParam
ajtjParam
);
//各月份破案数分析
List
<
AjtjResult
>
getPayuest
(
AjtjParam
ajtjParam
);
int
getFaCount
(
AjtjParam
ajtjParam
);
int
getPaCount
(
AjtjParam
ajtjParam
);
}
src/main/java/org/springblade/founder/tjfx/mapper/AjtjMapper.xml
0 → 100644
View file @
4c4396f8
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"org.springblade.founder.tjfx.mapper.AjtjMapper"
>
<!--各月份发案数分析-->
<select
id=
"getFapafyuest"
resultType=
"org.springblade.founder.tjfx.entity.AjtjResult"
>
select asj.larq as monthName,count(*) faNum from (
SELECT to_char(asj.larq,'yyyy-mm') as larq
FROM tb_st_asj asj
where asj.xxsc_pdbz='0'
<if
test=
"larqQssj!=null and larqQssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[>=]]>
to_date(#{larqQssj, jdbcType=VARCHAR},'yyyy-mm-dd')
</if>
<if
test=
"larqJssj!=null and larqJssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[<]]>
to_date(#{larqJssj, jdbcType=VARCHAR},'yyyy-mm-dd ') +1
</if>
) asj
group by asj.larq
order by asj.larq
</select>
<select
id=
"getFaCount"
resultType=
"java.lang.Integer"
>
SELECT count(1)
FROM tb_st_asj asj
where asj.xxsc_pdbz='0'
<if
test=
"larqQssj!=null and larqQssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[>=]]>
to_date(#{larqQssj, jdbcType=VARCHAR},'yyyy-mm-dd')
</if>
<if
test=
"larqJssj!=null and larqJssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[<]]>
to_date(#{larqJssj, jdbcType=VARCHAR},'yyyy-mm-dd ') +1
</if>
</select>
<!--各月份破案数分析-->
<select
id=
"getPayuest"
resultType=
"org.springblade.founder.tjfx.entity.AjtjResult"
>
select asj.larq as monthName,count(*) faNum from (
SELECT to_char(asj.larq,'yyyy-mm') as larq
FROM tb_st_asj asj
where asj.xxsc_pdbz='0' and asj.ZCJDDM = '0600'
<if
test=
"larqQssj!=null and larqQssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[>=]]>
to_date(#{larqQssj, jdbcType=VARCHAR},'yyyy-mm-dd')
</if>
<if
test=
"larqJssj!=null and larqJssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[<]]>
to_date(#{larqJssj, jdbcType=VARCHAR},'yyyy-mm-dd ') +1
</if>
) asj
group by asj.larq
order by asj.larq
</select>
<select
id=
"getPaCount"
resultType=
"java.lang.Integer"
>
SELECT count(1)
FROM tb_st_asj asj
where asj.xxsc_pdbz='0' and asj.ZCJDDM = '0600'
<if
test=
"larqQssj!=null and larqQssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[>=]]>
to_date(#{larqQssj, jdbcType=VARCHAR},'yyyy-mm-dd')
</if>
<if
test=
"larqJssj!=null and larqJssj!=''"
>
<!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ
<![CDATA[<]]>
to_date(#{larqJssj, jdbcType=VARCHAR},'yyyy-mm-dd ') +1
</if>
<if
test=
"jabz!=null and jabz!='' and jabz == '1'.toString()"
>
<!--破现案查询-->
and to_char(ASJ.LARQ,'yyyy-mm-dd')=to_char(ASJ.ZCZJ_ZXSJ01,'yyyy-mm-dd')
</if>
</select>
</mapper>
src/main/java/org/springblade/founder/tjfx/service/AjtjService.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
service
;
import
org.springblade.founder.tjfx.entity.AjtjParam
;
import
org.springblade.founder.tjfx.entity.AjtjResult
;
import
org.springblade.founder.tjfx.entity.LianTj
;
import
java.util.List
;
public
interface
AjtjService
{
//各月份发案数分析
List
<
AjtjResult
>
getFapafyuest
(
AjtjParam
ajtjParam
);
//各月份破案数分析
List
<
AjtjResult
>
getPayuest
(
AjtjParam
ajtjParam
);
List
<
LianTj
>
getlipoanzzt
(
AjtjParam
ajtjParam
);
}
src/main/java/org/springblade/founder/tjfx/service/impl/AjtjServiceImpl.java
0 → 100644
View file @
4c4396f8
package
org
.
springblade
.
founder
.
tjfx
.
service
.
impl
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
org.springblade.founder.tjfx.entity.AjtjParam
;
import
org.springblade.founder.tjfx.entity.AjtjResult
;
import
org.springblade.founder.tjfx.entity.LianTj
;
import
org.springblade.founder.tjfx.mapper.AjtjMapper
;
import
org.springblade.founder.tjfx.service.AjtjService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
AjtjServiceImpl
implements
AjtjService
{
@Resource
private
AjtjMapper
ajtjMapper
;
@Override
public
List
<
AjtjResult
>
getFapafyuest
(
AjtjParam
ajtjParam
)
{
// List<AjtjResult> faan=ajtjMapper.getFapafyuest(ajtjParam);
//
// List<AjtjResult> poan=ajtjMapper.getPayuest(ajtjParam);
return
ajtjMapper
.
getFapafyuest
(
ajtjParam
);
}
@Override
public
List
<
AjtjResult
>
getPayuest
(
AjtjParam
ajtjParam
)
{
// List<AjtjResult> faan=ajtjMapper.getFapafyuest(ajtjParam);
List
<
AjtjResult
>
poan
=
ajtjMapper
.
getPayuest
(
ajtjParam
);
return
poan
;
}
@Override
public
List
<
LianTj
>
getlipoanzzt
(
AjtjParam
ajtjParam
)
{
List
<
LianTj
>
tj
=
new
ArrayList
<>();
LianTj
jntj
=
new
LianTj
();
int
lian
=
ajtjMapper
.
getFaCount
(
ajtjParam
);
int
poan
=
ajtjMapper
.
getPaCount
(
ajtjParam
);
ajtjParam
.
setJabz
(
"1"
);
int
xpoan
=
ajtjMapper
.
getPaCount
(
ajtjParam
);
String
kssj
=
ajtjParam
.
getLarqQssj
();
String
jssj
=
ajtjParam
.
getLarqJssj
();
jntj
.
setLiaCount
(
lian
);
jntj
.
setPojanCount
(
poan
-
xpoan
);
jntj
.
setPoxanCount
(
xpoan
);
tj
.
add
(
jntj
);
return
tj
;
}
}
src/main/java/org/springblade/founder/utils/DateUtil.java
View file @
4c4396f8
...
...
@@ -61,6 +61,18 @@ public class DateUtil {
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
return
sdf
.
format
(
new
Date
());
}
/**
* 得到几年前的时间
* @param d
* @param year
* @return
*/
public
static
Date
getDateBeforeToYear
(
Date
d
,
int
year
){
Calendar
now
=
Calendar
.
getInstance
();
now
.
setTime
(
d
);
now
.
set
(
Calendar
.
YEAR
,
now
.
get
(
Calendar
.
YEAR
)-
year
);
return
now
.
getTime
();
}
public
static
String
getSysDateCnStr
(){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy年MM月dd日"
);
...
...
src/main/java/org/springblade/founder/utils/JxtUtil.java
View file @
4c4396f8
package
org
.
springblade
.
founder
.
utils
;
import
org.apache.commons.httpclient.HttpStatus
;
import
org.apache.commons.httpclient.NameValuePair
;
import
org.apache.commons.httpclient.methods.PostMethod
;
import
org.springframework.util.StringUtils
;
/**
* 警信通相关接口
* @auther: Lilei
* @date: 2022/8/22 10:12
*/
public
class
JxtUtil
{
private
static
final
String
url
=
"http://10.142.46.128:9080/sms/SMSSendService"
;
private
static
final
String
user_id
=
"4536"
;
private
static
final
String
user_pwd
=
"123456"
;
private
static
final
String
sub_code
=
"0213"
;
public
static
R
sendService
(
String
phone
,
String
message
)
{
if
(
StringUtils
.
isEmpty
(
phone
)){
return
R
.
error
(
"用户手机号码为空"
);
}
if
(
StringUtils
.
isEmpty
(
message
)){
return
R
.
error
(
"用户发送消息内容为空"
);
}
String
result
=
send
(
phone
,
message
);
if
(
result
.
startsWith
(
"0#"
)){
result
=
"提交成功,"
+
result
;
return
R
.
ok
().
data
(
"result"
,
result
);
}
else
{
switch
(
result
)
{
case
"100"
:
result
=
"余额不足"
;
break
;
case
"101"
:
result
=
"账号关闭"
;
break
;
case
"102"
:
result
=
"短信内容超过195字或为空或内容编码格式不正确"
;
break
;
case
"103"
:
result
=
"手机号码超过50个或合法的手机号码为空"
;
break
;
case
"104"
:
result
=
"用户访问时间间隔低于50毫秒"
;
break
;
case
"105"
:
result
=
"用户访问方式不是post方式"
;
break
;
case
"106"
:
result
=
"用户名不存在"
;
break
;
case
"107"
:
result
=
"密码错误"
;
break
;
case
"108"
:
result
=
"指定访问ip错误"
;
break
;
case
"110"
:
result
=
"小号不合法"
;
break
;
case
"111"
:
result
=
"短信内容内有敏感词"
;
break
;
case
"-100"
:
result
=
"其他未知错误"
;
break
;
}
return
R
.
error
(
result
);
}
}
/* 接口返回代码说明
0#数字#唯一ID 提交成功#提交成功的手机数量#发送唯一标示(状态报告接口将通过此唯一标示提交给个账号)
100 余额不足
101 账号关闭
102 短信内容超过195字或为空或内容编码格式不正确
103 手机号码超过50个或合法的手机号码为空
104 用户访问时间间隔低于50毫秒
105 用户访问方式不是post方式
106 用户名不存在
107 密码错误
108 指定访问ip错误
110 小号不合法
111 短信内容内有敏感词
-100 其他未知错误*/
private
static
String
send
(
String
phone
,
String
message
){
org
.
apache
.
commons
.
httpclient
.
HttpClient
httpClient
=
new
org
.
apache
.
commons
.
httpclient
.
HttpClient
();
PostMethod
postMethod
=
new
PostMethod
(
url
);
postMethod
.
addRequestHeader
(
"Content-Type"
,
"application/x-www-form-urlencoded;charset=GBK"
);
NameValuePair
userId
=
new
NameValuePair
(
"user_id"
,
user_id
);
NameValuePair
userPwd
=
new
NameValuePair
(
"user_pwd"
,
user_pwd
);
NameValuePair
mobile
=
new
NameValuePair
(
"mobile"
,
phone
);
NameValuePair
msg_content
=
new
NameValuePair
(
"msg_content"
,
message
);
NameValuePair
subCode
=
new
NameValuePair
(
"sub_code"
,
sub_code
);
NameValuePair
[]
data
={
userId
,
userPwd
,
mobile
,
msg_content
,
subCode
};
postMethod
.
setRequestBody
(
data
);
int
statusCode
=
0
;
String
result
=
""
;
try
{
statusCode
=
httpClient
.
executeMethod
(
postMethod
);
System
.
out
.
println
(
"statusCode:"
+
statusCode
);
if
(
statusCode
==
HttpStatus
.
SC_OK
)
{
result
=
postMethod
.
getResponseBodyAsString
();
//根据返回状态可判断是否发送成功
System
.
out
.
println
(
"result:"
+
result
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
"警信通接口调用失败"
;
}
return
result
;
}
}
//
package org.springblade.founder.utils;
//
//
import org.apache.commons.httpclient.HttpStatus;
//
import org.apache.commons.httpclient.NameValuePair;
//
import org.apache.commons.httpclient.methods.PostMethod;
//
import org.springframework.util.StringUtils;
//
/
//
**
//
* 警信通相关接口
//
* @auther: Lilei
//
* @date: 2022/8/22 10:12
//
*/
//
//
public class JxtUtil {
//
private static final String url = "http://10.142.46.128:9080/sms/SMSSendService";
//
private static final String user_id = "4536";
//
private static final String user_pwd = "123456";
//
private static final String sub_code = "0213";
//
//
public static R sendService(String phone ,String message) {
//
if (StringUtils.isEmpty(phone)){
//
return R.error("用户手机号码为空");
//
}
//
if (StringUtils.isEmpty(message)){
//
return R.error("用户发送消息内容为空");
//
}
//
String result = send(phone,message);
//
//
if (result.startsWith("0#")){
//
result = "提交成功," + result;
//
return R.ok().data("result",result);
//
}else {
//
switch (result) {
//
case "100":
//
result = "余额不足";
//
break;
//
case "101":
//
result = "账号关闭";
//
break;
//
case "102":
//
result = "短信内容超过195字或为空或内容编码格式不正确";
//
break;
//
case "103":
//
result = "手机号码超过50个或合法的手机号码为空";
//
break;
//
case "104":
//
result = "用户访问时间间隔低于50毫秒";
//
break;
//
case "105":
//
result = "用户访问方式不是post方式";
//
break;
//
case "106":
//
result = "用户名不存在";
//
break;
//
case "107":
//
result = "密码错误";
//
break;
//
case "108":
//
result = "指定访问ip错误";
//
break;
//
case "110":
//
result = "小号不合法";
//
break;
//
case "111":
//
result = "短信内容内有敏感词";
//
break;
//
case "-100":
//
result = "其他未知错误";
//
break;
//
}
//
return R.error(result);
//
}
//
}
//
/
//
* 接口返回代码说明
//
0#数字#唯一ID 提交成功#提交成功的手机数量#发送唯一标示(状态报告接口将通过此唯一标示提交给个账号)
//
100 余额不足
//
101 账号关闭
//
102 短信内容超过195字或为空或内容编码格式不正确
//
103 手机号码超过50个或合法的手机号码为空
//
104 用户访问时间间隔低于50毫秒
//
105 用户访问方式不是post方式
//
106 用户名不存在
//
107 密码错误
//
108 指定访问ip错误
//
110 小号不合法
//
111 短信内容内有敏感词
//
-100 其他未知错误*/
//
//
//
private static String send(String phone ,String message){
//
org.apache.commons.httpclient.HttpClient httpClient = new org.apache.commons.httpclient.HttpClient();
//
PostMethod postMethod = new PostMethod(url);
//
postMethod.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=GBK");
//
NameValuePair userId = new NameValuePair("user_id", user_id);
//
NameValuePair userPwd = new NameValuePair("user_pwd", user_pwd);
//
NameValuePair mobile = new NameValuePair("mobile", phone);
//
NameValuePair msg_content = new NameValuePair("msg_content", message);
//
NameValuePair subCode = new NameValuePair("sub_code", sub_code);
//
//
NameValuePair[] data ={userId, userPwd, mobile, msg_content,subCode};
//
postMethod.setRequestBody(data);
//
int statusCode = 0;
//
String result = "";
//
try{
//
statusCode = httpClient.executeMethod(postMethod);
//
System.out.println("statusCode:"+statusCode);
//
if (statusCode == HttpStatus.SC_OK) {
//
result = postMethod.getResponseBodyAsString();
//
//根据返回状态可判断是否发送成功
//
System.out.println("result:"+result);
//
}
//
}catch (Exception e){
//
e.printStackTrace();
//
return "警信通接口调用失败";
//
}
//
return result;
//
}
//
//
//
}
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