|
@@ -8,17 +8,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.sop.business.bean.dto.DataPermissionDto;
|
|
|
import com.qmth.sop.business.bean.dto.DeviceDeliveryImportDto;
|
|
|
import com.qmth.sop.business.bean.dto.DeviceInfoDto;
|
|
|
+import com.qmth.sop.business.bean.dto.UserArchivesImportDto;
|
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
|
+import com.qmth.sop.business.bean.query.UserArchivesQuery;
|
|
|
import com.qmth.sop.business.bean.result.TBDeviceDeliveryResult;
|
|
|
-import com.qmth.sop.business.entity.SysDevice;
|
|
|
-import com.qmth.sop.business.entity.SysSupplier;
|
|
|
-import com.qmth.sop.business.entity.SysUser;
|
|
|
-import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
|
+import com.qmth.sop.business.entity.*;
|
|
|
import com.qmth.sop.business.mapper.TBDeviceDeliveryMapper;
|
|
|
import com.qmth.sop.business.service.*;
|
|
|
import com.qmth.sop.business.util.excel.BasicExcelListener;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.*;
|
|
|
+import com.qmth.sop.common.util.FileUtil;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
@@ -28,6 +28,8 @@ import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.*;
|
|
@@ -206,6 +208,49 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<TBDeviceDeliveryResult> list(Long serviceId, DeviceUsageTypeEnum usageType, String crmNo, DeviceDeliveryStatusEnum status, Long deliverUserId, Long deliveryStartTime, Long deliveryEndTime, String serialNo, Long supplierId, Long receiveStartTime, Long receiveEndTime) throws Exception {
|
|
|
+ if (crmNo != null && crmNo.length() > 0) {
|
|
|
+ crmNo = SystemConstant.translateSpecificSign(crmNo);
|
|
|
+ }
|
|
|
+ if (serialNo != null && serialNo.length() > 0) {
|
|
|
+ serialNo = SystemConstant.translateSpecificSign(serialNo);
|
|
|
+ }
|
|
|
+ SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
|
+ if (dpr.getHasDeviceDelivery()) {
|
|
|
+ // 是设备管理员
|
|
|
+ Long userSupplierId = requestUser.getSupplierId();
|
|
|
+ if (userSupplierId == null || userSupplierId == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("请先在用户管理中绑定设备发货员对应的供应商");
|
|
|
+ }
|
|
|
+ supplierId = userSupplierId;
|
|
|
+ }
|
|
|
+ List<TBDeviceDeliveryResult> result = this.baseMapper.list(serviceId, usageType, crmNo, status, deliverUserId, deliveryStartTime, deliveryEndTime, serialNo, supplierId, receiveStartTime, receiveEndTime);
|
|
|
+ for (TBDeviceDeliveryResult e : result) {
|
|
|
+ this.fillResultInfo(e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void dataExport(Long serviceId, DeviceUsageTypeEnum usageType, String crmNo, DeviceDeliveryStatusEnum status, Long deliverUserId, Long deliveryStartTime, Long deliveryEndTime, String serialNo, Long supplierId, Long receiveStartTime, Long receiveEndTime) throws Exception {
|
|
|
+ List<TBDeviceDeliveryResult> datasource = this.list(serviceId, usageType, crmNo, status, deliverUserId, deliveryStartTime, deliveryEndTime, serialNo, supplierId, receiveStartTime, receiveEndTime);
|
|
|
+
|
|
|
+ File fileTemp = null;
|
|
|
+ try {
|
|
|
+ fileTemp = SystemConstant.getFileTempVar(SystemConstant.XLSX_PREFIX);
|
|
|
+ EasyExcel.write(fileTemp, TBDeviceDeliveryResult.class).sheet("设备发货管理列表").doWrite(datasource);
|
|
|
+ HttpServletResponse response = ServletUtil.getResponse();
|
|
|
+ FileUtil.outputFile(response, fileTemp, "设备发货管理列表导出");
|
|
|
+ } finally {
|
|
|
+ if (Objects.nonNull(fileTemp)) {
|
|
|
+ fileTemp.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 补充结果信息
|
|
|
*
|