|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
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.DeviceDeliveryImportDto;
|
|
import com.qmth.sop.business.bean.dto.DeviceInfoDto;
|
|
import com.qmth.sop.business.bean.dto.DeviceInfoDto;
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
@@ -14,15 +15,13 @@ import com.qmth.sop.business.entity.SysSupplier;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
import com.qmth.sop.business.mapper.TBDeviceDeliveryMapper;
|
|
import com.qmth.sop.business.mapper.TBDeviceDeliveryMapper;
|
|
-import com.qmth.sop.business.service.SysDeviceModelService;
|
|
|
|
-import com.qmth.sop.business.service.SysDeviceService;
|
|
|
|
-import com.qmth.sop.business.service.SysSupplierService;
|
|
|
|
-import com.qmth.sop.business.service.TBDeviceDeliveryService;
|
|
|
|
|
|
+import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.business.util.excel.BasicExcelListener;
|
|
import com.qmth.sop.business.util.excel.BasicExcelListener;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.time.DateFormatUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
@@ -51,6 +50,10 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
private SysDeviceModelService sysDeviceModelService;
|
|
private SysDeviceModelService sysDeviceModelService;
|
|
@Resource
|
|
@Resource
|
|
private SysSupplierService sysSupplierService;
|
|
private SysSupplierService sysSupplierService;
|
|
|
|
+ @Resource
|
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
+ @Resource
|
|
|
|
+ private BasicAttachmentService basicAttachmentService;
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
@@ -170,7 +173,6 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
String consignee = deviceDeliveryParam.getConsignee();
|
|
String consignee = deviceDeliveryParam.getConsignee();
|
|
String consigneePhone = deviceDeliveryParam.getConsigneePhone();
|
|
String consigneePhone = deviceDeliveryParam.getConsigneePhone();
|
|
String expressNo = deviceDeliveryParam.getExpressNo();
|
|
String expressNo = deviceDeliveryParam.getExpressNo();
|
|
-
|
|
|
|
this.update(new UpdateWrapper<TBDeviceDelivery>().lambda()
|
|
this.update(new UpdateWrapper<TBDeviceDelivery>().lambda()
|
|
.eq(TBDeviceDelivery::getId, id)
|
|
.eq(TBDeviceDelivery::getId, id)
|
|
.set(TBDeviceDelivery::getMailingAddress, mailingAddress)
|
|
.set(TBDeviceDelivery::getMailingAddress, mailingAddress)
|
|
@@ -179,26 +181,82 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
.set(TBDeviceDelivery::getExpressNo, expressNo));
|
|
.set(TBDeviceDelivery::getExpressNo, expressNo));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public IPage<TBDeviceDeliveryResult> page(IPage<Map> iPage, 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;
|
|
|
|
+ }
|
|
|
|
+ IPage<TBDeviceDeliveryResult> page = this.baseMapper.page(iPage, serviceId, usageType, crmNo, status, deliverUserId, deliveryStartTime, deliveryEndTime, serialNo, supplierId, receiveStartTime, receiveEndTime);
|
|
|
|
+ for (TBDeviceDeliveryResult e : page.getRecords()) {
|
|
|
|
+ this.fillResultInfo(e);
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 设备发货管理列表
|
|
|
|
|
|
+ * 补充结果信息
|
|
*
|
|
*
|
|
- * @param iPage
|
|
|
|
- * @param serviceId
|
|
|
|
- * @param usageType
|
|
|
|
- * @param crmNo
|
|
|
|
- * @param status
|
|
|
|
- * @param deliverUserId
|
|
|
|
- * @param crmStartTime
|
|
|
|
- * @param crmEndTime
|
|
|
|
- * @param serialNo
|
|
|
|
- * @param supplierId
|
|
|
|
- * @param receiveStartTime
|
|
|
|
- * @param receiveEndTime
|
|
|
|
- * @return
|
|
|
|
|
|
+ * @param e 发货结果对象
|
|
|
|
+ * @throws Exception 异常
|
|
*/
|
|
*/
|
|
- @Override
|
|
|
|
- public IPage<TBDeviceDeliveryResult> list(IPage<Map> iPage, Long serviceId, DeviceUsageTypeEnum usageType, String crmNo, DeviceDeliveryStatusEnum status, Long deliverUserId, Long crmStartTime, Long crmEndTime, String serialNo, Long supplierId, Long receiveStartTime, Long receiveEndTime) {
|
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
- return this.baseMapper.list(iPage, serviceId, Objects.nonNull(usageType) ? usageType.name() : null, crmNo, Objects.nonNull(status) ? status.name() : null, deliverUserId, crmStartTime, crmEndTime, serialNo, supplierId, receiveStartTime, receiveEndTime, sysUser.getId());
|
|
|
|
|
|
+ private void fillResultInfo(TBDeviceDeliveryResult e) throws Exception {
|
|
|
|
+ DeviceUsageTypeEnum dbUsageType = e.getUsageType();
|
|
|
|
+ e.setUsageTypeStr(Objects.nonNull(dbUsageType) ? dbUsageType.getTitle() : "");
|
|
|
|
+
|
|
|
|
+ InOutTypeEnum dbDeliveryType = e.getDeliveryType();
|
|
|
|
+ e.setDeliveryTypeStr(Objects.nonNull(dbDeliveryType) ? dbDeliveryType.getTitle() : "");
|
|
|
|
+
|
|
|
|
+ DeviceDeliveryStatusEnum dbStatus = e.getStatus();
|
|
|
|
+ e.setStatusStr(Objects.nonNull(dbStatus) ? dbStatus.getTitle() : "");
|
|
|
|
+
|
|
|
|
+ Long dbDeliveryTime = e.getDeliverTime();
|
|
|
|
+ e.setDeliverTimeStr(dbDeliveryTime != null && dbDeliveryTime > 0 ? DateFormatUtils.format(dbDeliveryTime, SystemConstant.DEFAULT_DATE_PATTERN) : "--");
|
|
|
|
+
|
|
|
|
+ Long dbReceiveTime = e.getReceiveTime();
|
|
|
|
+ e.setReceiveTimeStr(dbReceiveTime != null && dbReceiveTime > 0 ? DateFormatUtils.format(dbReceiveTime, SystemConstant.DEFAULT_DATE_PATTERN) : "--");
|
|
|
|
+
|
|
|
|
+ String path = e.getExpressPhotoPath();
|
|
|
|
+ if (path != null && path.length() > 0) {
|
|
|
|
+ e.setExpressPhotoPath(basicAttachmentService.filePreviewPath(path));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|