Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nnjcy-data-model
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
梁家彪
nnjcy-data-model
Commits
eb20a870
Commit
eb20a870
authored
Jan 11, 2024
by
wqc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
青秀模型导入
parent
de5c100d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
0 deletions
+179
-0
model-server/src/main/java/com.zq.model/controller/FfzdController.java
+31
-0
model-server/src/main/java/com.zq.model/entity/CityManageEnforceLaw.java
+72
-0
model-server/src/main/java/com.zq.model/mapper/CgzfInfoDao.java
+11
-0
model-server/src/main/java/com.zq.model/service/FfzdService.java
+65
-0
No files found.
model-server/src/main/java/com.zq.model/controller/FfzdController.java
0 → 100644
View file @
eb20a870
package
com
.
zq
.
model
.
controller
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.model.service.FfzdService
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/model/ffzd"
)
public
class
FfzdController
{
@Resource
private
FfzdService
ffzdService
;
@PostMapping
(
"/uploadFile"
)
public
ResultVo
uploadFile
(
@RequestParam
(
"file"
)
MultipartFile
[]
multipartFiles
)
{
AssertUtils
.
notNull
(
multipartFiles
,
"文件不能为空!"
);
try
{
return
ResultVo
.
success
(
ffzdService
.
uploadFile
(
multipartFiles
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ResultVo
.
fail
(
500
,
"文件解析失败"
);
}
}
}
model-server/src/main/java/com.zq.model/entity/CityManageEnforceLaw.java
0 → 100644
View file @
eb20a870
package
com
.
zq
.
model
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName
(
value
=
"city_manage_enforce_law"
)
public
class
CityManageEnforceLaw
{
/**
* id
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
"ajlb"
)
private
String
cfjg
;
@ApiModelProperty
(
"ajlb"
)
private
String
ajlb
;
@ApiModelProperty
(
"cfzl"
)
private
String
cfzl
;
@ApiModelProperty
(
"xzxdrmc"
)
private
String
xzxdrmc
;
@ApiModelProperty
(
"xzxdrlb"
)
private
String
xzxdrlb
;
@ApiModelProperty
(
"tyshxydm"
)
private
String
tyshxydm
;
@ApiModelProperty
(
"anyou"
)
private
String
anyou
;
@ApiModelProperty
(
"wfss"
)
private
String
wfss
;
@ApiModelProperty
(
"flyj"
)
private
String
flyj
;
@ApiModelProperty
(
"xzcfjdswh"
)
private
String
xzcfjdswh
;
@ApiModelProperty
(
"cfje"
)
private
String
cfje
;
@ApiModelProperty
(
"cfsxq"
)
private
String
cfsxq
;
@ApiModelProperty
(
"dfbm"
)
private
String
dfbm
;
private
Date
createTime
;
}
model-server/src/main/java/com.zq.model/mapper/CgzfInfoDao.java
0 → 100644
View file @
eb20a870
package
com
.
zq
.
model
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zq.model.entity.CityManageEnforceLaw
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
CgzfInfoDao
extends
BaseMapper
<
CityManageEnforceLaw
>
{
}
model-server/src/main/java/com.zq.model/service/FfzdService.java
0 → 100644
View file @
eb20a870
package
com
.
zq
.
model
.
service
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.model.entity.CityManageEnforceLaw
;
import
com.zq.model.mapper.CgzfInfoDao
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.List
;
@Service
public
class
FfzdService
{
@Resource
private
CgzfInfoDao
cgzfInfoDao
;
public
Object
uploadFile
(
MultipartFile
[]
multipartFiles
)
{
for
(
MultipartFile
file
:
multipartFiles
)
{
ExcelReader
reader
;
try
{
reader
=
ExcelUtil
.
getReader
(
file
.
getInputStream
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
throw
new
BusinessException
(
"文件解析失败"
);
}
CityManageEnforceLaw
enforceLaw
=
new
CityManageEnforceLaw
();
List
<
List
<
Object
>>
readList
=
reader
.
read
(
1
);
for
(
List
<
Object
>
objectList
:
readList
)
{
int
index
=
0
;
enforceLaw
.
setCfjg
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
)));
enforceLaw
.
setAjlb
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setCfzl
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setXzxdrmc
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setXzxdrlb
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setTyshxydm
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setAnyou
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setWfss
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setFlyj
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setXzcfjdswh
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setCfje
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setCfsxq
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setDfbm
(
Convert
.
toStr
(
CollUtil
.
get
(
objectList
,
index
++)));
enforceLaw
.
setCreateTime
(
DateUtil
.
date
());
cgzfInfoDao
.
insert
(
enforceLaw
);
}
}
return
null
;
}
}
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