|
|
|
@ -4,14 +4,21 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil; |
|
|
|
|
|
|
|
import cn.xuyanwu.spring.file.storage.FileInfo; |
|
|
|
|
|
|
|
import cn.xuyanwu.spring.file.storage.MockMultipartFile; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
|
|
import jnpf.base.DictionaryDataApi; |
|
|
|
import jnpf.base.UserInfo; |
|
|
|
import jnpf.base.UserInfo; |
|
|
|
|
|
|
|
import jnpf.base.entity.DictionaryDataEntity; |
|
|
|
|
|
|
|
import jnpf.constant.FileTypeConstant; |
|
|
|
import jnpf.constant.PermissionConst; |
|
|
|
import jnpf.constant.PermissionConst; |
|
|
|
import jnpf.entity.*; |
|
|
|
import jnpf.entity.*; |
|
|
|
import jnpf.enump.ReceiveGoodsMainEnum; |
|
|
|
import jnpf.enump.ReceiveGoodsMainEnum; |
|
|
|
import jnpf.enump.SelectionOrderingMainEnum; |
|
|
|
|
|
|
|
import jnpf.exception.DataException; |
|
|
|
import jnpf.exception.DataException; |
|
|
|
|
|
|
|
import jnpf.file.FileApi; |
|
|
|
|
|
|
|
import jnpf.file.FileUploadApi; |
|
|
|
import jnpf.mapper.TReceiveGoodsMainMapper; |
|
|
|
import jnpf.mapper.TReceiveGoodsMainMapper; |
|
|
|
import jnpf.model.dto.ReceiveGoodsMainDto; |
|
|
|
import jnpf.model.dto.ReceiveGoodsMainDto; |
|
|
|
import jnpf.permission.entity.OrganizeEntity; |
|
|
|
import jnpf.permission.entity.OrganizeEntity; |
|
|
|
@ -23,16 +30,17 @@ import jnpf.service.TReceiveGoodsMainService; |
|
|
|
import jnpf.util.UserProvider; |
|
|
|
import jnpf.util.UserProvider; |
|
|
|
import jnpf.utils.SnowFlake; |
|
|
|
import jnpf.utils.SnowFlake; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import org.apache.tomcat.jni.Library; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
|
|
import java.nio.file.Files; |
|
|
|
|
|
|
|
import java.nio.file.Paths; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.IntSummaryStatistics; |
|
|
|
import java.util.*; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
@ -50,6 +58,9 @@ public class TReceiveGoodsMainServiceImpl extends ServiceImpl<TReceiveGoodsMainM |
|
|
|
private final OrganizeService organizeService; |
|
|
|
private final OrganizeService organizeService; |
|
|
|
private final TReceiveGoodsBooksService receiveGoodsBooksService; |
|
|
|
private final TReceiveGoodsBooksService receiveGoodsBooksService; |
|
|
|
private final TBookGoWhereService bookGoWhereService; |
|
|
|
private final TBookGoWhereService bookGoWhereService; |
|
|
|
|
|
|
|
private final FileUploadApi fileUploadApi; |
|
|
|
|
|
|
|
private final DictionaryDataApi dictionaryDataApi; |
|
|
|
|
|
|
|
private final FileApi fileApi; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IPage<TReceiveGoodsMain> selectPage(IPage<TReceiveGoodsMain> iPage, Map<String, Object> params) { |
|
|
|
public IPage<TReceiveGoodsMain> selectPage(IPage<TReceiveGoodsMain> iPage, Map<String, Object> params) { |
|
|
|
@ -91,7 +102,12 @@ public class TReceiveGoodsMainServiceImpl extends ServiceImpl<TReceiveGoodsMainM |
|
|
|
//校验是否为新增
|
|
|
|
//校验是否为新增
|
|
|
|
if (null == param.getId()) { |
|
|
|
if (null == param.getId()) { |
|
|
|
String idPrefix = "SH" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyyMMdd"); |
|
|
|
String idPrefix = "SH" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyyMMdd"); |
|
|
|
receiveGoodsMain.setId(String.format("%s%03d", idPrefix, redisSerialNumberUtils.generateSerialNumber(idPrefix))); |
|
|
|
receiveGoodsMain.setId(SnowFlake.nextId() + ""); |
|
|
|
|
|
|
|
String receiptNumber=param.getReceiptNumber(); |
|
|
|
|
|
|
|
if (StrUtil.isBlank(receiptNumber)){ |
|
|
|
|
|
|
|
receiptNumber=String.format("%s%03d", idPrefix, redisSerialNumberUtils.generateSerialNumber(idPrefix)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
receiveGoodsMain.setReceiptNumber(receiptNumber); |
|
|
|
receiveGoodsMain.setCreateId(user.getUserId()); |
|
|
|
receiveGoodsMain.setCreateId(user.getUserId()); |
|
|
|
receiveGoodsMain.setCreateTime(LocalDateTime.now()); |
|
|
|
receiveGoodsMain.setCreateTime(LocalDateTime.now()); |
|
|
|
receiveGoodsMain.setCreateName(user.getUserName()); |
|
|
|
receiveGoodsMain.setCreateName(user.getUserName()); |
|
|
|
@ -125,6 +141,29 @@ public class TReceiveGoodsMainServiceImpl extends ServiceImpl<TReceiveGoodsMainM |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.saveOrUpdate(receiveGoodsMain); |
|
|
|
this.saveOrUpdate(receiveGoodsMain); |
|
|
|
|
|
|
|
//版本馆直接生成二维码
|
|
|
|
|
|
|
|
if (mainStatusEnum== ReceiveGoodsMainEnum.MainStatusEnum.LISTING){ |
|
|
|
|
|
|
|
//生成二维码
|
|
|
|
|
|
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
DictionaryDataEntity data = dictionaryDataApi.getByTypeDataCode("SampleLibrary", "xtaddr").getData(); |
|
|
|
|
|
|
|
String systemUrl="http://61.169.37.106:9172/api/file/Image/preview/"; |
|
|
|
|
|
|
|
if (null!=data){ |
|
|
|
|
|
|
|
systemUrl=data.getDescription(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QrCodeUtil.generate(systemUrl, 1000, 1000,"", byteArrayOutputStream); |
|
|
|
|
|
|
|
MockMultipartFile mockMultipartFile = new MockMultipartFile("上架.png", "上架.png", "text/plain", byteArrayOutputStream.toByteArray()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileInfo preview = fileUploadApi.uploadFile(mockMultipartFile, fileApi.getPath(FileTypeConstant.BIVISUALPATH), "preview", "上架.png"); |
|
|
|
|
|
|
|
this.lambdaUpdate() |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getListingQrCode, preview.getFilename()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getMainStatus, mainStatusEnum.getCode()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getMainStatusName, mainStatusEnum.getDescribe()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateId, UserProvider.getLoginUserId()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateTime, LocalDateTime.now()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateName, UserProvider.getUser().getUserName()) |
|
|
|
|
|
|
|
.eq(TReceiveGoodsMain::getId, param.getId()) |
|
|
|
|
|
|
|
.update(); |
|
|
|
|
|
|
|
} |
|
|
|
//todo 保存收货书籍信息
|
|
|
|
//todo 保存收货书籍信息
|
|
|
|
saveReceivingBookInformation(receiveGoodsMain, param); |
|
|
|
saveReceivingBookInformation(receiveGoodsMain, param); |
|
|
|
return receiveGoodsMain.getId(); |
|
|
|
return receiveGoodsMain.getId(); |
|
|
|
@ -151,11 +190,15 @@ public class TReceiveGoodsMainServiceImpl extends ServiceImpl<TReceiveGoodsMainM |
|
|
|
tReceiveGoodsBooks.setId(SnowFlake.nextId()); |
|
|
|
tReceiveGoodsBooks.setId(SnowFlake.nextId()); |
|
|
|
tReceiveGoodsBooks.setRelationId(receiveGoodsMain.getId()); |
|
|
|
tReceiveGoodsBooks.setRelationId(receiveGoodsMain.getId()); |
|
|
|
//查询该单位往某部门需要送出图书的数量
|
|
|
|
//查询该单位往某部门需要送出图书的数量
|
|
|
|
//todo 非样书室时根据所属类型及部门id去查询应送数量
|
|
|
|
|
|
|
|
int sum = bookGoWhereService.lambdaQuery() |
|
|
|
int sum = bookGoWhereService.lambdaQuery() |
|
|
|
.eq(TBookGoWhere::getBookNumber, bunchingInfo.getBookNumber()) |
|
|
|
.eq(TBookGoWhere::getBookNumber, bunchingInfo.getBookNumber()) |
|
|
|
// .eq(TBookGoWhere::getTargetName, bunchingInfo.getBookName())
|
|
|
|
// .eq(TBookGoWhere::getTargetName, bunchingInfo.getBookName())
|
|
|
|
.eq(TBookGoWhere::getCreateCorpId, receiveGoodsMain.getCreateCorpId()) |
|
|
|
.eq(TBookGoWhere::getCreateCorpId, receiveGoodsMain.getCreateCorpId()) |
|
|
|
|
|
|
|
//todo 非样书室时根据所属类型及部门id去查询应送数量
|
|
|
|
|
|
|
|
//版本馆根据类型匹配
|
|
|
|
|
|
|
|
.eq(StrUtil.equals(param.getOrderType(), "2"), TBookGoWhere::getOrderType, param.getOrderType()) |
|
|
|
|
|
|
|
//业务部根据部门id匹配
|
|
|
|
|
|
|
|
.eq(StrUtil.equals(param.getOrderType(), "1"), TBookGoWhere::getCreateDeptId, receiveGoodsMain.getCreateDeptId()) |
|
|
|
.eq(TBookGoWhere::getWarehouseEntryFlag, "0") |
|
|
|
.eq(TBookGoWhere::getWarehouseEntryFlag, "0") |
|
|
|
.eq(TBookGoWhere::getType, "0") |
|
|
|
.eq(TBookGoWhere::getType, "0") |
|
|
|
.eq(TBookGoWhere::getDelFlag, "0") |
|
|
|
.eq(TBookGoWhere::getDelFlag, "0") |
|
|
|
@ -243,4 +286,202 @@ public class TReceiveGoodsMainServiceImpl extends ServiceImpl<TReceiveGoodsMainM |
|
|
|
.eq(TReceiveGoodsBooks::getRelationId, receiveGoodsMain.getId()) |
|
|
|
.eq(TReceiveGoodsBooks::getRelationId, receiveGoodsMain.getId()) |
|
|
|
.update(); |
|
|
|
.update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public IPage<ReceiveGoodsMainDto.TReceiveGoodsMainEntity> getReceiveGoodsList(ReceiveGoodsMainDto.GetReceiveGoodsListParam param) { |
|
|
|
|
|
|
|
ReceiveGoodsMainEnum.OrderTypeEnum orderTypeEnum = ReceiveGoodsMainEnum.OrderTypeEnum.getEnumByCode(param.getOrderType()); |
|
|
|
|
|
|
|
if (null == orderTypeEnum) { |
|
|
|
|
|
|
|
throw new DataException("请选择签收类型"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//样书室根据userId查询
|
|
|
|
|
|
|
|
if (orderTypeEnum == ReceiveGoodsMainEnum.OrderTypeEnum.SAMPLE_BOOKSTORE) { |
|
|
|
|
|
|
|
param.setUserId(UserProvider.getUser().getUserId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
param.setCorpId(UserProvider.getUser().getOrganizeId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
LocalDateTimeUtil.parse(param.getStartTime(), "yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
LocalDateTimeUtil.parse(param.getEndTime(), "yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
throw new DataException("时间格式错误,应为yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.getBaseMapper().getReceiveGoodsList(new Page<>(param.getCurrent(), param.getSize()), param); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public ReceiveGoodsMainDto.TReceiveGoodsMainEntity getInfoById(String id) { |
|
|
|
|
|
|
|
return this.baseMapper.getInfoById(id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<ReceiveGoodsMainDto.TBookGoWhereEntity> getStackingInformation(Long id, String orderType) { |
|
|
|
|
|
|
|
TReceiveGoodsBooks receiveGoodsBooks = receiveGoodsBooksService.getById(id); |
|
|
|
|
|
|
|
if (null == receiveGoodsBooks) { |
|
|
|
|
|
|
|
throw new DataException("该选书不存在"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//校验该选书是否进行过保存分堆信息
|
|
|
|
|
|
|
|
boolean exists = bookGoWhereService.lambdaQuery() |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getDelFlag, "0") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getType, "1") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getRelationId, receiveGoodsBooks.getId()) |
|
|
|
|
|
|
|
.exists(); |
|
|
|
|
|
|
|
if (exists) { |
|
|
|
|
|
|
|
//查询已有数据
|
|
|
|
|
|
|
|
return bookGoWhereService.getStackingInformationByRelationId(receiveGoodsBooks.getId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//查询初始化去向数据
|
|
|
|
|
|
|
|
return bookGoWhereService.getStackingInformation(receiveGoodsBooks.getBookNumber(), UserProvider.getUser().getOrganizeId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//todo 添加已发数
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public IPage<ReceiveGoodsMainDto.TReceiveGoodsBooksEntity> getBookListById(ReceiveGoodsMainDto.GetBookListByIdParam param) { |
|
|
|
|
|
|
|
return receiveGoodsBooksService.getBookListByRelationId(param); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
|
|
|
public void saveStackingInformation(ReceiveGoodsMainDto.SaveStackingInformationParam param) { |
|
|
|
|
|
|
|
ReceiveGoodsMainEnum.OrderTypeEnum orderTypeEnum = ReceiveGoodsMainEnum.OrderTypeEnum.getEnumByCode(param.getOrderType()); |
|
|
|
|
|
|
|
if (null == orderTypeEnum) { |
|
|
|
|
|
|
|
throw new DataException("请选择签收类型"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(param.getBookGoWhereList())) { |
|
|
|
|
|
|
|
throw new DataException("请设置图书分堆信息"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
TReceiveGoodsBooks receiveGoodsBooks = receiveGoodsBooksService.getById(param.getId()); |
|
|
|
|
|
|
|
if (null == receiveGoodsBooks) { |
|
|
|
|
|
|
|
throw new DataException("该图书信息不存在"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (TBookGoWhere bookGoWhere : param.getBookGoWhereList()) { |
|
|
|
|
|
|
|
bookGoWhere.setId(SnowFlake.nextId()); |
|
|
|
|
|
|
|
bookGoWhere.setCreateTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
bookGoWhere.setCreateBy(UserProvider.getUser().getUserId()); |
|
|
|
|
|
|
|
bookGoWhere.setCreateName(UserProvider.getUser().getUserName()); |
|
|
|
|
|
|
|
bookGoWhere.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
bookGoWhere.setUpdateBy(UserProvider.getUser().getUserId()); |
|
|
|
|
|
|
|
bookGoWhere.setUpdateName(UserProvider.getUser().getUserName()); |
|
|
|
|
|
|
|
bookGoWhere.setOrderType(orderTypeEnum.getCode()); |
|
|
|
|
|
|
|
bookGoWhere.setWarehouseEntryFlag("1"); |
|
|
|
|
|
|
|
bookGoWhere.setType("1"); |
|
|
|
|
|
|
|
bookGoWhere.setRelationId(receiveGoodsBooks.getId() + ""); |
|
|
|
|
|
|
|
Optional<OrganizeEntity> deptOptional = organizeService.lambdaQuery() |
|
|
|
|
|
|
|
.eq(OrganizeEntity::getId, UserProvider.getUser().getOrganizeId()) |
|
|
|
|
|
|
|
.eq(OrganizeEntity::getEnabledMark, "1").list().stream().findFirst(); |
|
|
|
|
|
|
|
if (deptOptional.isPresent()) { |
|
|
|
|
|
|
|
OrganizeEntity dept = deptOptional.get(); |
|
|
|
|
|
|
|
OrganizeEntity corp = getCorp(dept); |
|
|
|
|
|
|
|
bookGoWhere.setCreateDeptName(dept.getFullName()); |
|
|
|
|
|
|
|
bookGoWhere.setCreateCorpName(corp.getFullName()); |
|
|
|
|
|
|
|
bookGoWhere.setCreateDeptId(dept.getId()); |
|
|
|
|
|
|
|
bookGoWhere.setCreateCorpId(corp.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bookGoWhereService.save(bookGoWhere); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
|
|
|
public void saveStackingInformationByReceiveId(ReceiveGoodsMainDto.SaveStackingInformationByReceiveIdParam param) { |
|
|
|
|
|
|
|
if (StrUtil.isBlank(param.getSaveType())) { |
|
|
|
|
|
|
|
throw new DataException("请选择保存类型"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ReceiveGoodsMainEnum.OrderTypeEnum orderTypeEnum = ReceiveGoodsMainEnum.OrderTypeEnum.getEnumByCode(param.getOrderType()); |
|
|
|
|
|
|
|
if (null == orderTypeEnum) { |
|
|
|
|
|
|
|
throw new DataException("请选择签收类型"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isBlank(param.getId())) { |
|
|
|
|
|
|
|
throw new DataException("请选择收货单"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
TReceiveGoodsMain tReceiveGoodsMain = this.getById(param.getId()); |
|
|
|
|
|
|
|
if (null == tReceiveGoodsMain) { |
|
|
|
|
|
|
|
throw new DataException("该收货单不存在"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//保存只是走个过场
|
|
|
|
|
|
|
|
if (StrUtil.equals(param.getSaveType(), "1")) { |
|
|
|
|
|
|
|
this.lambdaUpdate() |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateId, UserProvider.getLoginUserId()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateTime, LocalDateTime.now()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateName, UserProvider.getUser().getUserName()) |
|
|
|
|
|
|
|
.eq(TReceiveGoodsMain::getId, param.getId()) |
|
|
|
|
|
|
|
.update(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//以下逻辑全是确定
|
|
|
|
|
|
|
|
ReceiveGoodsMainEnum.MainStatusEnum mainStatusEnum = ReceiveGoodsMainEnum.MainStatusEnum.LISTING; |
|
|
|
|
|
|
|
//查询图书编号列表
|
|
|
|
|
|
|
|
Set<String> bookNumberList = receiveGoodsBooksService.lambdaQuery() |
|
|
|
|
|
|
|
.eq(TReceiveGoodsBooks::getRelationId, tReceiveGoodsMain.getId()) |
|
|
|
|
|
|
|
.eq(TReceiveGoodsBooks::getDelFlag, "0") |
|
|
|
|
|
|
|
.list() |
|
|
|
|
|
|
|
.stream().map(TReceiveGoodsBooks::getBookNumber).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
//生成版本馆/业务部收货单
|
|
|
|
|
|
|
|
ReceiveGoodsMainDto.NewReceiptParam newReceiptParam=new ReceiveGoodsMainDto.NewReceiptParam(); |
|
|
|
|
|
|
|
newReceiptParam.setReceiptNumber(tReceiveGoodsMain.getReceiptNumber()); |
|
|
|
|
|
|
|
newReceiptParam.setOrderType(param.getOrderType()); |
|
|
|
|
|
|
|
newReceiptParam.setPackageQuantity(tReceiveGoodsMain.getPackageQuantity()); |
|
|
|
|
|
|
|
newReceiptParam.setDeliveryParty(tReceiveGoodsMain.getDeliveryParty()); |
|
|
|
|
|
|
|
newReceiptParam.setReceiveTime(tReceiveGoodsMain.getReceiveTime()); |
|
|
|
|
|
|
|
List<ReceiveGoodsMainDto.BunchingInfo> bunchingInfoList=new ArrayList<>(); |
|
|
|
|
|
|
|
//查询图书编号
|
|
|
|
|
|
|
|
Set<String> queryBookInfoNumberList = bookGoWhereService.lambdaQuery() |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getType, "0") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getDelFlag, "0") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getWarehouseEntryFlag, "0") |
|
|
|
|
|
|
|
.in(TBookGoWhere::getBookNumber, bookNumberList) |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getCreateCorpId, UserProvider.getUser().getOrganizeId()) |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getOrderType, orderTypeEnum.getCode()) |
|
|
|
|
|
|
|
.list().stream().map(TBookGoWhere::getBookNumber).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
List<TLibrary> libraryList = libraryService.lambdaQuery() |
|
|
|
|
|
|
|
.in(TLibrary::getBookNumber, queryBookInfoNumberList) |
|
|
|
|
|
|
|
.list(); |
|
|
|
|
|
|
|
//创建收货单
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(libraryList)){ |
|
|
|
|
|
|
|
for (TLibrary tLibrary : libraryList) { |
|
|
|
|
|
|
|
bunchingInfoList.add(BeanUtil.copyProperties(tLibrary,ReceiveGoodsMainDto.BunchingInfo.class)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
newReceiptParam.setBunchingInfoList(bunchingInfoList); |
|
|
|
|
|
|
|
this.newReceipt(newReceiptParam); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(bookNumberList)) { |
|
|
|
|
|
|
|
//修改图书去向 即之后样书室新建后进行分堆不会再查到老数据
|
|
|
|
|
|
|
|
bookGoWhereService.lambdaUpdate() |
|
|
|
|
|
|
|
.set(TBookGoWhere::getType, "1") |
|
|
|
|
|
|
|
.set(TBookGoWhere::getWarehouseEntryFlag, "1") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getType, "0") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getDelFlag, "0") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getWarehouseEntryFlag,"0") |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getCreateCorpId, UserProvider.getUser().getOrganizeId()) |
|
|
|
|
|
|
|
.in(TBookGoWhere::getBookNumber, bookNumberList) |
|
|
|
|
|
|
|
.eq(TBookGoWhere::getOrderType,orderTypeEnum.getCode()) |
|
|
|
|
|
|
|
.update(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//生成二维码
|
|
|
|
|
|
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
DictionaryDataEntity data = dictionaryDataApi.getByTypeDataCode("SampleLibrary", "xtaddr").getData(); |
|
|
|
|
|
|
|
String systemUrl="http://61.169.37.106:9172/api/file/Image/preview/"; |
|
|
|
|
|
|
|
if (null!=data){ |
|
|
|
|
|
|
|
systemUrl=data.getDescription(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QrCodeUtil.generate(systemUrl, 1000, 1000,"", byteArrayOutputStream); |
|
|
|
|
|
|
|
MockMultipartFile mockMultipartFile = new MockMultipartFile("上架.png", "上架.png", "text/plain", byteArrayOutputStream.toByteArray()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileInfo preview = fileUploadApi.uploadFile(mockMultipartFile, fileApi.getPath(FileTypeConstant.BIVISUALPATH), "preview", "上架.png"); |
|
|
|
|
|
|
|
//修改状态为上架中
|
|
|
|
|
|
|
|
this.lambdaUpdate() |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getListingQrCode, preview.getFilename()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getMainStatus, mainStatusEnum.getCode()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getMainStatusName, mainStatusEnum.getDescribe()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateId, UserProvider.getLoginUserId()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateTime, LocalDateTime.now()) |
|
|
|
|
|
|
|
.set(TReceiveGoodsMain::getUpdateName, UserProvider.getUser().getUserName()) |
|
|
|
|
|
|
|
.eq(TReceiveGoodsMain::getId, param.getId()) |
|
|
|
|
|
|
|
.update(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|