|
|
@ -34,6 +34,7 @@ import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
@ -59,15 +60,17 @@ public class ScmVehicleInspectimgtempService extends MybatisBaseService<ScmVehic |
|
|
|
|
|
|
|
public void save(List<ScmVehicleInspectimgtempDto> inspectimgtemp, String sid) { |
|
|
|
inspectimgtemp.removeAll(Collections.singleton(null)); |
|
|
|
|
|
|
|
if (!inspectimgtemp.isEmpty()) { |
|
|
|
inspectimgtemp.stream().forEach(item -> { |
|
|
|
ScmVehicleInspectimgtemp scmVehicleInspectimgtemp = new ScmVehicleInspectimgtemp(); |
|
|
|
item.getImgTempUrl().forEach(i -> { |
|
|
|
List<String> imgList = new ArrayList<>(); |
|
|
|
item.getImgTempUrl().stream().forEach(i -> { |
|
|
|
if (i.contains(fileUploadComponent.getUrlPrefix())) { |
|
|
|
i = i.replace(fileUploadComponent.getUrlPrefix(),""); |
|
|
|
imgList.add(i.replace(fileUploadComponent.getUrlPrefix(), "")); |
|
|
|
} |
|
|
|
}); |
|
|
|
scmVehicleInspectimgtemp.setImgTempUrl(Joiner.on(",").join(item.getImgTempUrl())); |
|
|
|
scmVehicleInspectimgtemp.setImgTempUrl(Joiner.on(",").join(imgList)); |
|
|
|
scmVehicleInspectimgtemp.setItemSid(sid); |
|
|
|
baseMapper.insert(scmVehicleInspectimgtemp); |
|
|
|
}); |
|
|
@ -80,7 +83,17 @@ public class ScmVehicleInspectimgtempService extends MybatisBaseService<ScmVehic |
|
|
|
|
|
|
|
public List<ScmVehicleInspectimgtempDetailsVo> selectByItemSid(String sid) { |
|
|
|
String path = fileUploadComponent.getUrlPrefix(); |
|
|
|
return baseMapper.selectByItemSid(sid, path); |
|
|
|
List<ScmVehicleInspectimgtempDetailsVo> voList = baseMapper.selectByItemSid(sid); |
|
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
|
for (ScmVehicleInspectimgtempDetailsVo v : voList) { |
|
|
|
List<String> stringList = Arrays.asList(v.getImgUrl().split(",")); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
for (int i = 0; i < stringList.size(); i++) { |
|
|
|
list.add(fileUploadComponent.getUrlPrefix() + stringList.get(i)); |
|
|
|
} |
|
|
|
v.setImgTempUrl(list); |
|
|
|
} |
|
|
|
return voList; |
|
|
|
} |
|
|
|
|
|
|
|
public void deleteAllByItemSid(String[] sids) { |
|
|
|