Commit 3a207190 authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

标准下检验项排序&车企文件上传附件

See merge request !379
parents 7fb0439d 0e318103
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
......@@ -87,4 +88,8 @@ public class ReviewEnterpriseArchive implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty("附件")
@TableField(exist = false)
private String[] url;
}
\ No newline at end of file
......@@ -45,4 +45,9 @@ public interface ReviewEnterpriseArchiveService extends IService<ReviewEnterpris
// 导入车企文件
void importEnterprise(List<EnterpriseImportFileVO> list, Long taskId,HttpServletResponse response);
/**
* 编辑车企文件
* @param reviewEnterpriseArchive
*/
void editEnterpriseArchive(ReviewEnterpriseArchive reviewEnterpriseArchive);
}
......@@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.Task;
import com.ruoyi.domain.vo.EnterpriseImportFileVO;
......@@ -149,13 +150,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
if (sum >0 ) {
throw new ServiceException("新增文件名称重复,请检查", HttpStatus.ERROR);
} else {
// 将附件地址存入photo字段中
String joinUrl = StringUtils.join(reviewEnterpriseArchive.getUrl(),",");
reviewEnterpriseArchive.setPhoto(joinUrl);
reviewEnterpriseArchiveService.save(reviewEnterpriseArchive);
ReviewEnterpriseArchiveFindByTaskIdRequest request = new ReviewEnterpriseArchiveFindByTaskIdRequest();
request.setTaskId(reviewEnterpriseArchive.getTaskId());
// 根据任务id查询任务底下的所有车企文件
List<ReviewEnterpriseArchive> list = reviewEnterpriseArchiveMapper.findEnterpriseArchiveByTaskId(request);
if (list != null && list.size() != 0) {
for (ReviewEnterpriseArchive archive : list) {
// 如果库里的企业名称不是新增时传入的企业名称则修改
if (!Objects.equals(archive.getEnterpriseName(), reviewEnterpriseArchive.getEnterpriseName())) {
archive.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
}
......@@ -176,7 +182,9 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
@Override
public ReviewEnterpriseArchive getInfo(ReviewEnterpriseArchiveGetInfoRequest request) {
return reviewEnterpriseArchiveMapper.selectById(request.getId());
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(request.getId());
reviewEnterpriseArchive.setUrl(reviewEnterpriseArchive.getPhoto().split(","));
return reviewEnterpriseArchive;
}
......@@ -237,6 +245,14 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
}
reviewEnterpriseArchiveMapper.insertEnterprise(list);
}
@Override
public void editEnterpriseArchive(ReviewEnterpriseArchive reviewEnterpriseArchive) {
// 将附件地址存入photo字段中
String joinUrl = StringUtils.join(reviewEnterpriseArchive.getUrl(),",");
reviewEnterpriseArchive.setPhoto(joinUrl);
reviewEnterpriseArchiveService.updateById(reviewEnterpriseArchive);
}
}
......
......@@ -9,7 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Transactional
......@@ -21,6 +25,23 @@ public class StandardInspectionItemRelationServiceImpl extends ServiceImpl<Stand
@Override
public List<DictDataVO> getByStandardId(Long standardId) {
return standardInspectionItemRelationMapper.getListByStandardId(standardId);
List<DictDataVO> list = standardInspectionItemRelationMapper.getListByStandardId(standardId);
// 定义期望的排序关键字
List<String> desiredOrder = Arrays.asList("sraif", "grfis", "trfis");
// 使用流API对list进行排序
List<DictDataVO> sortedList = new ArrayList<>();
// 首先,创建一个映射表,键为dictValue,值为DictDataVO对象
Map<String, DictDataVO> map = list.stream().collect(Collectors.toMap(DictDataVO::getDictValue, vo -> vo));
// 然后,根据desiredOrder中的顺序从映射表中提取元素
for (String order : desiredOrder) {
if (map.containsKey(order)) {
sortedList.add(map.get(order));
}
}
return sortedList;
}
}
......@@ -93,7 +93,7 @@ public class ReviewEnterpriseArchiveController extends BaseController {
@Log(title = "编辑车企文件", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/edit")
public R<String> editEnterpriseArchive(@Validated @RequestBody ReviewEnterpriseArchive reviewEnterpriseArchive) {
reviewEnterpriseArchiveService.updateById(reviewEnterpriseArchive);
reviewEnterpriseArchiveService.editEnterpriseArchive(reviewEnterpriseArchive);
return R.ok();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment