认证-上报库-参数项查看-保存
This commit is contained in:
+20
-4
@@ -22,10 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -197,4 +194,23 @@ public class ParamsReportDetailEOController extends JeroController<ParamsReportD
|
|||||||
return Result.OK(paramsReportConfigEO);
|
return Result.OK(paramsReportConfigEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂存
|
||||||
|
*
|
||||||
|
* @param paramsReportDetailVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "上报库参数项-保存")
|
||||||
|
@ApiOperation(value="参数项收集清单-保存", notes="参数项收集清单-保存")
|
||||||
|
@PostMapping(value = "/save")
|
||||||
|
@RequiresPermissions("report:detail:export:save")
|
||||||
|
public Result<?> save(@RequestBody ParamsReportDetailVO paramsReportDetailVO) {
|
||||||
|
boolean isSuccess = paramsReportConfigEOService.save(paramsReportDetailVO.getConfigDataList(), paramsReportDetailVO.getParamsManifestId());
|
||||||
|
if (isSuccess) {
|
||||||
|
return Result.OK("暂存成功!");
|
||||||
|
} else {
|
||||||
|
return Result.error("暂存失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -23,4 +23,11 @@ public interface IParamsReportConfigDataEOService extends IService<ParamsReportC
|
|||||||
ParamsReportConfigDataEO queryByConfigIdAndCollectManifestId(String paramsConfigId, String paramsCollectManifestId);
|
ParamsReportConfigDataEO queryByConfigIdAndCollectManifestId(String paramsConfigId, String paramsCollectManifestId);
|
||||||
|
|
||||||
List<ParamsReportConfigDataEO> queryByConfigIdListAndCollectManifestId(List<String> paramsConfigIdList, String paramsCollectManifestId);
|
List<ParamsReportConfigDataEO> queryByConfigIdListAndCollectManifestId(List<String> paramsConfigIdList, String paramsCollectManifestId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询清单的所有配置数据
|
||||||
|
* @param configIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ParamsReportConfigDataEO> queryListByConfigIdList(List<String> configIdList);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -3,6 +3,7 @@ package com.jero.modules.cert.report.service;
|
|||||||
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
|
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 上报库参数配置
|
* @Description: 上报库参数配置
|
||||||
@@ -12,5 +13,19 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IParamsReportConfigEOService extends IService<ParamsReportConfigEO> {
|
public interface IParamsReportConfigEOService extends IService<ParamsReportConfigEO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表查询
|
||||||
|
* @param paramsManifestId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<ParamsReportConfigEO> queryList(String paramsManifestId);
|
List<ParamsReportConfigEO> queryList(String paramsManifestId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
* @param configDataList
|
||||||
|
* @param paramsManifestId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean save(List<Map<String, Object>> configDataList, String paramsManifestId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
@@ -1,5 +1,6 @@
|
|||||||
package com.jero.modules.cert.report.service.impl;
|
package com.jero.modules.cert.report.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.modules.cert.report.entity.ParamsReportConfigDataEO;
|
import com.jero.modules.cert.report.entity.ParamsReportConfigDataEO;
|
||||||
@@ -38,4 +39,20 @@ public class ParamsReportConfigDataEOServiceImpl extends ServiceImpl<ParamsRepor
|
|||||||
public List<ParamsReportConfigDataEO> queryByConfigIdListAndCollectManifestId(List<String> paramsConfigIdList, String paramsCollectManifestId) {
|
public List<ParamsReportConfigDataEO> queryByConfigIdListAndCollectManifestId(List<String> paramsConfigIdList, String paramsCollectManifestId) {
|
||||||
return baseMapper.selectByConfigIdListAndCollectManifestId(paramsConfigIdList, paramsCollectManifestId);
|
return baseMapper.selectByConfigIdListAndCollectManifestId(paramsConfigIdList, paramsCollectManifestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询清单的所有配置数据
|
||||||
|
* @param configIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ParamsReportConfigDataEO> queryListByConfigIdList(List<String> configIdList) {
|
||||||
|
if (CollectionUtil.isNotEmpty(configIdList)) {
|
||||||
|
LambdaQueryWrapper<ParamsReportConfigDataEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(ParamsReportConfigDataEO::getParamsConfigId, configIdList);
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+122
@@ -1,13 +1,28 @@
|
|||||||
package com.jero.modules.cert.report.service.impl;
|
package com.jero.modules.cert.report.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.modules.cert.collect.entity.ParamsConfigDataEO;
|
||||||
|
import com.jero.modules.cert.collect.entity.ParamsConfigEO;
|
||||||
|
import com.jero.modules.cert.collect.enums.ConfigDataTypeEnum;
|
||||||
|
import com.jero.modules.cert.report.entity.ParamsReportConfigDataEO;
|
||||||
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
|
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
|
||||||
import com.jero.modules.cert.report.mapper.ParamsReportConfigEOMapper;
|
import com.jero.modules.cert.report.mapper.ParamsReportConfigEOMapper;
|
||||||
|
import com.jero.modules.cert.report.service.IParamsReportConfigDataEOService;
|
||||||
import com.jero.modules.cert.report.service.IParamsReportConfigEOService;
|
import com.jero.modules.cert.report.service.IParamsReportConfigEOService;
|
||||||
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 上报库参数配置
|
* @Description: 上报库参数配置
|
||||||
@@ -18,6 +33,15 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class ParamsReportConfigEOServiceImpl extends ServiceImpl<ParamsReportConfigEOMapper, ParamsReportConfigEO> implements IParamsReportConfigEOService {
|
public class ParamsReportConfigEOServiceImpl extends ServiceImpl<ParamsReportConfigEOMapper, ParamsReportConfigEO> implements IParamsReportConfigEOService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOSSFileService ossFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IParamsReportConfigEOService paramsReportConfigEOService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IParamsReportConfigDataEOService paramsReportConfigDataEOService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
*
|
*
|
||||||
@@ -31,4 +55,102 @@ public class ParamsReportConfigEOServiceImpl extends ServiceImpl<ParamsReportCon
|
|||||||
List<ParamsReportConfigEO> list = list(queryWrapper);
|
List<ParamsReportConfigEO> list = list(queryWrapper);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean save(List<Map<String, Object>> configDataList, String paramsManifestId) {
|
||||||
|
List<ParamsReportConfigDataEO> newConfigDataEOList = new ArrayList<>();
|
||||||
|
List<ParamsReportConfigEO> paramsReportConfigEOList = paramsReportConfigEOService.queryList(paramsManifestId); // 查询配置列
|
||||||
|
List<String> paramsReportConfigIdList = paramsReportConfigEOList.stream().map(ParamsConfigEO::getId).collect(Collectors.toList());
|
||||||
|
List<ParamsReportConfigDataEO> paramsReportConfigDataEOList = paramsReportConfigDataEOService.queryListByConfigIdList(paramsReportConfigIdList); // 查询所有配置数据
|
||||||
|
|
||||||
|
// 处理数据
|
||||||
|
for (Map<String, Object> map : configDataList) {
|
||||||
|
String paramsCollectManifestId = (String) map.get("id");
|
||||||
|
|
||||||
|
// 添加配置数据
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
ParamsReportConfigDataEO paramsReportConfigDataEO = new ParamsReportConfigDataEO();
|
||||||
|
if ("id".equals(entry.getKey())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取值
|
||||||
|
String paramsReportConfigEOId = entry.getKey();
|
||||||
|
Map<String, Object> paramsReportConfigDataMap = (Map<String, Object>) entry.getValue();
|
||||||
|
// 无法转ParamsConfigDataVO(遍历会出现该异常 : LinkedHashMap cannot be cast to ParamsConfigDataVO)
|
||||||
|
List<Map<String, Object>> configDataVOList = (List<Map<String, Object>>) paramsReportConfigDataMap.get("list");
|
||||||
|
|
||||||
|
// 判断是新增还是修改
|
||||||
|
ParamsConfigDataEO oldConfigDataEO = getConfigDataEOByConfigIdAndCollectManifestId(paramsReportConfigEOId, paramsCollectManifestId, paramsReportConfigDataEOList);
|
||||||
|
if (ObjectUtil.isNotEmpty(oldConfigDataEO)) {
|
||||||
|
paramsReportConfigDataEO.setId(oldConfigDataEO.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
paramsReportConfigDataEO.setParamsCollectManifestId(paramsCollectManifestId);
|
||||||
|
paramsReportConfigDataEO.setParamsConfigId(paramsReportConfigEOId);
|
||||||
|
if (CollectionUtil.isNotEmpty(configDataVOList)) {
|
||||||
|
for (Map<String, Object> paramsConfigDataVO : configDataVOList) {
|
||||||
|
String type = (String) paramsConfigDataVO.get("type");
|
||||||
|
String dataValue = (String) paramsConfigDataVO.get("dataValue");
|
||||||
|
|
||||||
|
if (type.equals(ConfigDataTypeEnum.TEXT.getValue())) {
|
||||||
|
paramsReportConfigDataEO.setTextData(dataValue);
|
||||||
|
|
||||||
|
} else if (type.equals(ConfigDataTypeEnum.PULL.getValue())
|
||||||
|
|| type.equals(ConfigDataTypeEnum.PULL_MORE.getValue())) {
|
||||||
|
paramsReportConfigDataEO.setPullData(dataValue);
|
||||||
|
|
||||||
|
} else if (type.equals(ConfigDataTypeEnum.FILE.getValue())) {
|
||||||
|
if (StringUtils.isNotEmpty(dataValue) && dataValue.contains(",")) { // 新加多个文件
|
||||||
|
// 处理文件connectId
|
||||||
|
String[] fileIdList = dataValue.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);
|
||||||
|
dataValue = connectId;
|
||||||
|
} else if (StringUtils.isNotEmpty(dataValue) && !dataValue.contains(",")) {
|
||||||
|
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(dataValue);
|
||||||
|
if(CollectionUtil.isEmpty(ossFiles)){ // 新加了一个文件
|
||||||
|
String connectId = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
//修改文件表关联信息connect_id
|
||||||
|
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||||
|
for (String fileId : dataValue.split(",")) {
|
||||||
|
OSSFile ossFile = new OSSFile();
|
||||||
|
ossFile.setId(fileId);
|
||||||
|
ossFile.setConnectId(connectId);
|
||||||
|
oSSFileList.add(ossFile);
|
||||||
|
}
|
||||||
|
ossFileService.updateFileInfo(oSSFileList);
|
||||||
|
dataValue = connectId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paramsReportConfigDataEO.setFileConnectId(dataValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newConfigDataEOList.add(paramsReportConfigDataEO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量更新
|
||||||
|
return paramsReportConfigDataEOService.saveOrUpdateBatch(newConfigDataEOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ParamsReportConfigDataEO getConfigDataEOByConfigIdAndCollectManifestId(String configId, String collectManifestId, List<ParamsReportConfigDataEO> paramsReportConfigDataEOList) {
|
||||||
|
List<ParamsReportConfigDataEO> configDataEOList = paramsReportConfigDataEOList.stream()
|
||||||
|
.filter(e-> configId.equals(e.getParamsConfigId()) && collectManifestId.equals(e.getParamsCollectManifestId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(configDataEOList)) {
|
||||||
|
return configDataEOList.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -3,6 +3,9 @@ package com.jero.modules.cert.report.vo;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ParamsReportDetailVO {
|
public class ParamsReportDetailVO {
|
||||||
|
|
||||||
@@ -37,6 +40,9 @@ public class ParamsReportDetailVO {
|
|||||||
@ApiModelProperty(value = "对应参数模板发布版本")
|
@ApiModelProperty(value = "对应参数模板发布版本")
|
||||||
private Integer paramsTemplatePublishVersion;
|
private Integer paramsTemplatePublishVersion;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "保存专用")
|
||||||
|
private List<Map<String, Object>> configDataList; // 保存专用
|
||||||
|
|
||||||
// 导出通用
|
// 导出通用
|
||||||
private String cut;
|
private String cut;
|
||||||
private String exportName;
|
private String exportName;
|
||||||
|
|||||||
Reference in New Issue
Block a user