|
|
|
@ -1,17 +1,29 @@
|
|
|
|
|
package com.glxp.api.admin.service.inventory.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.glxp.api.admin.constant.Constant;
|
|
|
|
|
import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDao;
|
|
|
|
|
import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.DeviceCollectOrderEntity;
|
|
|
|
|
import com.glxp.api.admin.req.inventory.FilterDeviceCollectOrderRequest;
|
|
|
|
|
import com.glxp.api.admin.res.inventory.DeviceCollectOrderResponse;
|
|
|
|
|
import com.glxp.api.admin.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.admin.service.inventory.DeviceCollectOrderService;
|
|
|
|
|
import com.glxp.api.admin.util.DateUtil;
|
|
|
|
|
import com.glxp.api.admin.util.GennerOrderUtils;
|
|
|
|
|
import com.glxp.api.admin.util.OrderNoTypeBean;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
@ -23,25 +35,62 @@ public class DeviceCollectOrderServiceImpl implements DeviceCollectOrderService
|
|
|
|
|
private DeviceCollectOrderDao deviceCollectOrderDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceCollectOrderDetailDao deviceCollectOrderDetailDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerService customerService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DeviceCollectOrderResponse> filterList(FilterDeviceCollectOrderRequest deviceCollectOrderRequest) {
|
|
|
|
|
return null;
|
|
|
|
|
if (null == deviceCollectOrderRequest) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
if (null != deviceCollectOrderRequest.getPage() && null != deviceCollectOrderRequest.getLimit()) {
|
|
|
|
|
PageHelper.offsetPage((deviceCollectOrderRequest.getPage() - 1) * deviceCollectOrderRequest.getLimit(), deviceCollectOrderRequest.getLimit());
|
|
|
|
|
}
|
|
|
|
|
return deviceCollectOrderDao.filterList(deviceCollectOrderRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse addDeviceCollectOrder(DeviceCollectOrderEntity deviceCollectOrderEntity) {
|
|
|
|
|
return null;
|
|
|
|
|
if (null == deviceCollectOrderEntity) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
//生成单号
|
|
|
|
|
String orderId = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.DEVICE_COLLECT_ORDER, "yyyyMMdd"));
|
|
|
|
|
deviceCollectOrderEntity.setOrderId(orderId);
|
|
|
|
|
deviceCollectOrderEntity.setCreateTime(DateUtil.getDateTime());
|
|
|
|
|
deviceCollectOrderEntity.setStatus(0);
|
|
|
|
|
deviceCollectOrderEntity.setUpdateTime(DateUtil.getDateTime());
|
|
|
|
|
String userName = customerService.getUserBean().getUserName();
|
|
|
|
|
deviceCollectOrderEntity.setCreateUser(userName);
|
|
|
|
|
deviceCollectOrderDao.insert(deviceCollectOrderEntity);
|
|
|
|
|
return ResultVOUtils.success(deviceCollectOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse updateDeviceCollectOrder(DeviceCollectOrderEntity deviceCollectOrderEntity) {
|
|
|
|
|
return null;
|
|
|
|
|
if (null == deviceCollectOrderEntity || null == deviceCollectOrderEntity.getId() || StrUtil.isBlank(deviceCollectOrderEntity.getOrderId())) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
deviceCollectOrderEntity.setUpdateTime(DateUtil.getDateTime());
|
|
|
|
|
deviceCollectOrderDao.updateByPrimaryKey(deviceCollectOrderEntity);
|
|
|
|
|
return ResultVOUtils.success("更新成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse submitAudit(Integer id) {
|
|
|
|
|
return null;
|
|
|
|
|
if (null == id) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
//查询设备领用记录详情,判断是否每个设备都可以分辨唯一,如果不能,则无法提交审核
|
|
|
|
|
String orderId = deviceCollectOrderDao.selectOrderIdById(id);
|
|
|
|
|
List<DeviceCollectOrderDetailEntity> detailList = deviceCollectOrderDetailDao.selectByOrderId(orderId);
|
|
|
|
|
if (CollUtil.isEmpty(detailList)) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("提交成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|