Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
think-tank
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
张京坤
think-tank
Commits
b16cf1bb
提交
b16cf1bb
authored
8月 30, 2024
作者:
yuanhaojie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
智库基础信息外部导入excel维护
上级
3ad09a17
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
74 行增加
和
2 行删除
+74
-2
ThinktankBasicInfoController.java
...sn/thinktank/controller/ThinktankBasicInfoController.java
+10
-0
ThinktankBasicInfoMapper.java
...a/com/zzsn/thinktank/mapper/ThinktankBasicInfoMapper.java
+19
-0
ThinktankBasicInfoService.java
...com/zzsn/thinktank/service/ThinktankBasicInfoService.java
+2
-0
ThinktankBasicInfoServiceImpl.java
...thinktank/service/impl/ThinktankBasicInfoServiceImpl.java
+43
-2
没有找到文件。
src/main/java/com/zzsn/thinktank/controller/ThinktankBasicInfoController.java
浏览文件 @
b16cf1bb
...
...
@@ -264,4 +264,14 @@ public class ThinktankBasicInfoController {
}
/**
* 智库维护
* @return
*/
@PostMapping
(
"importExcel"
)
public
Result
think
(
MultipartFile
file
)
{
thinktankBasicInfoService
.
thinkTank
(
file
);
return
Result
.
OK
();
}
}
src/main/java/com/zzsn/thinktank/mapper/ThinktankBasicInfoMapper.java
浏览文件 @
b16cf1bb
...
...
@@ -6,6 +6,8 @@ import com.zzsn.thinktank.vo.ThinktankBasicInfoExportVo;
import
com.zzsn.thinktank.vo.ThinktankBasicInfoListVo
;
import
com.zzsn.thinktank.vo.ThinktankBasicInfoVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Update
;
import
java.util.List
;
...
...
@@ -22,4 +24,21 @@ public interface ThinktankBasicInfoMapper extends BaseMapper<ThinktankBasicInfo>
Integer
getCount
(
ThinktankBasicInfoListVo
thinktankBasicInfoListVo
);
List
<
ThinktankBasicInfoExportVo
>
getExportList
(
ThinktankBasicInfoListVo
thinktankBasicInfoListVo
);
/**
* 根据id更新智库基本信息
* @param id 智库id
* @param lang 语言
* @param profitNature 盈利性质
* @param nature 智库性质
* @param influencePosition 影响力和地位
* @param scale 智库规模
*/
@Update
(
"update thinktank_basic_info set lang = #{lang},profit_nature = #{profitNature},nature = #{nature},influence_position = #{influencePosition},scale = #{scale} where id = #{id} "
)
void
updateThinkTankBasicInfoById
(
@Param
(
"id"
)
String
id
,
@Param
(
"lang"
)
String
lang
,
@Param
(
"profitNature"
)
String
profitNature
,
@Param
(
"nature"
)
String
nature
,
@Param
(
"influencePosition"
)
String
influencePosition
,
@Param
(
"scale"
)
String
scale
);
}
src/main/java/com/zzsn/thinktank/service/ThinktankBasicInfoService.java
浏览文件 @
b16cf1bb
...
...
@@ -52,4 +52,6 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo>
IPage
<
ThinktankBasicInfo
>
pageList
(
Integer
pageNo
,
Integer
pageSize
,
ThinktankBasicInfoListVo
vo
,
HttpServletRequest
req
)
throws
Exception
;
List
<
Map
<
String
,
Object
>>
queryStatisticalAnalysis
(
String
type
,
Page
page
,
ThinktankBasicInfoListVo
vo
,
HttpServletRequest
req
);
void
thinkTank
(
MultipartFile
file
);
}
src/main/java/com/zzsn/thinktank/service/impl/ThinktankBasicInfoServiceImpl.java
浏览文件 @
b16cf1bb
package
com
.
zzsn
.
thinktank
.
service
.
impl
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -16,6 +17,9 @@ import com.zzsn.thinktank.util.*;
import
com.zzsn.thinktank.vo.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
...
...
@@ -24,9 +28,7 @@ import org.elasticsearch.search.sort.SortOrder;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ResourceUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
...
...
@@ -969,4 +971,43 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
return
mapList
;
}
/**
* 智库维护
*
* @param file
*/
@Override
public
void
thinkTank
(
MultipartFile
file
)
{
try
{
InputStream
inputStream
=
file
.
getInputStream
();
ExcelReader
reader
=
ExcelUtil
.
getReader
(
inputStream
);
Sheet
sheet
=
reader
.
getSheet
();
for
(
int
i
=
1
;
i
<=
sheet
.
getLastRowNum
();
i
++)
{
Row
row
=
sheet
.
getRow
(
i
);
if
(
row
!=
null
)
{
Cell
idCell
=
row
.
getCell
(
1
);
Cell
codeCell
=
row
.
getCell
(
2
);
Cell
cell1
=
row
.
getCell
(
11
);
Cell
cell2
=
row
.
getCell
(
13
);
Cell
cell3
=
row
.
getCell
(
14
);
Cell
cell4
=
row
.
getCell
(
16
);
Cell
cell5
=
row
.
getCell
(
17
);
if
(
idCell
!=
null
)
{
String
id
=
idCell
.
getStringCellValue
();
String
stringCellValue1
=
cell1
.
getStringCellValue
();
String
stringCellValue2
=
cell2
.
getStringCellValue
();
String
stringCellValue3
=
cell3
.
getStringCellValue
();
String
stringCellValue4
=
cell4
.
getStringCellValue
();
String
stringCellValue5
=
cell5
.
getStringCellValue
();
thinktankBasicInfoMapper
.
updateThinkTankBasicInfoById
(
id
,
stringCellValue1
,
stringCellValue2
,
stringCellValue3
,
stringCellValue4
,
stringCellValue5
);
log
.
info
(
"success,{}"
,
i
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论