提交 87bd7560 authored 作者: zhoushaopan's avatar zhoushaopan

[使用报告]修改

上级 eeca0947
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.usereport.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.entity.WrodParameter;
import com.tykj.dev.device.file.service.UseReportFIleService;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.usereport.service.DeviceUseReportService;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo;
......@@ -17,9 +18,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -53,7 +56,7 @@ public class DeviceUseReportController {
@ApiOperation(value = "生成装备使用报告", notes = "可以通过这个接口生成装备使用报告")
@PostMapping("/create")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity createDeviceUseReport(@RequestBody @Validated DeviceUseReportCreateVo deviceUseReportCreateVo) {
public ResponseEntity createDeviceUseReport(@RequestBody @Validated DeviceUseReportCreateVo deviceUseReportCreateVo, @ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
return ResultUtil.success(deviceUseReportService.createReport(deviceUseReportCreateVo));
}
......@@ -65,15 +68,21 @@ public class DeviceUseReportController {
BeanUtils.copyProperties(d, deviceUseReportDetailVo);
//分解数量详情组合字段
List<Integer> list = StringSplitUtil.userIdSplit(d.getReportDetail());
if (list.size() > 7) {
if (list.size() > 13) {
deviceUseReportDetailVo.setDeviceNumber(list.get(0));
deviceUseReportDetailVo.setInLibraryNum(list.get(1));
deviceUseReportDetailVo.setRepairNum(list.get(2));
deviceUseReportDetailVo.setAllotNum(list.get(3));
deviceUseReportDetailVo.setSendBackNum(list.get(4));
deviceUseReportDetailVo.setDestoryNum(list.get(5));
deviceUseReportDetailVo.setPackingNum(list.get(6));
deviceUseReportDetailVo.setRetiredNum(list.get(7));
deviceUseReportDetailVo.setSendRepairNum(list.get(2));
deviceUseReportDetailVo.setReceiveRepairNum(list.get(3));
deviceUseReportDetailVo.setDestoryNum(list.get(4));
deviceUseReportDetailVo.setSendAllotNum(list.get(5));
deviceUseReportDetailVo.setReceiveAllotNum(list.get(6));
deviceUseReportDetailVo.setSensAllotBackNum(list.get(7));
deviceUseReportDetailVo.setReceiveAllotBackNum(list.get(8));
deviceUseReportDetailVo.setSendBackNum(list.get(9));
deviceUseReportDetailVo.setScrapStatisticsNum(list.get(10));
deviceUseReportDetailVo.setPackingNum(list.get(11));
deviceUseReportDetailVo.setRetiredNum(list.get(12));
deviceUseReportDetailVo.setDecommissioningStatisticsNum(list.get(13));
}
return ResultUtil.success(deviceUseReportDetailVo);
}
......@@ -104,9 +113,9 @@ public class DeviceUseReportController {
wrodParameter.setDestructionNum(deviceUseReportDetailVo.getDestoryNum());
wrodParameter.setFieldingNum(deviceUseReportDetailVo.getPackingNum());
wrodParameter.setStorageNum(deviceUseReportDetailVo.getInLibraryNum());
wrodParameter.setMaintenanceNum(deviceUseReportDetailVo.getRepairNum());
// wrodParameter.setMaintenanceNum(deviceUseReportDetailVo.getRepairNum());
wrodParameter.setRepelNum(deviceUseReportDetailVo.getSendBackNum());
wrodParameter.setWithNum(deviceUseReportDetailVo.getAllotNum());
// wrodParameter.setWithNum(deviceUseReportDetailVo.getAllotNum());
wrodParameter.setTitleAnnual(localDateTime.getYear());
useReportFIleService.findToFileService(wrodParameter, response, httpServletRequest);
return ResponseEntity.ok("下载成功");
......
package com.tykj.dev.device.usereport.service;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.device.usereport.subject.vo.DeviceStatistics;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo;
......
......@@ -5,7 +5,10 @@ import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.destroy.repository.DeviceDestroyBillDao;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
......@@ -28,6 +31,7 @@ import com.tykj.dev.device.sendback.entity.vo.RepelManagementVo;
import com.tykj.dev.device.sendback.service.RepelQueryService;
import com.tykj.dev.device.storage.repository.StorageBillDao;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
......@@ -101,6 +105,8 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired
private BlockChainUtil blockChainUtil;
@Autowired
private AllotBackBillDao allotBackBillDao;
@Override
public DeviceUseReport addEntity(DeviceUseReport deviceUseReportEntity) {
......@@ -138,6 +144,167 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
return deviceUseReportDao.save(deviceUseReportEntity);
}
// @Override
// public DeviceUseReport createReport(DeviceUseReportCreateVo deviceUseReportCreateVo) {
// DeviceUseReport deviceUseReportEntity = new DeviceUseReport();
// deviceUseReportEntity.setUnit(userUtils.getCurrentUserUnitName());
// deviceUseReportEntity.setStartTime(deviceUseReportCreateVo.getStartTime());
// deviceUseReportEntity.setEndTime(deviceUseReportCreateVo.getEndTime());
// StringBuffer stringBuffer = new StringBuffer();
// //按照开始时间和结束时间设置标题
// Date date = deviceUseReportCreateVo.getStartTime();
// Date date2 = deviceUseReportCreateVo.getEndTime();
// Calendar calendar = Calendar.getInstance();
// Calendar calendar2 = Calendar.getInstance();
// calendar.setTime(date);
// calendar2.setTime(date2);
// stringBuffer.append(calendar.get(Calendar.YEAR)).append("年");
// stringBuffer.append(calendar.get(Calendar.MONTH) + 1).append("月");
// stringBuffer.append(calendar.get(Calendar.DAY_OF_MONTH)).append("日");
// stringBuffer.append("至");
// stringBuffer.append(calendar2.get(Calendar.YEAR)).append("年");
// stringBuffer.append(calendar2.get(Calendar.MONTH) + 1).append("月");
// stringBuffer.append(calendar2.get(Calendar.DAY_OF_MONTH)).append("日");
// stringBuffer.append("使用情况报告");
// deviceUseReportEntity.setTitle(stringBuffer.toString());
// //获取所属当前单位的所有装备
// DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
// deviceLibrarySelectVo.setSize(Integer.MAX_VALUE);
// List<DeviceLibrary> deviceLibraryEntities = deviceLibraryService.getPage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable()).getContent();
// int num = deviceLibraryEntities.size();
// int inLibraryNum = 0;//入库
// int repairNum;//维修
// int destoryNum = 0;
// int allotNum = 0;
// int sendBackNum = 0;
// int packingNum = 0;
// int retiredNum = 0;
// //筛选出日期范围内所有入库账单
// List<StorageBill> storageBillEntities = storageBillDao.findAll().stream()
// .filter(storageBillEntity -> storageBillEntity.getStorageStatus() == 2 && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(storageBillEntity.getReceiveUseraId())) && storageBillEntity.getUpdateTime().after(date) && storageBillEntity.getUpdateTime().before(date2))
// .collect(toList());
// //累加入库数量
// if (storageBillEntities.size() > 0) {
// for (StorageBill s : storageBillEntities) {
// inLibraryNum = inLibraryNum + s.getStoragedCount();
// }
// }
// //配发状态list
// List<Integer> allotStatusList = new ArrayList<>();
// allotStatusList.add(2);
// allotStatusList.add(3);
// allotStatusList.add(5);
// //筛选出接收配发装备的账单
// List<AllotBill> allotBillEntities = allotBillDao.findAll().stream()
// .filter(allotBillEntity -> allotBillEntity.getAllotStatus() == 5 && userUtils.getCurrentUserUnitName().equals(allotBillEntity.getReceiveUnit()) && allotBillEntity.getReceiveTime().after(date) && allotBillEntity.getReceiveTime().before(date2))
// .collect(toList());
// //筛选出配发给其它单位的账单
// List<AllotBill> allotBillEntities2 = allotBillDao.findAll().stream()
// .filter(allotBillEntity -> allotStatusList.contains(allotBillEntity.getAllotStatus()) && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(allotBillEntity.getSendUseraId())) && allotBillEntity.getSendTime().after(date) && allotBillEntity.getSendTime().before(date2))
// .collect(toList());
// //退回状态list
// List<Integer> allotStatusBackList = new ArrayList<>();
// allotStatusBackList.addAll(Arrays.asList(0,3));
// //筛选出配接收退回的账单
// List<AllotBackBill> allotBackBills = allotBackBillDao.findAll().stream()
// .filter(allotBackBill -> allotBackBill.getBackStatus() == 3 && userUtils.getCurrentUserUnitName().equals(allotBackBill.getReceiveUnit()) && allotBackBill.getReceiveTime().after(date) && allotBackBill.getReceiveTime().before(date2))
// .collect(toList());
//// //筛选出退回给其它单位的账单
//// List<AllotBackBill> allotBackBills2 = allotBackBillDao.findAll().stream()
//// .filter(allotBackBill -> allotStatusBackList.contains(allotBackBill.getBackStatus()) && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(allotBackBill.getSendUseraId())) && allotBackBill.getSendTime().after(date) && allotBackBill.getSendTime().before(date2))
//// .collect(toList());
//
//
// //累加入库数量
// if (allotBillEntities.size() > 0) {
// for (AllotBill s : allotBillEntities) {
//// inLibraryNum = inLibraryNum + s.getReceiveCount();
// inLibraryNum = inLibraryNum + s.getAllotCount();
// }
// }
// //累加配发退回数量
// if (allotBackBills.size() > 0) {
// for (AllotBackBill allotBackBill : allotBackBills) {
// inLibraryNum = inLibraryNum + allotBackBill.getBackCount();
// }
// }
// //累加配发数量
// if (allotBillEntities2.size() > 0) {
// for (AllotBill s : allotBillEntities2) {
// allotNum = allotNum + s.getAllotedCount();
// }
// }
//
// //省级才能销毁,列装,退装
// if (userUtils.getCurrentUnitLevel() == 1) {
// //筛选出在日期范围内的销毁单
//// List<DeviceDestroyBill> deviceDestoryBillEntities = deviceDestroyBillDao.findAll().stream()
//// .filter(deviceDestoryBillEntity -> deviceDestoryBillEntity.getDestroyStatus() == 2 && deviceDestoryBillEntity.getDestroyTime()!=null&&deviceDestoryBillEntity.getDestroyTime().after(date) && deviceDestoryBillEntity.getDestroyTime().before(date2))
//// .collect(toList());
//// //累加销毁数量
//// if (deviceDestoryBillEntities.size() > 0) {
//// for (DeviceDestroyBill s : deviceDestoryBillEntities) {
//// List<Integer> list = StringSplitUtil.split(s.getDestroyDeviceDetail());
//// destoryNum = destoryNum + list.size();
//// }
//// }
// //筛选列装
// List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll().stream()
// .filter(packingLibraryEntity -> packingLibraryEntity.getPackingStatus()!=null&&packingLibraryEntity.getPackingStatus() == 2 &&packingLibraryEntity.getCreateTime()!=null && packingLibraryEntity.getCreateTime().after(date) && packingLibraryEntity.getCreateTime().before(date2))
// .collect(toList());
// //筛选退装
// List<PackingLibrary> packingLibraryEntities2 = packingLibraryDao.findAll().stream()
// .filter(packingLibraryEntity -> packingLibraryEntity.getPackingStatus()!=null&&packingLibraryEntity.getPackingStatus() == 3 && packingLibraryEntity.getExitTime()!=null&&packingLibraryEntity.getExitTime().after(date) && packingLibraryEntity.getExitTime().before(date2))
// .collect(toList());
// //添加列装数量
// if (packingLibraryEntities.size() > 0) {
// packingNum = packingNum + packingLibraryEntities.size();
// }
// //添加退装数量
// if (packingLibraryEntities2.size() > 0) {
// retiredNum = retiredNum + packingLibraryEntities2.size();
// }
// }
//
// //筛选出清退账单
// RepelManagementVo repelManagementVo=new RepelManagementVo();
// repelManagementVo.setUnitName(userUtils.getCurrentUserUnitName());
// repelManagementVo.setPage(0);
// repelManagementVo.setSize(2);
// repelManagementVo.setTime(deviceUseReportCreateVo.startTime.getTime());
// repelManagementVo.setEndTime(deviceUseReportCreateVo.endTime.getTime());
// PagingVo pagingVo = repelQueryService.clearedDeviceList(repelManagementVo);
// sendBackNum=pagingVo.getTotal();
//// //累加清退数量
//// if (sendBackBillDetailEntities.size() > 0) {
//// for (SendBackBillDetail s : sendBackBillDetailEntities) {
//// sendBackNum = sendBackNum + s.getSendedCount();
//// }
//// }
// //维修数量
// List<RepairDetail> repairDetails = repairDetailDao.findAll().stream()
// .filter(repairDetail -> repairDetail.getOwnUnit().equals(userUtils.getCurrentUserUnitName()) && repairDetail.getRepairStatus() != 3 && repairDetail.getCreateTime().after(date) && repairDetail.getCreateTime().before(date2))
// .collect(toList());
// //筛选出配接收维修退回的账单
// List<Integer> repairBackList = new ArrayList<>();
// repairBackList.addAll(Arrays.asList(5,7));
// List<RepairBackBill> repairBackBills = repairBackBillDao.findAll().stream()
// .filter(repairBackBill -> repairBackBill.getReceiveUnit().equals(userUtils.getCurrentUserUnitName()) && repairBackList.contains(repairBackBill.getBackStatus()) && repairBackBill.getCreateTime().after(date) && repairBackBill.getCreateTime().before(date2))
// .collect(toList());
// //将数量进行新增 累加维修数量
// if (repairBackBills.size() >0){
// for (RepairBackBill repairBackBill : repairBackBills) {
// inLibraryNum = inLibraryNum + repairBackBill.getReceiveCount();
// }
// }
//
// repairNum = repairDetails.size();
//
//
// //拼接组合字段
// deviceUseReportEntity.setReportDetail(num + "x" + inLibraryNum + "x" + repairNum + "x" + allotNum + "x" + sendBackNum + "x" + destoryNum + "x" + packingNum + "x" + retiredNum + "x");
// return deviceUseReportDao.save(deviceUseReportEntity);
// }
@Override
public DeviceUseReport createReport(DeviceUseReportCreateVo deviceUseReportCreateVo) {
DeviceUseReport deviceUseReportEntity = new DeviceUseReport();
......@@ -161,18 +328,26 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
stringBuffer.append(calendar2.get(Calendar.DAY_OF_MONTH)).append("日");
stringBuffer.append("使用情况报告");
deviceUseReportEntity.setTitle(stringBuffer.toString());
//获取所属当前单位的所有装备
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
deviceLibrarySelectVo.setSize(Integer.MAX_VALUE);
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryService.getPage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable()).getContent();
int num = deviceLibraryEntities.size();
int inLibraryNum = 0;
int repairNum;
int destoryNum = 0;
int allotNum = 0;
int sendBackNum = 0;
int packingNum = 0;
int retiredNum = 0;
int inLibraryNum = 0;//入库
int sendRepairNum = 0;//送修
int receiveRepairNum = 0;//维修退回
int destoryNum = 0;//销毁
int sendAllotNum = 0;//发起配发
int receiveAllotNum = 0;//接收配发
int sensAllotBackNum = 0;//发起退回
int receiveAllotBackNum = 0;//接收退回
int sendBackNum = 0;//清退
int packingNum = 0;//列装
int retiredNum = 0;//退装
int scrapStatisticsNum = 0;//报废
int decommissioningStatisticsNum = 0;//退役
//筛选出日期范围内所有入库账单
List<StorageBill> storageBillEntities = storageBillDao.findAll().stream()
.filter(storageBillEntity -> storageBillEntity.getStorageStatus() == 2 && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(storageBillEntity.getReceiveUseraId())) && storageBillEntity.getUpdateTime().after(date) && storageBillEntity.getUpdateTime().before(date2))
......@@ -184,31 +359,53 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
}
}
//配发状态list
List<Integer> allotStatusList = new ArrayList<>();
allotStatusList.add(2);
allotStatusList.add(3);
allotStatusList.add(5);
//筛选出接收配发装备的账单
List<Integer> allotStatusList = new ArrayList<>(Arrays.asList(2, 3, 5));
//筛选出接收配发装备的账单 接收配发
List<AllotBill> allotBillEntities = allotBillDao.findAll().stream()
.filter(allotBillEntity -> allotBillEntity.getAllotStatus() == 5 && userUtils.getCurrentUserUnitName().equals(allotBillEntity.getReceiveUnit()) && allotBillEntity.getReceiveTime().after(date) && allotBillEntity.getReceiveTime().before(date2))
.collect(toList());
//筛选出配发给其它单位的账单
//筛选出配发给其它单位的账单 发起配发
List<AllotBill> allotBillEntities2 = allotBillDao.findAll().stream()
.filter(allotBillEntity -> allotStatusList.contains(allotBillEntity.getAllotStatus()) && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(allotBillEntity.getSendUseraId())) && allotBillEntity.getSendTime().after(date) && allotBillEntity.getSendTime().before(date2))
.collect(toList());
//累加入库数量
//接收配发装备
if (allotBillEntities.size() > 0) {
for (AllotBill s : allotBillEntities) {
// inLibraryNum = inLibraryNum + s.getReceiveCount();
receiveAllotNum = receiveAllotNum + s.getAllotedCount();
}
}
//累加配发数量
if (allotBillEntities2.size() > 0) {
for (AllotBill s : allotBillEntities) {
allotNum = allotNum + s.getAllotedCount();
//发起配发
if (allotBillEntities2.size()>0){
for (AllotBill allotBill : allotBillEntities2) {
sendAllotNum = sendAllotNum + allotBill.getAllotCount();
}
}
//省级才能销毁,列装,退装
//退回状态list
List<Integer> allotStatusBackList = new ArrayList<>(Arrays.asList(0, 3));
//筛选出配接收退回的账单 接收退回
if (userUtils.getCurrentUnitLevel() != 1){
List<AllotBackBill> receiveAllotBackBills = allotBackBillDao.findAll().stream()
.filter(allotBackBill -> allotBackBill.getBackStatus() == 3 && userUtils.getCurrentUserUnitName().equals(allotBackBill.getReceiveUnit()) && allotBackBill.getReceiveTime().after(date) && allotBackBill.getReceiveTime().before(date2))
.collect(toList());
//发起退回
List<AllotBackBill> sendAllotBackBills = allotBackBillDao.findAll().stream()
.filter(allotBackBill -> allotStatusBackList.contains(allotBackBill.getBackStatus()) && userUtils.getCurrentUserUnitName().equals(allotBackBill.getReceiveUnit()) && allotBackBill.getReceiveTime().after(date) && allotBackBill.getReceiveTime().before(date2))
.collect(toList());
//接收退回
if (receiveAllotBackBills.size()>0){
for (AllotBackBill receiveAllotBackBill : receiveAllotBackBills) {
receiveAllotBackNum = receiveAllotBackNum + receiveAllotBackBill.getBackCount();
}
}
//接收退回
if (sendAllotBackBills.size()>0){
for (AllotBackBill sendAllotBackBill : sendAllotBackBills) {
sensAllotBackNum = sensAllotBackNum + sendAllotBackBill.getBackCount();
}
}
}
//省级才能销毁,列装,退装 退役 报废
if (userUtils.getCurrentUnitLevel() == 1) {
//筛选出在日期范围内的销毁单
// List<DeviceDestroyBill> deviceDestoryBillEntities = deviceDestroyBillDao.findAll().stream()
......@@ -221,6 +418,15 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
// destoryNum = destoryNum + list.size();
// }
// }
//报废
int scrapStatisticsCount = this.getScrapStatisticsCount(date, date2);
scrapStatisticsNum = scrapStatisticsCount;
//销毁
int destroyStatisticsCount = this.getDestroyStatisticsCount(date, date2);
destoryNum = destroyStatisticsCount;
//退役
int decommissioningStatisticsCount = this.getDecommissioningStatisticsCount(date, date2);
decommissioningStatisticsNum = decommissioningStatisticsCount;
//筛选列装
List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll().stream()
.filter(packingLibraryEntity -> packingLibraryEntity.getPackingStatus()!=null&&packingLibraryEntity.getPackingStatus() == 2 &&packingLibraryEntity.getCreateTime()!=null && packingLibraryEntity.getCreateTime().after(date) && packingLibraryEntity.getCreateTime().before(date2))
......@@ -241,7 +447,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
//筛选出清退账单
RepelManagementVo repelManagementVo=new RepelManagementVo();
repelManagementVo.setUnitId(userUtils.getCurrentUnitId());
repelManagementVo.setUnitName(userUtils.getCurrentUserUnitName());
repelManagementVo.setPage(0);
repelManagementVo.setSize(2);
repelManagementVo.setTime(deviceUseReportCreateVo.startTime.getTime());
......@@ -254,13 +460,35 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
// sendBackNum = sendBackNum + s.getSendedCount();
// }
// }
//维修数量
List<RepairDetail> repairDetails = repairDetailDao.findAll().stream()
.filter(repairDetail -> repairDetail.getOwnUnit().equals(userUtils.getCurrentUserUnitName()) && repairDetail.getRepairStatus() != 3 && repairDetail.getCreateTime().after(date) && repairDetail.getCreateTime().before(date2))
.collect(toList());
repairNum = repairDetails.size();
//筛选出配接收维修退回的账单
List<Integer> repairBackList = new ArrayList<>(Arrays.asList(5,2));
List<RepairBackBill> repairBackBills = repairBackBillDao.findAll().stream()
.filter(repairBackBill -> repairBackBill.getReceiveUnit().equals(userUtils.getCurrentUserUnitName()) && repairBackList.contains(repairBackBill.getBackStatus()) && repairBackBill.getCreateTime().after(date) && repairBackBill.getCreateTime().before(date2))
.collect(toList());
//发起维修数量
if(repairDetails.size()>0){
sendRepairNum = sendRepairNum + repairDetails.size();
}
//将数量进行新增 累加维修数量
if (repairBackBills.size() >0){
for (RepairBackBill repairBackBill : repairBackBills) {
receiveRepairNum = receiveRepairNum + repairBackBill.getReceiveCount();
}
}
//拼接组合字段
deviceUseReportEntity.setReportDetail(num + "x" + inLibraryNum + "x" + repairNum + "x" + allotNum + "x" + sendBackNum + "x" + destoryNum + "x" + packingNum + "x" + retiredNum + "x");
deviceUseReportEntity.setReportDetail(
num + "x" + inLibraryNum + "x" + sendRepairNum + "x"
+ receiveRepairNum + "x" + destoryNum
+ "x" + sendAllotNum + "x" + receiveAllotNum + "x" + sensAllotBackNum
+ "x"+ receiveAllotBackNum + "x"+ sendBackNum + "x"+ scrapStatisticsNum
+ "x"+ packingNum + "x"+ retiredNum + "x"+ decommissioningStatisticsNum + "x");
return deviceUseReportDao.save(deviceUseReportEntity);
}
......
......@@ -20,27 +20,32 @@ public class DeviceUseReportDetailVo {
@ApiModelProperty(value = "装备类型总数", example = "100")
private Integer deviceNumber;
@ApiModelProperty(value = "入库数量", example = "10")
private Integer inLibraryNum;
@ApiModelProperty(value = "维修数量", example = "10")
private Integer repairNum;
private Integer sendRepairNum;
@ApiModelProperty(value = "维修退回", example = "10")
private Integer receiveRepairNum;
@ApiModelProperty(value = "销毁数量", example = "10")
private Integer destoryNum;
@ApiModelProperty(value = "发起配发数量", example = "10")
private Integer sendAllotNum;
@ApiModelProperty(value = "接收配发数量", example = "10")
private Integer receiveAllotNum;
@ApiModelProperty(value = "发起退回数量", example = "10")
private Integer sensAllotBackNum;
@ApiModelProperty(value = "接收退回", example = "10")
private Integer receiveAllotBackNum;
@ApiModelProperty(value = "清退数量", example = "10")
private Integer sendBackNum;
@ApiModelProperty(value = "配发数量", example = "10")
private Integer allotNum;
@ApiModelProperty(value = "报废数量", example = "10")
private Integer scrapStatisticsNum;
@ApiModelProperty(value = "列装数量", example = "10")
private Integer packingNum;
@ApiModelProperty(value = "退装数量", example = "10")
private Integer retiredNum;
@ApiModelProperty(value = "退役", example = "10")
private Integer decommissioningStatisticsNum;
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论