提交 3884766a 作者: zgz

Merge remote-tracking branch 'origin/yjzx_test' into yjzx_test

...@@ -125,6 +125,18 @@ public class ThinktankBasicInfoController { ...@@ -125,6 +125,18 @@ public class ThinktankBasicInfoController {
} }
/** /**
* 智库关联ott
* @param baseCode 智库编码
* @param ottCode ott主键
* @return
*/
@GetMapping("relation")
public Result<?> relation(String baseCode, String ottCode) {
thinktankBasicInfoService.relation(baseCode,ottCode);
return Result.OK("操作成功");
}
/**
* 已收藏智库列表 * 已收藏智库列表
* @return * @return
*/ */
...@@ -252,4 +264,14 @@ public class ThinktankBasicInfoController { ...@@ -252,4 +264,14 @@ public class ThinktankBasicInfoController {
} }
/**
* 智库维护
* @return
*/
@PostMapping("importExcel")
public Result think(MultipartFile file) {
thinktankBasicInfoService.thinkTank(file);
return Result.OK();
}
} }
...@@ -30,6 +30,9 @@ public class ThinktankOttInfo { ...@@ -30,6 +30,9 @@ public class ThinktankOttInfo {
/**简介*/ /**简介*/
@Excel(name = "简介", width = 15) @Excel(name = "简介", width = 15)
private String summary; private String summary;
/**中文简介*/
@Excel(name = "中文简介", width = 15)
private String summaryZh;
/**联系信息(json)*/ /**联系信息(json)*/
@Excel(name = "联系信息(json)", width = 15) @Excel(name = "联系信息(json)", width = 15)
private String contact; private String contact;
......
...@@ -6,6 +6,8 @@ import com.zzsn.thinktank.vo.ThinktankBasicInfoExportVo; ...@@ -6,6 +6,8 @@ import com.zzsn.thinktank.vo.ThinktankBasicInfoExportVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoListVo; import com.zzsn.thinktank.vo.ThinktankBasicInfoListVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoVo; import com.zzsn.thinktank.vo.ThinktankBasicInfoVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
...@@ -22,4 +24,21 @@ public interface ThinktankBasicInfoMapper extends BaseMapper<ThinktankBasicInfo> ...@@ -22,4 +24,21 @@ public interface ThinktankBasicInfoMapper extends BaseMapper<ThinktankBasicInfo>
Integer getCount(ThinktankBasicInfoListVo thinktankBasicInfoListVo); Integer getCount(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
List<ThinktankBasicInfoExportVo> getExportList(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);
} }
...@@ -3,6 +3,7 @@ package com.zzsn.thinktank.mapper; ...@@ -3,6 +3,7 @@ package com.zzsn.thinktank.mapper;
import com.zzsn.thinktank.entity.ThinktankBasicInfo; import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.entity.ThinktankOttInfo; import com.zzsn.thinktank.entity.ThinktankOttInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
...@@ -23,7 +24,7 @@ public interface ThinktankOttInfoMapper extends BaseMapper<ThinktankOttInfo> { ...@@ -23,7 +24,7 @@ public interface ThinktankOttInfoMapper extends BaseMapper<ThinktankOttInfo> {
* @param baseCode 智库机构编码 * @param baseCode 智库机构编码
* @return * @return
*/ */
@Select("select ott.id,ott.full_name fullName,ott.abbreviation,ott.summary,ott.contact,ott.areas,ott.organisation,ott.performance from thinktank_ott_info ott left join thinktank_base_ott_relation rel on ott.id = rel.ott_code where rel.base_code = #{baseCode}") @Select("select ott.id,ott.full_name fullName,ott.abbreviation,ott.summary,ott.summary_zh summaryZh,ott.contact,ott.areas,ott.organisation,ott.performance from thinktank_ott_info ott left join thinktank_base_ott_relation rel on ott.id = rel.ott_code where rel.base_code = #{baseCode}")
ThinktankOttInfo getOttInfoByBaseCode(@Param("baseCode") String baseCode); ThinktankOttInfo getOttInfoByBaseCode(@Param("baseCode") String baseCode);
/** /**
...@@ -62,4 +63,28 @@ public interface ThinktankOttInfoMapper extends BaseMapper<ThinktankOttInfo> { ...@@ -62,4 +63,28 @@ public interface ThinktankOttInfoMapper extends BaseMapper<ThinktankOttInfo> {
@Update("delete from thinktank_collect where base_code = #{baseCode} and user_id = #{userId}") @Update("delete from thinktank_collect where base_code = #{baseCode} and user_id = #{userId}")
int cancelCollect(@Param("baseCode") String baseCode,@Param("userId") String userId); int cancelCollect(@Param("baseCode") String baseCode,@Param("userId") String userId);
/**
* 智库关联ott
* @param baseCode 智库表智库编码
* @param ottCode ott表主键
*/
@Insert("insert into thinktank_base_ott_relation(base_code,ott_code) values (#{baseCode},#{ottCode})")
void addRelation(String baseCode, String ottCode);
/**
* 根据智库编码查询已关联ott
* @param baseCode 智库编码
* @return
*/
@Select("select ott_code from thinktank_base_ott_relation where base_code = #{baseCode}")
String getRelation(String baseCode);
/**
* 更新智库已关联的ott
* @param baseCode 智库编码
* @param ottCode ott表主键
*/
@Update("update thinktank_base_ott_relation set ott_code = #{ottCode} where base_code = #{baseCode}")
void updateRelation(String baseCode, String ottCode);
} }
...@@ -35,6 +35,8 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo> ...@@ -35,6 +35,8 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo>
void collect(String id, String userId); void collect(String id, String userId);
void relation(String baseCode, String ottCode);
List<ThinktankBasicInfo> collectList(String userId); List<ThinktankBasicInfo> collectList(String userId);
Result<?> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo); Result<?> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
...@@ -50,4 +52,6 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo> ...@@ -50,4 +52,6 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo>
IPage<ThinktankBasicInfo> pageList(Integer pageNo,Integer pageSize,ThinktankBasicInfoListVo vo, HttpServletRequest req) throws Exception; 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); List<Map<String,Object>> queryStatisticalAnalysis(String type,Page page, ThinktankBasicInfoListVo vo, HttpServletRequest req);
void thinkTank(MultipartFile file);
} }
package com.zzsn.thinktank.service.impl; package com.zzsn.thinktank.service.impl;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -16,6 +17,9 @@ import com.zzsn.thinktank.util.*; ...@@ -16,6 +17,9 @@ import com.zzsn.thinktank.util.*;
import com.zzsn.thinktank.vo.*; import com.zzsn.thinktank.vo.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; 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.apache.poi.ss.usermodel.Workbook;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -24,9 +28,7 @@ import org.elasticsearch.search.sort.SortOrder; ...@@ -24,9 +28,7 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -296,6 +298,24 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf ...@@ -296,6 +298,24 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
} }
} }
/**
* 智库关联ott
* @param baseCode 智库编码
* @param ottCode ott表主键
*/
@Override
public void relation(String baseCode, String ottCode) {
String relation = thinktankOttInfoMapper.getRelation(baseCode);
if (relation != null || !"".equals(relation)) {
// 已关联
thinktankOttInfoMapper.updateRelation(baseCode,ottCode);
} else {
// 未关联
thinktankOttInfoMapper.addRelation(baseCode,ottCode);
}
}
@Override @Override
public List<ThinktankBasicInfo> collectList(String userId) { public List<ThinktankBasicInfo> collectList(String userId) {
List<ThinktankBasicInfo> collectList = thinktankOttInfoMapper.getCollectList(userId); List<ThinktankBasicInfo> collectList = thinktankOttInfoMapper.getCollectList(userId);
...@@ -951,4 +971,43 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf ...@@ -951,4 +971,43 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
return mapList; 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论