认证-参数项导入-附件模板修改
This commit is contained in:
+3
-1
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.cert.template.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -233,7 +234,8 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
|
||||
HttpServletRequest request) {
|
||||
String cut = (String) map.get("cut");
|
||||
String exportName = (String) map.get("exportName");
|
||||
ParamsInfoVO paramsInfoVO = (ParamsInfoVO) map.get("paramsInfoVO");
|
||||
String paramsInfoVOJson = (String) map.get("paramsInfoVO");
|
||||
ParamsInfoVO paramsInfoVO = JSONObject.parseObject(paramsInfoVOJson, ParamsInfoVO.class);
|
||||
paramsInfoEOService.exportParamsInfo(cut, paramsInfoVO, exportName, response, request);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -19,11 +19,11 @@ public interface CertCategoryParamsInfoEOMapper extends BaseMapper<CertCategoryP
|
||||
* @param nioNumber
|
||||
* @return
|
||||
*/
|
||||
List<CertCategoryParamsInfoEO> selectListByNioNumber(@Param("nioNumber") String nioNumber);
|
||||
List<CertCategoryParamsInfoEO> selectListByNioNumberAndTemplateId(@Param("nioNumber") String nioNumber, @Param("paramsTemplateId") String paramsTemplateId);
|
||||
|
||||
List<CertCategoryParamsInfoEO> selectListByParamsTemplateIds(@Param("paramsTemplateIds") String paramsTemplateIds);
|
||||
|
||||
int deleteByNioNumberList(@Param("list") List<String> nioNumberList);
|
||||
int deleteByNioNumberListAndTemplateId(@Param("list") List<String> nioNumberList, @Param("paramsTemplateId") String paramsTemplateId);
|
||||
|
||||
int deleteByParamsTemplateIds(@Param("paramsTemplateIds") String paramsTemplateIds);
|
||||
}
|
||||
|
||||
+6
-4
@@ -16,10 +16,11 @@
|
||||
<result column="params_template_id" property="paramsTemplateId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectListByNioNumber" resultMap="CertCategoryParamsInfoEOResultMap" parameterType="java.lang.String">
|
||||
<select id="selectListByNioNumberAndTemplateId" resultMap="CertCategoryParamsInfoEOResultMap">
|
||||
select *
|
||||
from cert_category_params_info
|
||||
where nio_number in
|
||||
where params_template_id = #{paramsTemplateId}
|
||||
and nio_number in
|
||||
<foreach collection="nioNumber.split(',')" index="index" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
@@ -34,9 +35,10 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByNioNumberList" parameterType="java.util.List">
|
||||
<delete id="deleteByNioNumberListAndTemplateId">
|
||||
delete from cert_category_params_info
|
||||
where nio_number in
|
||||
where params_template_id = #{paramsTemplateId}
|
||||
and nio_number in
|
||||
<foreach collection="list" index="index" separator="," open="(" close=")" item="nioNumber">
|
||||
#{nioNumber}
|
||||
</foreach>
|
||||
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
package com.jero.modules.cert.template.service;
|
||||
|
||||
import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,11 +60,11 @@ public interface ICertCategoryParamsInfoEOService extends IService<CertCategoryP
|
||||
*/
|
||||
List<CertCategoryParamsInfoEO> queryList();
|
||||
|
||||
List<CertCategoryParamsInfoEO> selectListByNioNumber(String nioNumber);
|
||||
List<CertCategoryParamsInfoEO> selectListByNioNumber(String nioNumber, String paramsTemplateId);
|
||||
|
||||
List<CertCategoryParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds);
|
||||
|
||||
int deleteByNioNumberList(List<String> nioNumberList);
|
||||
int deleteByNioNumberList(List<String> nioNumberList, String paramsTemplateId);
|
||||
|
||||
int deleteByParamsTemplateIds(String paramsTemplateIds);
|
||||
}
|
||||
|
||||
+9
-6
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO;
|
||||
import com.jero.modules.cert.template.mapper.CertCategoryParamsInfoEOMapper;
|
||||
import com.jero.modules.cert.template.service.ICertCategoryParamsInfoEOService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -18,6 +19,8 @@ import java.util.List;
|
||||
@Service
|
||||
public class CertCategoryParamsInfoEOServiceImpl extends ServiceImpl<CertCategoryParamsInfoEOMapper, CertCategoryParamsInfoEO> implements ICertCategoryParamsInfoEOService {
|
||||
|
||||
@Autowired
|
||||
private CertCategoryParamsInfoEOMapper certCategoryParamsInfoEOMapper;
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -89,22 +92,22 @@ public class CertCategoryParamsInfoEOServiceImpl extends ServiceImpl<CertCategor
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CertCategoryParamsInfoEO> selectListByNioNumber(String nioNumber) {
|
||||
return baseMapper.selectListByNioNumber(nioNumber);
|
||||
public List<CertCategoryParamsInfoEO> selectListByNioNumber(String nioNumber, String paramsTemplateId) {
|
||||
return certCategoryParamsInfoEOMapper.selectListByNioNumberAndTemplateId(nioNumber, paramsTemplateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CertCategoryParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds) {
|
||||
return baseMapper.selectListByParamsTemplateIds(paramsTemplateIds);
|
||||
return certCategoryParamsInfoEOMapper.selectListByParamsTemplateIds(paramsTemplateIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByNioNumberList(List<String> nioNumberList) {
|
||||
return baseMapper.deleteByNioNumberList(nioNumberList);
|
||||
public int deleteByNioNumberList(List<String> nioNumberList, String paramsTemplateId) {
|
||||
return certCategoryParamsInfoEOMapper.deleteByNioNumberListAndTemplateId(nioNumberList, paramsTemplateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByParamsTemplateIds(String paramsTemplateIds) {
|
||||
return baseMapper.deleteByParamsTemplateIds(paramsTemplateIds);
|
||||
return certCategoryParamsInfoEOMapper.deleteByParamsTemplateIds(paramsTemplateIds);
|
||||
}
|
||||
}
|
||||
|
||||
+33
-24
@@ -69,6 +69,8 @@ import static com.jero.modules.split.util.ExcelUtil.checkObjAllFieldsIsNull;
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, ParamsInfoEO> implements IParamsInfoEOService {
|
||||
|
||||
@Autowired
|
||||
private ParamsInfoEOMapper paramsInfoEOMapper;
|
||||
@Autowired
|
||||
private ICertCategoryParamsInfoEOService certCategoryParamsInfoEOService;
|
||||
|
||||
@@ -160,7 +162,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
ParamsInfoEO oldParamsInfoEO = getById(paramsInfoId);
|
||||
String oldNioNumber = oldParamsInfoEO.getNioNumber();
|
||||
// 认证类别参数项 先删除后添加
|
||||
certCategoryParamsInfoEOService.deleteByNioNumberList(Arrays.asList(oldNioNumber));
|
||||
certCategoryParamsInfoEOService.deleteByNioNumberList(Arrays.asList(oldNioNumber), paramsTemplateId);
|
||||
|
||||
// 批量添加认证类别参数项
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = paramsInfoEO.getCertCategoryParamsInfoEOList();
|
||||
@@ -195,7 +197,8 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
// 关联删除认证类别参数项
|
||||
ParamsInfoEO paramsInfoEO = getById(id);
|
||||
String nioNumber = paramsInfoEO.getNioNumber();
|
||||
certCategoryParamsInfoEOService.deleteByNioNumberList(Arrays.asList(nioNumber));
|
||||
String paramsTemplateId = paramsInfoEO.getParamsTemplateId();
|
||||
certCategoryParamsInfoEOService.deleteByNioNumberList(Arrays.asList(nioNumber), paramsTemplateId);
|
||||
// TODO 关联删除附件模板文件信息和文件
|
||||
removeById(id);
|
||||
}
|
||||
@@ -212,9 +215,10 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
queryWrapper.in(ParamsInfoEO::getId, ids);
|
||||
List<ParamsInfoEO> paramsInfoEOList = list(queryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(paramsInfoEOList)) {
|
||||
String paramsTemplateId = paramsInfoEOList.get(0).getParamsTemplateId();
|
||||
List<String> nioNumberList = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList());
|
||||
// 关联删除认证类别参数项
|
||||
certCategoryParamsInfoEOService.deleteByNioNumberList(nioNumberList);
|
||||
certCategoryParamsInfoEOService.deleteByNioNumberList(nioNumberList, paramsTemplateId);
|
||||
// TODO 关联删除附件模板文件信息和文件
|
||||
}
|
||||
|
||||
@@ -231,7 +235,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
public ParamsInfoEO queryById(String id) {
|
||||
ParamsInfoEO paramsInfoEO = getById(id);
|
||||
// 关联查询认证类别参数
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(paramsInfoEO.getNioNumber());
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(paramsInfoEO.getNioNumber(), paramsInfoEO.getParamsTemplateId());
|
||||
paramsInfoEO.setCertCategoryParamsInfoEOList(certCategoryParamsInfoEOList);
|
||||
return paramsInfoEO;
|
||||
}
|
||||
@@ -345,20 +349,21 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
nowFile.mkdirs();
|
||||
|
||||
String fileName = exportName + ".xlsx";
|
||||
String paramsTemplateId = paramsInfoVO.getParamsTemplateId();
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
// 查询导出数据
|
||||
List<ParamsInfoEO> paramsInfoEOList = baseMapper.selectListWithCert(paramsInfoVO); // 中文数据导出
|
||||
List<ParamsInfoEO> paramsInfoEOList = paramsInfoEOMapper.selectListWithCert(paramsInfoVO); // 中文数据导出
|
||||
getTreeDictItemText(paramsInfoEOList, cut);
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
sheetsList = getCnExportSheetsList(paramsInfoEOList, fileNowPath);
|
||||
sheetsList = getCnExportSheetsList(paramsInfoEOList, fileNowPath, paramsTemplateId);
|
||||
workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.XSSF);
|
||||
|
||||
} else if (CutEnum.EN.getValue().equals(cut)) {
|
||||
// 查询导出数据
|
||||
List<ParamsInfoEnExport> paramsInfoEnExportList = baseMapper.selectListWithCertForEnExport(paramsInfoVO); // 英文数据导出
|
||||
List<ParamsInfoEnExport> paramsInfoEnExportList = paramsInfoEOMapper.selectListWithCertForEnExport(paramsInfoVO); // 英文数据导出
|
||||
getTreeDictItemTextForEnExport(paramsInfoEnExportList);
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
sheetsList = getEnExportSheetsList(paramsInfoEnExportList, fileNowPath);
|
||||
sheetsList = getEnExportSheetsList(paramsInfoEnExportList, fileNowPath, paramsTemplateId);
|
||||
workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.XSSF);
|
||||
}
|
||||
|
||||
@@ -391,7 +396,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
}
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getCnExportSheetsList(List<ParamsInfoEO> paramsInfoEOList, String fileNowPath) throws IOException {
|
||||
private List<Map<String, Object>> getCnExportSheetsList(List<ParamsInfoEO> paramsInfoEOList, String fileNowPath, String paramsTemplateId) throws IOException {
|
||||
|
||||
if (CollectionUtil.isEmpty(paramsInfoEOList)) {
|
||||
throw new JeroBootException("没有可导出的数据");
|
||||
@@ -411,7 +416,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
|
||||
// 查询导出参数项中认证类别最大级
|
||||
List<String> nioNumber = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList());
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","));
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","),paramsTemplateId);
|
||||
List<String> certCategoryNameList = new ArrayList<>();
|
||||
Map<String, String> certCategoryMap = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoEOList)) {
|
||||
@@ -478,7 +483,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
return sheetsList;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getEnExportSheetsList(List<ParamsInfoEnExport> paramsInfoEnExportList, String fileNowPath) throws IOException {
|
||||
private List<Map<String, Object>> getEnExportSheetsList(List<ParamsInfoEnExport> paramsInfoEnExportList, String fileNowPath, String paramsTemplateId) throws IOException {
|
||||
|
||||
if (CollectionUtil.isEmpty(paramsInfoEnExportList)) {
|
||||
throw new JeroBootException("没有可导出的数据");
|
||||
@@ -498,7 +503,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
|
||||
// 查询导出参数项中认证类别最大级
|
||||
List<String> nioNumber = paramsInfoEnExportList.stream().map(ParamsInfoEnExport::getNioNumber).collect(Collectors.toList());
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","));
|
||||
List<CertCategoryParamsInfoEO> certCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByNioNumber(StringUtils.join(nioNumber, ","),paramsTemplateId);
|
||||
List<String> certCategoryNameList = new ArrayList<>();
|
||||
Map<String, String> certCategoryMap = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoEOList)) {
|
||||
@@ -798,17 +803,21 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
if (checkObjAllFieldsIsNull(importDto)) {
|
||||
continue;
|
||||
}
|
||||
String[] fileIdList = importDto.getFileTemplateName().split(",");
|
||||
String connectId = UUID.randomUUID().toString().replace("-", "");
|
||||
List<OSSFile> updateFileList = new ArrayList<>();
|
||||
for (int i=0; i<fileIdList.length; i++) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileIdList[i]);
|
||||
ossFile.setConnectId(connectId);
|
||||
|
||||
// 处理文件connectId
|
||||
if (StringUtils.isNotBlank(importDto.getFileTemplateName())) { // 判空,否则报空指针异常
|
||||
String[] fileIdList = importDto.getFileTemplateName().split(",");
|
||||
String connectId = UUID.randomUUID().toString().replace("-", "");
|
||||
List<OSSFile> updateFileList = new ArrayList<>();
|
||||
for (int i = 0; i < fileIdList.length; i++) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileIdList[i]);
|
||||
ossFile.setConnectId(connectId);
|
||||
updateFileList.add(ossFile);
|
||||
}
|
||||
ossFileService.updateBatchById(updateFileList);
|
||||
importDto.setFileTemplateConnectId(connectId);
|
||||
}
|
||||
ossFileService.updateBatchById(updateFileList);
|
||||
importDto.setFileTemplateConnectId(connectId);
|
||||
|
||||
ParamsInfoEO target = new ParamsInfoEO();
|
||||
BeanUtils.copyProperties(importDto, target);
|
||||
target.setId(UUID.randomUUID().toString().replace("-",""));
|
||||
@@ -1314,11 +1323,11 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
|
||||
@Override
|
||||
public int deleteByParamsTemplateIds(String paramsTemplateIds) {
|
||||
return baseMapper.deleteByParamsTemplateIds(paramsTemplateIds);
|
||||
return paramsInfoEOMapper.deleteByParamsTemplateIds(paramsTemplateIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds) {
|
||||
return baseMapper.selectListByParamsTemplateIds(paramsTemplateIds);
|
||||
return paramsInfoEOMapper.selectListByParamsTemplateIds(paramsTemplateIds);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user