组态提交
This commit is contained in:
@@ -4,6 +4,7 @@ import com.njcn.web.pojo.param.BaseParam;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
@@ -27,6 +28,9 @@ public class CsConfigurationParm {
|
|||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
private String fileContent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ public class CsConfigurationPO extends BaseEntity {
|
|||||||
@TableField(value = "`name`")
|
@TableField(value = "`name`")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@TableField(value = "image_path")
|
||||||
|
private String imagePath;
|
||||||
|
|
||||||
@TableField(value = "remark")
|
@TableField(value = "remark")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ public class CsConfigurationVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "组态项目名称")
|
@ApiModelProperty(value = "组态项目名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String fileContent;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "操作人")
|
@ApiModelProperty(value = "操作人")
|
||||||
private String operater;
|
private String operater;
|
||||||
|
|
||||||
|
|||||||
@@ -77,4 +77,5 @@ public class CsConfigurationController extends BaseController {
|
|||||||
String filePath = csConfigurationService.uploadImage(issuesFile);
|
String filePath = csConfigurationService.uploadImage(issuesFile);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,new MinIoUploadResDTO(issuesFile.getOriginalFilename(),filePath), methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,new MinIoUploadResDTO(issuesFile.getOriginalFilename(),filePath), methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,15 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +53,8 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
public boolean add(CsConfigurationParm csConfigurationParm) {
|
public boolean add(CsConfigurationParm csConfigurationParm) {
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
BeanUtils.copyProperties(csConfigurationParm,csConfigurationPO);
|
BeanUtils.copyProperties(csConfigurationParm,csConfigurationPO);
|
||||||
|
csConfigurationPO.setImagePath(csConfigurationParm.getFileContent());
|
||||||
|
|
||||||
csConfigurationPO.setStatus("1");
|
csConfigurationPO.setStatus("1");
|
||||||
boolean save = this.save(csConfigurationPO);
|
boolean save = this.save(csConfigurationPO);
|
||||||
return save;
|
return save;
|
||||||
@@ -56,6 +64,10 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
NjcnBeanUtil.copyPropertiesIgnoreCase(auditParm,csConfigurationPO);
|
NjcnBeanUtil.copyPropertiesIgnoreCase(auditParm,csConfigurationPO);
|
||||||
|
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(auditParm.getFileContent()), HarmonicConstant.CONFIGURATIONPATH, HarmonicConstant.CONFIGURATIONNAME);
|
||||||
|
|
||||||
|
csConfigurationPO.setImagePath(s);
|
||||||
|
|
||||||
boolean b = this.updateById(csConfigurationPO);
|
boolean b = this.updateById(csConfigurationPO);
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
@@ -85,6 +97,19 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
List<CsConfigurationVO> collect = csConfigurationPOPage.getRecords().stream().map(page -> {
|
List<CsConfigurationVO> collect = csConfigurationPOPage.getRecords().stream().map(page -> {
|
||||||
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
||||||
BeanUtils.copyProperties(page, csDevModelPageVO);
|
BeanUtils.copyProperties(page, csDevModelPageVO);
|
||||||
|
if(Objects.isNull(page.getImagePath())){
|
||||||
|
csDevModelPageVO.setFileContent("");
|
||||||
|
|
||||||
|
}else {
|
||||||
|
InputStream fileStream = fileStorageUtil.getFileStream(page.getImagePath());
|
||||||
|
String text = new BufferedReader(
|
||||||
|
new InputStreamReader(fileStream, StandardCharsets.UTF_8))
|
||||||
|
.lines()
|
||||||
|
.collect(Collectors.joining("\n"));
|
||||||
|
csDevModelPageVO.setFileContent(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
csDevModelPageVO.setOperater(collect2.get(csDevModelPageVO.getCreateBy()));
|
csDevModelPageVO.setOperater(collect2.get(csDevModelPageVO.getCreateBy()));
|
||||||
return csDevModelPageVO;
|
return csDevModelPageVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
@@ -100,4 +125,11 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
public String uploadImage(MultipartFile issuesFile) {
|
public String uploadImage(MultipartFile issuesFile) {
|
||||||
return fileStorageUtil.getFileUrl( fileStorageUtil.uploadMultipart(issuesFile, HarmonicConstant.CONFIGURATIONPATH));
|
return fileStorageUtil.getFileUrl( fileStorageUtil.uploadMultipart(issuesFile, HarmonicConstant.CONFIGURATIONPATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*将strin写入Json文件,返回一个InputStream*/
|
||||||
|
public InputStream writeJsonStringToInputStream(String jsonString) {
|
||||||
|
// 转换为输入流
|
||||||
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(jsonString.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return inputStream;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
|||||||
QueryWrapper<CsPagePO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsPagePO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq(StringUtils.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
queryWrapper.eq(StringUtils.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
||||||
like(StringUtils.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
like(StringUtils.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
||||||
eq ("status",1).
|
eq ("status",1);
|
||||||
orderByDesc(CsPagePO.COL_CREATE_TIME);
|
// orderByDesc(CsPagePO.COL_CREATE_TIME);
|
||||||
|
|
||||||
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
||||||
List<String> collect1 = pageData.getRecords().stream().map(CsPagePO::getCreateBy).collect(Collectors.toList());
|
List<String> collect1 = pageData.getRecords().stream().map(CsPagePO::getCreateBy).collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user