Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
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
常超
map-parent
Commits
fe90e3f8
Commit
fe90e3f8
authored
Mar 20, 2023
by
宋珺琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多维入参修改态势分析入参修改
parent
de2c67c5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
240 additions
and
2 deletions
+240
-2
common/common_utils/src/main/java/com/founder/commonutils/model/newPublicEntity/ztypEntity/KshServicePojo.java
+3
-0
common/common_utils/src/main/java/com/founder/commonutils/util/JsonValidator.java
+194
-0
common/service_base/src/main/java/com/founder/servicebase/controller/CodeYymcController/CodeYymcController.java
+4
-1
common/service_base/src/main/java/com/founder/servicebase/controller/KshServiceController.java
+29
-0
service/publicapi/src/main/java/com/founder/publicapi/mapper/mysqlMapper/xml/TbStAsjMapper.xml
+10
-1
No files found.
common/common_utils/src/main/java/com/founder/commonutils/model/newPublicEntity/ztypEntity/KshServicePojo.java
View file @
fe90e3f8
...
...
@@ -46,6 +46,9 @@ public class KshServicePojo extends Model<KshServicePojo> {
@ApiModelProperty
(
value
=
"get/post方式"
)
private
String
type
;
@ApiModelProperty
(
value
=
"入参"
)
private
String
param
;
@ApiModelProperty
(
value
=
"是否带时间参数:0表示否,1表示是"
)
private
String
sfdsjcs
;
...
...
common/common_utils/src/main/java/com/founder/commonutils/util/JsonValidator.java
0 → 100644
View file @
fe90e3f8
package
com
.
founder
.
commonutils
.
util
;
/**
* 用于校验一个字符串是否是合法的JSON格式
*
*/
import
java.text.CharacterIterator
;
import
java.text.StringCharacterIterator
;
public
class
JsonValidator
{
private
CharacterIterator
it
;
private
char
c
;
private
int
col
;
public
JsonValidator
(){
}
/**
* 验证一个字符串是否是合法的JSON串
*
* @param input 要验证的字符串
* @return true-合法 ,false-非法
*/
public
boolean
validate
(
String
input
)
{
input
=
input
.
trim
();
boolean
ret
=
valid
(
input
);
return
ret
;
}
private
boolean
valid
(
String
input
)
{
if
(
""
.
equals
(
input
))
return
true
;
boolean
ret
=
true
;
it
=
new
StringCharacterIterator
(
input
);
c
=
it
.
first
();
col
=
1
;
if
(!
value
())
{
ret
=
error
(
"value"
,
1
);
}
else
{
skipWhiteSpace
();
if
(
c
!=
CharacterIterator
.
DONE
)
{
ret
=
error
(
"end"
,
col
);
}
}
return
ret
;
}
private
boolean
value
()
{
return
literal
(
"true"
)
||
literal
(
"false"
)
||
literal
(
"null"
)
||
string
()
||
number
()
||
object
()
||
array
();
}
private
boolean
literal
(
String
text
)
{
CharacterIterator
ci
=
new
StringCharacterIterator
(
text
);
char
t
=
ci
.
first
();
if
(
c
!=
t
)
return
false
;
int
start
=
col
;
boolean
ret
=
true
;
for
(
t
=
ci
.
next
();
t
!=
CharacterIterator
.
DONE
;
t
=
ci
.
next
())
{
if
(
t
!=
nextCharacter
())
{
ret
=
false
;
break
;
}
}
nextCharacter
();
if
(!
ret
)
error
(
"literal "
+
text
,
start
);
return
ret
;
}
private
boolean
array
()
{
return
aggregate
(
'['
,
']'
,
false
);
}
private
boolean
object
()
{
return
aggregate
(
'{'
,
'}'
,
true
);
}
private
boolean
aggregate
(
char
entryCharacter
,
char
exitCharacter
,
boolean
prefix
)
{
if
(
c
!=
entryCharacter
)
return
false
;
nextCharacter
();
skipWhiteSpace
();
if
(
c
==
exitCharacter
)
{
nextCharacter
();
return
true
;
}
for
(;;)
{
if
(
prefix
)
{
int
start
=
col
;
if
(!
string
())
return
error
(
"string"
,
start
);
skipWhiteSpace
();
if
(
c
!=
':'
)
return
error
(
"colon"
,
col
);
nextCharacter
();
skipWhiteSpace
();
}
if
(
value
())
{
skipWhiteSpace
();
if
(
c
==
','
)
{
nextCharacter
();
}
else
if
(
c
==
exitCharacter
)
{
break
;
}
else
{
return
error
(
"comma or "
+
exitCharacter
,
col
);
}
}
else
{
return
error
(
"value"
,
col
);
}
skipWhiteSpace
();
}
nextCharacter
();
return
true
;
}
private
boolean
number
()
{
if
(!
Character
.
isDigit
(
c
)
&&
c
!=
'-'
)
return
false
;
int
start
=
col
;
if
(
c
==
'-'
)
nextCharacter
();
if
(
c
==
'0'
)
{
nextCharacter
();
}
else
if
(
Character
.
isDigit
(
c
))
{
while
(
Character
.
isDigit
(
c
))
nextCharacter
();
}
else
{
return
error
(
"number"
,
start
);
}
if
(
c
==
'.'
)
{
nextCharacter
();
if
(
Character
.
isDigit
(
c
))
{
while
(
Character
.
isDigit
(
c
))
nextCharacter
();
}
else
{
return
error
(
"number"
,
start
);
}
}
if
(
c
==
'e'
||
c
==
'E'
)
{
nextCharacter
();
if
(
c
==
'+'
||
c
==
'-'
)
{
nextCharacter
();
}
if
(
Character
.
isDigit
(
c
))
{
while
(
Character
.
isDigit
(
c
))
nextCharacter
();
}
else
{
return
error
(
"number"
,
start
);
}
}
return
true
;
}
private
boolean
string
()
{
if
(
c
!=
'"'
)
return
false
;
int
start
=
col
;
boolean
escaped
=
false
;
for
(
nextCharacter
();
c
!=
CharacterIterator
.
DONE
;
nextCharacter
())
{
if
(!
escaped
&&
c
==
'\\'
)
{
escaped
=
true
;
}
else
if
(
escaped
)
{
if
(!
escape
())
{
return
false
;
}
escaped
=
false
;
}
else
if
(
c
==
'"'
)
{
nextCharacter
();
return
true
;
}
}
return
error
(
"quoted string"
,
start
);
}
private
boolean
escape
()
{
int
start
=
col
-
1
;
if
(
" \\\"/bfnrtu"
.
indexOf
(
c
)
<
0
)
{
return
error
(
"escape sequence \\\",\\\\,\\/,\\b,\\f,\\n,\\r,\\t or \\uxxxx "
,
start
);
}
if
(
c
==
'u'
)
{
if
(!
ishex
(
nextCharacter
())
||
!
ishex
(
nextCharacter
())
||
!
ishex
(
nextCharacter
())
||
!
ishex
(
nextCharacter
()))
{
return
error
(
"unicode escape sequence \\uxxxx "
,
start
);
}
}
return
true
;
}
private
boolean
ishex
(
char
d
)
{
return
"0123456789abcdefABCDEF"
.
indexOf
(
c
)
>=
0
;
}
private
char
nextCharacter
()
{
c
=
it
.
next
();
++
col
;
return
c
;
}
private
void
skipWhiteSpace
()
{
while
(
Character
.
isWhitespace
(
c
))
{
nextCharacter
();
}
}
private
boolean
error
(
String
type
,
int
col
)
{
System
.
out
.
printf
(
"type: %s, col: %s%s"
,
type
,
col
,
System
.
getProperty
(
"line.separator"
));
return
false
;
}
public
static
void
main
(
String
[]
args
){
String
s
=
"{\n"
+
"\t\"param\":[\n"
+
"\t\t{\"name\":\"身份证号\",\"id\":\"sfzh\",\"type\": \"text\"},{\"name\":\"类型\",\"id\":\"type\",\"type\":\"optional\",\"value\":[{\"lable\":\"配偶\",\"value\":\"01\"},{\"lable\":\"子女\",\"value\":\"02\"}]},{\"name\":\"开始时间\",\"id\":\"timeStart\",\"type\":\"time\",\"format\":\"yyyy-MM-dd\"},{\"name\":\"结束时间\",\"id\":\"timeEnd\",\"type\":\"time\",\"format\":\"yyyy-MM-dd\"}\n"
+
"\t]\n"
+
"\t\n"
+
"}"
;
System
.
out
.
println
(
s
+
":"
+
new
JsonValidator
().
validate
(
s
));
}
}
common/service_base/src/main/java/com/founder/servicebase/controller/CodeYymcController/CodeYymcController.java
View file @
fe90e3f8
...
...
@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -110,7 +111,8 @@ public class CodeYymcController {
@PostMapping
(
"yymcSelect"
)
@ApiOperation
(
value
=
"查询code编码"
)
@OperLog
(
message
=
"查询code编码"
,
operation
=
OperationType
.
QUERY
)
public
MapRestResult
yymcSelect
(
@RequestBody
SkCodeYymc
skCodeYymc
){
public
MapRestResult
yymcSelect
(
@RequestBody
SkCodeYymc
skCodeYymc
,
HttpServletResponse
response
){
QueryWrapper
<
SkCodeYymc
>
wrapper
=
new
QueryWrapper
<>();
...
...
@@ -147,6 +149,7 @@ public class CodeYymcController {
wrapper
.
eq
(
"is_deleted"
,
"0"
);
IPage
iPage
=
codeYymcMapper
.
selectPage
(
new
Page
(
skCodeYymc
.
getPage
(),
skCodeYymc
.
getLimit
()),
wrapper
);
// response.setStatus(401); // 设置状态码为404,表示资源未找到
return
new
MapRestResult
(
200
,
"ok"
,
iPage
.
getTotal
(),
iPage
.
getRecords
());
...
...
common/service_base/src/main/java/com/founder/servicebase/controller/KshServiceController.java
View file @
fe90e3f8
...
...
@@ -2,6 +2,7 @@ package com.founder.servicebase.controller;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -15,6 +16,7 @@ import com.founder.commonutils.model.newPublicEntity.ztypEntity.KshServicePojo;
import
com.founder.commonutils.model.newPublicEntity.ztypEntity.KsjResultCheck
;
import
com.founder.commonutils.model.newPublicEntity.ztypEntity.KsjResultPojo
;
import
com.founder.commonutils.util.ExportExcelUtil
;
import
com.founder.commonutils.util.JsonValidator
;
import
com.founder.commonutils.util.KeyUtil
;
import
com.founder.commonutils.util.StringUtil
;
import
com.founder.servicebase.logs.OperLog
;
...
...
@@ -63,14 +65,41 @@ public class KshServiceController extends ApiController {
KshServicePojo
.
setXxzjbh
(
KeyUtil
.
getUUIDKey
(
"CS"
));
KshServicePojo
.
setCjsj
(
new
Date
());
KshServicePojo
.
setIsdeleted
(
"0"
);
String
s
=
KshServicePojo
.
getParam
();
//验证json格式
boolean
validate
=
new
JsonValidator
().
validate
(
s
);
if
(!
validate
){
return
new
MapRestResult
().
error
(
"json格式有误"
);
}
//验证数据字段类型
boolean
checkverify
=
checkverify
(
s
);
if
(!
checkverify
){
return
new
MapRestResult
().
error
(
"数据字段类型有误"
);
}
boolean
save
=
kshService
.
save
(
KshServicePojo
);
if
(
save
)
{
return
new
MapRestResult
();
}
else
{
return
new
MapRestResult
().
error
(
"保存失败"
);
}
}
//验证类型
public
static
boolean
checkverify
(
String
s
){
JSONObject
object
=
JSONObject
.
parseObject
(
s
);
JSONArray
param
=
object
.
getJSONArray
(
"param"
);
for
(
int
i
=
0
;
i
<
param
.
size
();
i
++)
{
JSONObject
jsonObject
=
param
.
getJSONObject
(
i
);
String
type
=
jsonObject
.
getString
(
"type"
);
//文本 下拉框 时间
if
(!
type
.
equals
(
"text"
)
&&
!
type
.
equals
(
"optional"
)
&&
!
type
.
equals
(
"time"
)){
return
false
;
}
}
return
true
;
}
@PostMapping
(
"update"
)
@ApiOperation
(
value
=
"修改可视化服务信息"
)
@OperLog
(
message
=
"修改可视化服务信息"
,
operation
=
OperationType
.
UPDATE
)
...
...
service/publicapi/src/main/java/com/founder/publicapi/mapper/mysqlMapper/xml/TbStAsjMapper.xml
View file @
fe90e3f8
...
...
@@ -107,7 +107,11 @@
and ZCJDDM not in ('0600','0700','0800')
</if>
<if
test=
"ladwGajgjgdm!= null and ladwGajgjgdm!=''"
>
AND T.ladw_Gajgjgdm = #{ladwGajgjgdm , jdbcType=VARCHAR }
and T.ladw_Gajgjgdm in (SELECT code FROM sys_dictitem_xz
WHERE CODE_LEV1=#{ladwGajgjgdm, jdbcType=VARCHAR}
or CODE_LEV2 =#{ladwGajgjgdm, jdbcType=VARCHAR} or CODE_LEV3 =#{ladwGajgjgdm, jdbcType=VARCHAR}
or CODE_LEV4 =#{ladwGajgjgdm, jdbcType=VARCHAR} or CODE_LEV5 =#{ladwGajgjgdm, jdbcType=VARCHAR}
)
</if>
<if
test=
"pageSize!=0"
>
limit #{page},#{pageSize}
...
...
@@ -179,6 +183,11 @@
and ZCJDDM not in ('0600','0700','0800')
</if>
<if
test=
"ladwGajgjgdm!= null and ladwGajgjgdm!=''"
>
and T.ladw_Gajgjgdm in (SELECT code FROM sys_dictitem_xz
WHERE CODE_LEV1 =#{ladwGajgjgdm, jdbcType=VARCHAR}
or CODE_LEV2 =#{ladwGajgjgdm, jdbcType=VARCHAR} or CODE_LEV3 =#{ladwGajgjgdm, jdbcType=VARCHAR}
or CODE_LEV4 =#{ladwGajgjgdm, jdbcType=VARCHAR} or CODE_LEV5 =#{ladwGajgjgdm, jdbcType=VARCHAR}
)
AND T.ladw_Gajgjgdm = #{ladwGajgjgdm , jdbcType=VARCHAR }
</if>
</select>
...
...
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