|
|
@ -33,7 +33,12 @@ import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|
|
|
import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationCMTask; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import sun.misc.BASE64Encoder; |
|
|
|
|
|
|
|
import java.io.FileInputStream; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -215,8 +220,45 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV |
|
|
|
@Override |
|
|
|
public List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty() { |
|
|
|
return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
|
.isNull(SchBaseVehiclematerialgroup::getMaterial_path) |
|
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_id,"9434")); |
|
|
|
.isNull(SchBaseVehiclematerialgroup::getMaterial_path)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public String selectMaterialFile(String groupId) { |
|
|
|
SchBaseVehiclematerialgroup one = this.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_id, groupId)); |
|
|
|
if (ObjectUtil.isNotEmpty(one)){ |
|
|
|
if(StrUtil.isNotEmpty(one.getMaterial_path())){ |
|
|
|
InputStream inputStream = null; |
|
|
|
byte[] data = null; |
|
|
|
String contentType=""; |
|
|
|
try { |
|
|
|
String fileName = one.getMaterial_path().substring(one.getMaterial_path().lastIndexOf("/") + 1, one.getMaterial_path().length()); |
|
|
|
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()); |
|
|
|
if ("jpg".equalsIgnoreCase(suffix) || "jpeg".equalsIgnoreCase(suffix)) { |
|
|
|
contentType = "data:image/jpeg;base64,"; |
|
|
|
} else if ("png".equalsIgnoreCase(suffix)) { |
|
|
|
contentType = "data:image/png;base64,"; |
|
|
|
} else if("aac".equalsIgnoreCase(suffix)){ |
|
|
|
contentType = "data:audio/aac;base64,"; |
|
|
|
} else if("mp3".equalsIgnoreCase(suffix)){ |
|
|
|
contentType = "data:audio/x-mpeg;base64,"; |
|
|
|
} else if("wav".equalsIgnoreCase(suffix)){ |
|
|
|
contentType = "data:audio/x-wav;base64,"; |
|
|
|
} |
|
|
|
inputStream = new FileInputStream(one.getMaterial_path()); |
|
|
|
data = new byte[inputStream.available()]; |
|
|
|
inputStream.read(data); |
|
|
|
inputStream.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
BASE64Encoder encoder = new BASE64Encoder(); |
|
|
|
return contentType + encoder.encode(data).replace("\r\n", ""); |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
private Long getTime(String dateString) { |
|
|
|