|
|
|
@ -25,7 +25,9 @@ import org.springblade.modules.business.pojo.entity.MaintenanceTaskDetailGoods; |
|
|
|
import org.springblade.modules.business.pojo.entity.maintenance.*; |
|
|
|
import org.springblade.modules.business.pojo.entity.maintenance.*; |
|
|
|
import org.springblade.modules.business.service.IMaintenanceApplyGoodsService; |
|
|
|
import org.springblade.modules.business.service.IMaintenanceApplyGoodsService; |
|
|
|
import org.springblade.modules.business.service.IMaintenanceTaskDetailService; |
|
|
|
import org.springblade.modules.business.service.IMaintenanceTaskDetailService; |
|
|
|
|
|
|
|
import org.springblade.modules.system.pojo.entity.Dept; |
|
|
|
import org.springblade.modules.system.pojo.entity.User; |
|
|
|
import org.springblade.modules.system.pojo.entity.User; |
|
|
|
|
|
|
|
import org.springblade.modules.system.service.IDeptService; |
|
|
|
import org.springblade.modules.system.service.IUserService; |
|
|
|
import org.springblade.modules.system.service.IUserService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -62,6 +64,9 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IMaintenanceApplyGoodsService maintenanceApplyGoodsService; |
|
|
|
private IMaintenanceApplyGoodsService maintenanceApplyGoodsService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IDeptService deptService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<MaintenanceTaskDetail> findListByDeviceId(Long deviceId) { |
|
|
|
public List<MaintenanceTaskDetail> findListByDeviceId(Long deviceId) { |
|
|
|
return baseMapper.findListByDeviceId(deviceId); |
|
|
|
return baseMapper.findListByDeviceId(deviceId); |
|
|
|
@ -82,14 +87,21 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
map1.put("taskName", task.getDeptName()); |
|
|
|
map1.put("taskName", task.getDeptName()); |
|
|
|
map1.put("address", task.getDeptName()); |
|
|
|
Dept dept = deptService.getById(task.getDeptId()); |
|
|
|
|
|
|
|
map1.put("address", dept.getLabAddress()); |
|
|
|
map1.put("taskContent", task.getTaskContent()); |
|
|
|
map1.put("taskContent", task.getTaskContent()); |
|
|
|
|
|
|
|
User serviceman = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, task.getServicemanId())); |
|
|
|
|
|
|
|
map1.put("serviceManName", serviceman.getName()); |
|
|
|
|
|
|
|
map1.put("time", DateFormatUtils.format(task.getFinishTime(),"yyyy年MM月dd日")); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
map2.put("taskName", task.getDeptName()); |
|
|
|
map2.put("taskName", task.getDeptName()); |
|
|
|
map2.put("address", task.getDeptName()); |
|
|
|
// 实验室地址
|
|
|
|
|
|
|
|
map2.put("address", dept.getLabAddress()); |
|
|
|
map2.put("inspectionConclusion", task.getInspectionConclusion()); |
|
|
|
map2.put("inspectionConclusion", task.getInspectionConclusion()); |
|
|
|
map2.put("signatureTime",task.getSignatureTime() != null ? DateFormatUtils.format(task.getSignatureTime(),"yyyy年MM月dd日"): ""); |
|
|
|
map2.put("signatureTime",task.getFinishTime() != null ? DateFormatUtils.format(task.getFinishTime(),"yyyy年MM月dd日"): ""); |
|
|
|
|
|
|
|
map2.put("approveRemark",task.getApproveRemark()); |
|
|
|
|
|
|
|
|
|
|
|
//获取客户联系人、联系电话
|
|
|
|
//获取客户联系人、联系电话
|
|
|
|
Map<String,String> cusMap = baseMapper.getDeptContact(task.getDeptId()); |
|
|
|
Map<String,String> cusMap = baseMapper.getDeptContact(task.getDeptId()); |
|
|
|
if(CollectionUtils.isNotEmpty(cusMap)){ |
|
|
|
if(CollectionUtils.isNotEmpty(cusMap)){ |
|
|
|
@ -150,28 +162,30 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取签字图片
|
|
|
|
//获取签字图片
|
|
|
|
if (StringUtils.isNotBlank(task.getSignatureUrl())) { |
|
|
|
map2.put("image",task.getSignUrl()); |
|
|
|
try { |
|
|
|
// 目前使用signUrl字段,为字符串,后续可能会改为图片地址
|
|
|
|
//获取图片
|
|
|
|
// if (StringUtils.isNotBlank(task.getSignatureUrl())) {
|
|
|
|
URL url = new URL(task.getSignatureUrl()); |
|
|
|
// try {
|
|
|
|
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); |
|
|
|
// //获取图片
|
|
|
|
httpURLConnection.setRequestMethod("GET"); |
|
|
|
// URL url = new URL(task.getSignatureUrl());
|
|
|
|
httpURLConnection.setDoInput(true); |
|
|
|
// HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
|
|
|
|
InputStream inputStream = httpURLConnection.getInputStream(); |
|
|
|
// httpURLConnection.setRequestMethod("GET");
|
|
|
|
BufferedImage image = ImageIO.read(inputStream); |
|
|
|
// httpURLConnection.setDoInput(true);
|
|
|
|
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); |
|
|
|
// InputStream inputStream = httpURLConnection.getInputStream();
|
|
|
|
ImageIO.write(image, "png", arrayOutputStream); |
|
|
|
// BufferedImage image = ImageIO.read(inputStream);
|
|
|
|
byte[] bytes = arrayOutputStream.toByteArray(); |
|
|
|
// ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
|
|
|
|
Double width = Double.valueOf(image.getWidth()); |
|
|
|
// ImageIO.write(image, "png", arrayOutputStream);
|
|
|
|
Double height = Double.valueOf(image.getHeight()); |
|
|
|
// byte[] bytes = arrayOutputStream.toByteArray();
|
|
|
|
WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(bytes, width, height, 0.6, 1.9); |
|
|
|
// Double width = Double.valueOf(image.getWidth());
|
|
|
|
map2.put("image", voidWriteCellData); |
|
|
|
// Double height = Double.valueOf(image.getHeight());
|
|
|
|
} catch (Exception e) { |
|
|
|
// WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(bytes, width, height, 0.6, 1.9);
|
|
|
|
throw new RuntimeException(e); |
|
|
|
// map2.put("image", voidWriteCellData);
|
|
|
|
} |
|
|
|
// } catch (Exception e) {
|
|
|
|
} else { |
|
|
|
// throw new RuntimeException(e);
|
|
|
|
map2.put("image",null); |
|
|
|
// }
|
|
|
|
} |
|
|
|
// } else {
|
|
|
|
|
|
|
|
// map2.put("image",null);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//将数据导出到Excel
|
|
|
|
//将数据导出到Excel
|
|
|
|
ServletOutputStream outputStream = response.getOutputStream(); |
|
|
|
ServletOutputStream outputStream = response.getOutputStream(); |
|
|
|
@ -212,14 +226,20 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
map1.put("taskName", task.getDeptName()); |
|
|
|
map1.put("taskName", task.getDeptName()); |
|
|
|
map1.put("address", task.getDeptName()); |
|
|
|
// 实验室地址
|
|
|
|
|
|
|
|
Dept dept = deptService.getById(task.getDeptId()); |
|
|
|
|
|
|
|
map1.put("address", dept.getLabAddress()); |
|
|
|
map1.put("taskContent", task.getTaskContent()); |
|
|
|
map1.put("taskContent", task.getTaskContent()); |
|
|
|
|
|
|
|
User serviceman = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, task.getServicemanId())); |
|
|
|
|
|
|
|
map1.put("serviceManName", serviceman.getRealName()); |
|
|
|
|
|
|
|
map1.put("time", DateFormatUtils.format(task.getFinishTime(),"yyyy年MM月dd日")); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
map2.put("taskName", task.getDeptName()); |
|
|
|
map2.put("taskName", task.getDeptName()); |
|
|
|
map2.put("address", task.getDeptName()); |
|
|
|
map2.put("address", dept.getLabAddress()); |
|
|
|
map2.put("inspectionConclusion", task.getInspectionConclusion()); |
|
|
|
map2.put("inspectionConclusion", task.getInspectionConclusion()); |
|
|
|
map2.put("signatureTime",task.getSignatureTime() != null ? DateFormatUtils.format(task.getSignatureTime(),"yyyy年MM月dd日"): ""); |
|
|
|
map2.put("signatureTime",task.getFinishTime() != null ? DateFormatUtils.format(task.getFinishTime(),"yyyy年MM月dd日"): ""); |
|
|
|
|
|
|
|
map2.put("approveRemark",task.getApproveRemark()); |
|
|
|
|
|
|
|
|
|
|
|
//获取客户联系人、联系电话
|
|
|
|
//获取客户联系人、联系电话
|
|
|
|
Map<String,String> cusMap = baseMapper.getDeptContact(task.getDeptId()); |
|
|
|
Map<String,String> cusMap = baseMapper.getDeptContact(task.getDeptId()); |
|
|
|
@ -281,28 +301,30 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//获取签字图片
|
|
|
|
//获取签字图片
|
|
|
|
if (StringUtils.isNotBlank(task.getSignatureUrl())) { |
|
|
|
map2.put("image",task.getSignUrl()); |
|
|
|
try { |
|
|
|
// 目前使用signUrl字段,为字符串,后续可能会改为图片地址
|
|
|
|
//获取图片
|
|
|
|
// if (StringUtils.isNotBlank(task.getSignatureUrl())) {
|
|
|
|
URL url = new URL(task.getSignatureUrl()); |
|
|
|
// try {
|
|
|
|
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); |
|
|
|
// //获取图片
|
|
|
|
httpURLConnection.setRequestMethod("GET"); |
|
|
|
// URL url = new URL(task.getSignatureUrl());
|
|
|
|
httpURLConnection.setDoInput(true); |
|
|
|
// HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
|
|
|
|
InputStream inputStream = httpURLConnection.getInputStream(); |
|
|
|
// httpURLConnection.setRequestMethod("GET");
|
|
|
|
BufferedImage image = ImageIO.read(inputStream); |
|
|
|
// httpURLConnection.setDoInput(true);
|
|
|
|
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); |
|
|
|
// InputStream inputStream = httpURLConnection.getInputStream();
|
|
|
|
ImageIO.write(image, "png", arrayOutputStream); |
|
|
|
// BufferedImage image = ImageIO.read(inputStream);
|
|
|
|
byte[] bytes = arrayOutputStream.toByteArray(); |
|
|
|
// ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
|
|
|
|
Double width = Double.valueOf(image.getWidth()); |
|
|
|
// ImageIO.write(image, "png", arrayOutputStream);
|
|
|
|
Double height = Double.valueOf(image.getHeight()); |
|
|
|
// byte[] bytes = arrayOutputStream.toByteArray();
|
|
|
|
WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(bytes, width, height, 0.6, 1.9); |
|
|
|
// Double width = Double.valueOf(image.getWidth());
|
|
|
|
map2.put("image", voidWriteCellData); |
|
|
|
// Double height = Double.valueOf(image.getHeight());
|
|
|
|
} catch (Exception e) { |
|
|
|
// WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(bytes, width, height, 0.6, 1.9);
|
|
|
|
throw new RuntimeException(e); |
|
|
|
// map2.put("image", voidWriteCellData);
|
|
|
|
} |
|
|
|
// } catch (Exception e) {
|
|
|
|
} else { |
|
|
|
// throw new RuntimeException(e);
|
|
|
|
map2.put("image",null); |
|
|
|
// }
|
|
|
|
} |
|
|
|
// } else {
|
|
|
|
|
|
|
|
// map2.put("image",null);
|
|
|
|
|
|
|
|
// }
|
|
|
|
//将数据导出到Excel
|
|
|
|
//将数据导出到Excel
|
|
|
|
String fileName = task.getTaskCode() + "巡检报告.xlsx"; |
|
|
|
String fileName = task.getTaskCode() + "巡检报告.xlsx"; |
|
|
|
zos.putNextEntry(new ZipEntry(fileName)); |
|
|
|
zos.putNextEntry(new ZipEntry(fileName)); |
|
|
|
@ -339,18 +361,19 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
|
|
|
Map<String, Object> map0 = new HashMap<>(); |
|
|
|
Map<String, Object> map0 = new HashMap<>(); |
|
|
|
map0.put("taskName", task.getDeptName()); //客户名称
|
|
|
|
map0.put("taskName", task.getDeptName()); //客户名称
|
|
|
|
map0.put("address", task.getDeptName()); //地址
|
|
|
|
Dept dept = deptService.getById(task.getDeptId()); |
|
|
|
|
|
|
|
map0.put("address", dept.getLabAddress()); //地址
|
|
|
|
//获取客户联系人、联系电话
|
|
|
|
//获取客户联系人、联系电话
|
|
|
|
Map<String,String> cusMap = baseMapper.getDeptContact(task.getDeptId()); |
|
|
|
Map<String,String> cusMap = baseMapper.getDeptContact(task.getDeptId()); |
|
|
|
if(CollectionUtils.isNotEmpty(cusMap)){ |
|
|
|
if(CollectionUtils.isNotEmpty(cusMap)){ |
|
|
|
map0.put("contact",cusMap.get("name")); //联系人
|
|
|
|
map0.put("contact",cusMap.get("name")); //联系人
|
|
|
|
map0.put("phone",cusMap.get("phone")); //联系方式
|
|
|
|
map0.put("phone",cusMap.get("phone")); //联系方式
|
|
|
|
} |
|
|
|
} |
|
|
|
map0.put("servicemanName", task.getServicemanName()); //维修工程师
|
|
|
|
|
|
|
|
map0.put("inspectionConclusion", task.getInspectionConclusion()); //维修结论
|
|
|
|
map0.put("inspectionConclusion", task.getInspectionConclusion()); //维修结论
|
|
|
|
if(task.getServicemanId() != null){ |
|
|
|
if(task.getServicemanId() != null){ |
|
|
|
User serviceman = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, task.getServicemanId())); |
|
|
|
User serviceman = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, task.getServicemanId())); |
|
|
|
map0.put("servicemanPhone", serviceman.getPhone()); //维修工程师联系方式
|
|
|
|
map0.put("servicemanPhone", serviceman.getPhone()); //维修工程师联系方式
|
|
|
|
|
|
|
|
map0.put("servicemanName", serviceman.getRealName()); //维修工程师
|
|
|
|
} |
|
|
|
} |
|
|
|
map0.put("faultDescribe",task.getFaultDescribe()); //故障现象
|
|
|
|
map0.put("faultDescribe",task.getFaultDescribe()); //故障现象
|
|
|
|
map0.put("faultCause",task.getFaultCause()); //故障原因
|
|
|
|
map0.put("faultCause",task.getFaultCause()); //故障原因
|
|
|
|
@ -360,13 +383,14 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
map1.put("taskName", task.getDeptName()); |
|
|
|
map1.put("taskName", task.getDeptName()); |
|
|
|
map1.put("address", task.getDeptName()); |
|
|
|
map1.put("address", dept.getLabAddress()); |
|
|
|
if(CollectionUtils.isNotEmpty(cusMap)){ |
|
|
|
if(CollectionUtils.isNotEmpty(cusMap)){ |
|
|
|
map1.put("contact",cusMap.get("name")); //联系人
|
|
|
|
map1.put("contact",cusMap.get("name")); //联系人
|
|
|
|
map1.put("phone",cusMap.get("phone")); //联系方式
|
|
|
|
map1.put("phone",cusMap.get("phone")); //联系方式
|
|
|
|
} |
|
|
|
} |
|
|
|
map1.put("inspectionConclusion", task.getInspectionConclusion()); |
|
|
|
map1.put("inspectionConclusion", task.getInspectionConclusion()); |
|
|
|
map1.put("signatureTime",task.getSignatureTime() != null ? DateFormatUtils.format(task.getSignatureTime(),"yyyy年MM月dd日"): ""); //客户签字时间
|
|
|
|
map1.put("evaluationRemarks", task.getEvaluationRemarks()); |
|
|
|
|
|
|
|
map1.put("signatureTime",task.getFinishTime() != null ? DateFormatUtils.format(task.getFinishTime(),"yyyy年MM月dd日"): ""); //客户签字时间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RepairGoodsOutputData> repairGoodsList = new ArrayList<>(); |
|
|
|
List<RepairGoodsOutputData> repairGoodsList = new ArrayList<>(); |
|
|
|
@ -417,7 +441,7 @@ public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
map0.put("total",total); //维修材料费用
|
|
|
|
map0.put("total",total); //维修材料费用
|
|
|
|
map0.put("repairTotal", (task.getTravelExpense() == null ? 0.0 : task.getTravelExpense()) + total); //维修费总计
|
|
|
|
map0.put("repairTotal", task.getActualAmount()); |
|
|
|
map0.put("total1",total1); //未维修项目材料费用
|
|
|
|
map0.put("total1",total1); //未维修项目材料费用
|
|
|
|
|
|
|
|
|
|
|
|
//获取签字图片
|
|
|
|
//获取签字图片
|
|
|
|
|