|
|
@@ -136,7 +136,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
.eq(TradingBoxFees::getPid, details.getId());
|
|
|
int count = tradingBoxFeesMapper.selectCount(tradingBoxFeesLambdaQueryWrapper);
|
|
|
tradingBoxItem.setCount(count);
|
|
|
- //获取明细图片
|
|
|
+ /*//获取明细图片
|
|
|
LambdaQueryWrapper<TradingBoxFiles> tradingBoxFilesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
tradingBoxFilesLambdaQueryWrapper.eq(TradingBoxFiles::getIsDeleted, 0)
|
|
|
.eq(TradingBoxFiles::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -147,7 +147,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxFiles.setLabel(tradingBoxFiles.getFileName());
|
|
|
tradingBoxFiles.setValue(tradingBoxFiles.getUrl());
|
|
|
}
|
|
|
- tradingBoxItem.setTradingBoxFilesList(tradingBoxFilesList);
|
|
|
+ tradingBoxItem.setTradingBoxFilesList(tradingBoxFilesList);*/
|
|
|
}
|
|
|
details.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
|
|
|
@@ -265,81 +265,84 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
tradingBoxItem.setTradingBoxFilesList(tradingBoxItemFilesList);
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
- //更新箱档案信息
|
|
|
- Archives archivesR = archivesMapper.selectOne(new LambdaQueryWrapper<Archives>().eq(Archives::getIsDeleted, 0).eq(Archives::getTenantId, AuthUtil.getTenantId()).eq(Archives::getCode, tradingBoxItem.getCode()));
|
|
|
- Archives archives = new Archives();
|
|
|
- if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
- BeanUtil.copy(archivesR, archives);
|
|
|
- }
|
|
|
- archives.setCode(tradingBoxItem.getCode());
|
|
|
- archives.setName(tradingBoxItem.getBoxType());
|
|
|
- archives.setVolume(tradingBoxItem.getVolume());
|
|
|
- archives.setGorssWeight(tradingBoxItem.getGrossWeight());
|
|
|
- archives.setStatus(tradingBoxItem.getStatus());
|
|
|
- archives.setTypeId(tradingBoxItem.getBoxTypeId());
|
|
|
- archives.setAddressId(tradingBoxItem.getAddressId());
|
|
|
- archives.setAddress(tradingBoxItem.getAddress());
|
|
|
- archives.setNewDate(tradingBoxItem.getNewDate());
|
|
|
- archives.setLeasingCompanyId(tradingBox.getPurchaseCompanyId());
|
|
|
- archives.setLeasingCompany(tradingBox.getPurchaseCompanyName());
|
|
|
- archives.setBoxSource(tradingBoxItem.getBoxSource());
|
|
|
- archives.setBoxStatus(tradingBoxItem.getBoxStatus());
|
|
|
- archives.setEmptyWeight(tradingBoxItem.getEmptyWeight());
|
|
|
- archives.setTare(tradingBoxItem.getTare());
|
|
|
- archives.setLoadingWeight(tradingBoxItem.getLoadingWeight());
|
|
|
- archives.setBoxMakingCompany(tradingBoxItem.getBoxMakingCompany());
|
|
|
- archives.setBoxMakingCompanyId(tradingBoxItem.getBoxMakingCompanyId());
|
|
|
- archives.setBoxMakingDate(tradingBoxItem.getBoxMakingDate());
|
|
|
- archives.setLeaseCommencementDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
- archives.setBoxAge(tradingBoxItem.getBoxAge());
|
|
|
- archives.setPurchaseDate(tradingBox.getPurchaseDate());
|
|
|
- archives.setContractNo(tradingBox.getContractNo());
|
|
|
- if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
- archives.setUpdateTime(new Date());
|
|
|
- archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
- archivesMapper.updateById(archives);
|
|
|
+ String updateChar = tradingBoxItem.getCode() + tradingBoxItem.getBoxType() + tradingBoxItem.getAddress() + tradingBoxItem.getNewDate() + tradingBoxItem.getStatus();
|
|
|
+ if (ObjectUtils.isNull(tradingBoxItem.getUpdateChar()) || !updateChar.equals(tradingBoxItem.getUpdateChar())) {
|
|
|
+ if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
+ //更新箱档案信息
|
|
|
+ Archives archivesR = archivesMapper.selectOne(new LambdaQueryWrapper<Archives>().eq(Archives::getIsDeleted, 0).eq(Archives::getTenantId, AuthUtil.getTenantId()).eq(Archives::getCode, tradingBoxItem.getCode()));
|
|
|
+ Archives archives = new Archives();
|
|
|
+ if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
+ BeanUtil.copy(archivesR, archives);
|
|
|
+ }
|
|
|
+ archives.setCode(tradingBoxItem.getCode());
|
|
|
+ archives.setName(tradingBoxItem.getBoxType());
|
|
|
+ archives.setVolume(tradingBoxItem.getVolume());
|
|
|
+ archives.setGorssWeight(tradingBoxItem.getGrossWeight());
|
|
|
+ archives.setStatus(tradingBoxItem.getStatus());
|
|
|
+ archives.setTypeId(tradingBoxItem.getBoxTypeId());
|
|
|
+ archives.setAddressId(tradingBoxItem.getAddressId());
|
|
|
+ archives.setAddress(tradingBoxItem.getAddress());
|
|
|
+ archives.setNewDate(tradingBoxItem.getNewDate());
|
|
|
+ archives.setLeasingCompanyId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archives.setLeasingCompany(tradingBox.getPurchaseCompanyName());
|
|
|
+ archives.setBoxSource(tradingBoxItem.getBoxSource());
|
|
|
+ archives.setBoxStatus(tradingBoxItem.getBoxStatus());
|
|
|
+ archives.setEmptyWeight(tradingBoxItem.getEmptyWeight());
|
|
|
+ archives.setTare(tradingBoxItem.getTare());
|
|
|
+ archives.setLoadingWeight(tradingBoxItem.getLoadingWeight());
|
|
|
+ archives.setBoxMakingCompany(tradingBoxItem.getBoxMakingCompany());
|
|
|
+ archives.setBoxMakingCompanyId(tradingBoxItem.getBoxMakingCompanyId());
|
|
|
+ archives.setBoxMakingDate(tradingBoxItem.getBoxMakingDate());
|
|
|
+ archives.setLeaseCommencementDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
+ archives.setBoxAge(tradingBoxItem.getBoxAge());
|
|
|
+ archives.setPurchaseDate(tradingBox.getPurchaseDate());
|
|
|
+ archives.setContractNo(tradingBox.getContractNo());
|
|
|
+ if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
+ archives.setUpdateTime(new Date());
|
|
|
+ archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ archivesMapper.updateById(archives);
|
|
|
|
|
|
- } else {
|
|
|
- archives.setCreateUser(AuthUtil.getUserId());
|
|
|
- archives.setCreateTime(new Date());
|
|
|
- archives.setCreateUserName(AuthUtil.getUserName());
|
|
|
- archives.setTenantId(AuthUtil.getTenantId());
|
|
|
- archivesMapper.insert(archives);
|
|
|
- List<ArchivesFiles> archivesFilesList = BeanUtil.copy(tradingBoxItem.getTradingBoxFilesList(), ArchivesFiles.class);
|
|
|
- for (ArchivesFiles archivesFiles : archivesFilesList) {
|
|
|
- archivesFiles.setId(null);
|
|
|
- archivesFiles.setPid(archives.getId());
|
|
|
- archivesFiles.setFileName(archivesFiles.getLabel());
|
|
|
- archivesFiles.setUrl(archivesFiles.getValue());
|
|
|
- archivesFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
- archivesFiles.setCreateTime(new Date());
|
|
|
- archivesFilesMapper.insert(archivesFiles);
|
|
|
+ } else {
|
|
|
+ archives.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archives.setCreateTime(new Date());
|
|
|
+ archives.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesMapper.insert(archives);
|
|
|
+ List<ArchivesFiles> archivesFilesList = BeanUtil.copy(tradingBoxItem.getTradingBoxFilesList(), ArchivesFiles.class);
|
|
|
+ for (ArchivesFiles archivesFiles : archivesFilesList) {
|
|
|
+ archivesFiles.setId(null);
|
|
|
+ archivesFiles.setPid(archives.getId());
|
|
|
+ archivesFiles.setFileName(archivesFiles.getLabel());
|
|
|
+ archivesFiles.setUrl(archivesFiles.getValue());
|
|
|
+ archivesFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesFiles.setCreateTime(new Date());
|
|
|
+ archivesFilesMapper.insert(archivesFiles);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //记录箱轨迹信息
|
|
|
- ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
- if ("BUY".equals(tradingBox.getType())) {
|
|
|
- archivesTrajectory.setStatus("买箱");
|
|
|
- } else if ("SELL".equals(tradingBox.getType())) {
|
|
|
- archivesTrajectory.setStatus("卖箱");
|
|
|
+ //记录箱轨迹信息
|
|
|
+ ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
+ if ("BUY".equals(tradingBox.getType())) {
|
|
|
+ archivesTrajectory.setStatus("买箱");
|
|
|
+ } else if ("SELL".equals(tradingBox.getType())) {
|
|
|
+ archivesTrajectory.setStatus("卖箱");
|
|
|
+ }
|
|
|
+ archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
+ archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
+ archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
+ archivesTrajectory.setCode(tradingBoxItem.getCode());
|
|
|
+ archivesTrajectory.setAddress(tradingBoxItem.getAddress());
|
|
|
+ archivesTrajectory.setNewDate(tradingBoxItem.getNewDate());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("箱号不能为空");
|
|
|
}
|
|
|
- archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
- archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
- archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
- archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
- archivesTrajectory.setCode(tradingBoxItem.getCode());
|
|
|
- archivesTrajectory.setAddress(tradingBoxItem.getAddress());
|
|
|
- archivesTrajectory.setNewDate(tradingBoxItem.getNewDate());
|
|
|
- archivesTrajectory.setCreateTime(new Date());
|
|
|
- archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
- archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
- archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
- archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
- } else {
|
|
|
- throw new RuntimeException("箱号不能为空");
|
|
|
}
|
|
|
}
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
@@ -351,6 +354,11 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (ObjectUtils.isNotNull(tradingBoxFeesList) && tradingBoxFeesList.size() > 0) {
|
|
|
for (TradingBoxFees tradingBoxFees : tradingBoxFeesList) {
|
|
|
if (tradingBoxFees.getId() == null) {
|
|
|
+ if ("BUY".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxFees.setBillType("买箱");
|
|
|
+ } else {
|
|
|
+ tradingBoxFees.setBillType("卖箱");
|
|
|
+ }
|
|
|
tradingBoxFees.setCreateUser(AuthUtil.getUserId());
|
|
|
tradingBoxFees.setCreateTime(new Date());
|
|
|
tradingBoxFees.setTenantId(AuthUtil.getTenantId());
|
|
|
@@ -418,6 +426,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
List<TradingBoxItem> tradingBoxItemList = tradingBox.getTradingBoxItemsList();
|
|
|
int boxNumber = 0;
|
|
|
if (ObjectUtils.isNotNull(tradingBoxItemList) && tradingBoxItemList.size() > 0) {
|
|
|
+ //箱号拼接字符串
|
|
|
+ List<String> codes = tradingBoxItemList.stream().map(TradingBoxItem::getCode).distinct().collect(Collectors.toList());
|
|
|
+ tradingBox.setCode(String.join(",", codes));
|
|
|
for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
boxNumber += GeneralToolsUtils.boxNumber(tradingBoxItem.getBoxType());
|
|
|
if (tradingBox.getType().equals("ZR")) {
|
|
|
@@ -481,81 +492,84 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
tradingBoxItem.setTradingBoxFilesList(tradingBoxItemFilesList);
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
- //更新箱档案信息
|
|
|
- Archives archivesR = archivesMapper.selectOne(new LambdaQueryWrapper<Archives>().eq(Archives::getIsDeleted, 0).eq(Archives::getTenantId, AuthUtil.getTenantId()).eq(Archives::getCode, tradingBoxItem.getCode()));
|
|
|
- Archives archives = new Archives();
|
|
|
- if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
- BeanUtil.copy(archivesR, archives);
|
|
|
- }
|
|
|
- archives.setCode(tradingBoxItem.getCode());
|
|
|
- archives.setName(tradingBoxItem.getBoxType());
|
|
|
- archives.setVolume(tradingBoxItem.getVolume());
|
|
|
- archives.setGorssWeight(tradingBoxItem.getGrossWeight());
|
|
|
- archives.setStatus(tradingBoxItem.getStatus());
|
|
|
- archives.setTypeId(tradingBoxItem.getBoxTypeId());
|
|
|
- archives.setAddressId(tradingBoxItem.getAddressId());
|
|
|
- archives.setAddress(tradingBoxItem.getAddress());
|
|
|
- archives.setNewDate(tradingBoxItem.getNewDate());
|
|
|
- archives.setLeasingCompanyId(tradingBox.getPurchaseCompanyId());
|
|
|
- archives.setLeasingCompany(tradingBox.getPurchaseCompanyName());
|
|
|
- archives.setBoxSource(tradingBoxItem.getBoxSource());
|
|
|
- archives.setBoxStatus(tradingBoxItem.getBoxStatus());
|
|
|
- archives.setEmptyWeight(tradingBoxItem.getEmptyWeight());
|
|
|
- archives.setTare(tradingBoxItem.getTare());
|
|
|
- archives.setLoadingWeight(tradingBoxItem.getLoadingWeight());
|
|
|
- archives.setBoxMakingCompany(tradingBoxItem.getBoxMakingCompany());
|
|
|
- archives.setBoxMakingCompanyId(tradingBoxItem.getBoxMakingCompanyId());
|
|
|
- archives.setBoxMakingDate(tradingBoxItem.getBoxMakingDate());
|
|
|
- archives.setLeaseCommencementDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
- archives.setBoxAge(tradingBoxItem.getBoxAge());
|
|
|
- archives.setPurchaseDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
- archives.setContractNo(tradingBox.getContractNo());
|
|
|
- if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
- archives.setUpdateTime(new Date());
|
|
|
- archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
- archivesMapper.updateById(archives);
|
|
|
+ String updateChar = tradingBoxItem.getCode() + tradingBoxItem.getBoxType() + tradingBoxItem.getAddress() + tradingBoxItem.getNewDate() + tradingBoxItem.getStatus();
|
|
|
+ if (ObjectUtils.isNull(tradingBoxItem.getUpdateChar()) || !updateChar.equals(tradingBoxItem.getUpdateChar())) {
|
|
|
+ if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
+ //更新箱档案信息
|
|
|
+ Archives archivesR = archivesMapper.selectOne(new LambdaQueryWrapper<Archives>().eq(Archives::getIsDeleted, 0).eq(Archives::getTenantId, AuthUtil.getTenantId()).eq(Archives::getCode, tradingBoxItem.getCode()));
|
|
|
+ Archives archives = new Archives();
|
|
|
+ if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
+ BeanUtil.copy(archivesR, archives);
|
|
|
+ }
|
|
|
+ archives.setCode(tradingBoxItem.getCode());
|
|
|
+ archives.setName(tradingBoxItem.getBoxType());
|
|
|
+ archives.setVolume(tradingBoxItem.getVolume());
|
|
|
+ archives.setGorssWeight(tradingBoxItem.getGrossWeight());
|
|
|
+ archives.setStatus(tradingBoxItem.getStatus());
|
|
|
+ archives.setTypeId(tradingBoxItem.getBoxTypeId());
|
|
|
+ archives.setAddressId(tradingBoxItem.getAddressId());
|
|
|
+ archives.setAddress(tradingBoxItem.getAddress());
|
|
|
+ archives.setNewDate(tradingBoxItem.getNewDate());
|
|
|
+ archives.setLeasingCompanyId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archives.setLeasingCompany(tradingBox.getPurchaseCompanyName());
|
|
|
+ archives.setBoxSource(tradingBoxItem.getBoxSource());
|
|
|
+ archives.setBoxStatus(tradingBoxItem.getBoxStatus());
|
|
|
+ archives.setEmptyWeight(tradingBoxItem.getEmptyWeight());
|
|
|
+ archives.setTare(tradingBoxItem.getTare());
|
|
|
+ archives.setLoadingWeight(tradingBoxItem.getLoadingWeight());
|
|
|
+ archives.setBoxMakingCompany(tradingBoxItem.getBoxMakingCompany());
|
|
|
+ archives.setBoxMakingCompanyId(tradingBoxItem.getBoxMakingCompanyId());
|
|
|
+ archives.setBoxMakingDate(tradingBoxItem.getBoxMakingDate());
|
|
|
+ archives.setLeaseCommencementDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
+ archives.setBoxAge(tradingBoxItem.getBoxAge());
|
|
|
+ archives.setPurchaseDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
+ archives.setContractNo(tradingBox.getContractNo());
|
|
|
+ if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
+ archives.setUpdateTime(new Date());
|
|
|
+ archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ archivesMapper.updateById(archives);
|
|
|
|
|
|
- } else {
|
|
|
- archives.setCreateUser(AuthUtil.getUserId());
|
|
|
- archives.setCreateTime(new Date());
|
|
|
- archives.setCreateUserName(AuthUtil.getUserName());
|
|
|
- archives.setTenantId(AuthUtil.getTenantId());
|
|
|
- archivesMapper.insert(archives);
|
|
|
- List<ArchivesFiles> archivesFilesList = BeanUtil.copy(tradingBoxItem.getTradingBoxFilesList(), ArchivesFiles.class);
|
|
|
- for (ArchivesFiles archivesFiles : archivesFilesList) {
|
|
|
- archivesFiles.setId(null);
|
|
|
- archivesFiles.setPid(archives.getId());
|
|
|
- archivesFiles.setFileName(archivesFiles.getLabel());
|
|
|
- archivesFiles.setUrl(archivesFiles.getValue());
|
|
|
- archivesFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
- archivesFiles.setCreateTime(new Date());
|
|
|
- archivesFilesMapper.insert(archivesFiles);
|
|
|
+ } else {
|
|
|
+ archives.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archives.setCreateTime(new Date());
|
|
|
+ archives.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesMapper.insert(archives);
|
|
|
+ List<ArchivesFiles> archivesFilesList = BeanUtil.copy(tradingBoxItem.getTradingBoxFilesList(), ArchivesFiles.class);
|
|
|
+ for (ArchivesFiles archivesFiles : archivesFilesList) {
|
|
|
+ archivesFiles.setId(null);
|
|
|
+ archivesFiles.setPid(archives.getId());
|
|
|
+ archivesFiles.setFileName(archivesFiles.getLabel());
|
|
|
+ archivesFiles.setUrl(archivesFiles.getValue());
|
|
|
+ archivesFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesFiles.setCreateTime(new Date());
|
|
|
+ archivesFilesMapper.insert(archivesFiles);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //记录箱轨迹信息
|
|
|
- ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
- if ("ZR".equals(tradingBox.getType())) {
|
|
|
- archivesTrajectory.setStatus("租入");
|
|
|
- } else if ("ZC".equals(tradingBox.getType())) {
|
|
|
- archivesTrajectory.setStatus("租出");
|
|
|
+ //记录箱轨迹信息
|
|
|
+ ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
+ if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ archivesTrajectory.setStatus("租入");
|
|
|
+ } else if ("ZC".equals(tradingBox.getType())) {
|
|
|
+ archivesTrajectory.setStatus("租出");
|
|
|
+ }
|
|
|
+ archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
+ archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
+ archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
+ archivesTrajectory.setCode(tradingBoxItem.getCode());
|
|
|
+ archivesTrajectory.setAddress(tradingBoxItem.getAddress());
|
|
|
+ archivesTrajectory.setNewDate(tradingBoxItem.getNewDate());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("箱号不能为空");
|
|
|
}
|
|
|
- archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
- archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
- archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
- archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
- archivesTrajectory.setCode(tradingBoxItem.getCode());
|
|
|
- archivesTrajectory.setAddress(tradingBoxItem.getAddress());
|
|
|
- archivesTrajectory.setNewDate(tradingBoxItem.getNewDate());
|
|
|
- archivesTrajectory.setCreateTime(new Date());
|
|
|
- archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
- archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
- archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
- archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
- } else {
|
|
|
- throw new RuntimeException("箱号不能为空");
|
|
|
}
|
|
|
}
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
@@ -567,10 +581,14 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (ObjectUtils.isNotNull(tradingBoxFeesList) && tradingBoxFeesList.size() > 0) {
|
|
|
for (TradingBoxFees tradingBoxFees : tradingBoxFeesList) {
|
|
|
if (tradingBoxFees.getId() == null) {
|
|
|
+ if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxFees.setBillType("租入");
|
|
|
+ } else {
|
|
|
+ tradingBoxFees.setBillType("租出");
|
|
|
+ }
|
|
|
tradingBoxFees.setCreateUser(AuthUtil.getUserId());
|
|
|
tradingBoxFees.setCreateTime(new Date());
|
|
|
tradingBoxFees.setTenantId(AuthUtil.getTenantId());
|
|
|
-
|
|
|
tradingBoxFeesMapper.insert(tradingBoxFees);
|
|
|
} else {
|
|
|
tradingBoxFees.setUpdateUser(AuthUtil.getUserId());
|
|
|
@@ -994,8 +1012,10 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
if ("ZR".equals(tradingBox.getType())) {
|
|
|
tradingBoxFees.setFeesType(2);
|
|
|
+ tradingBoxFees.setBillType("租入");
|
|
|
} else {
|
|
|
tradingBoxFees.setFeesType(1);
|
|
|
+ tradingBoxFees.setBillType("租出");
|
|
|
}
|
|
|
tradingBoxFees.setPid(tradingBox.getId());
|
|
|
tradingBoxFees.setSrcOrderNo(tradingBox.getContractNo());
|
|
|
@@ -1016,6 +1036,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
} else {
|
|
|
items.setSrcFeesType("付费");
|
|
|
}
|
|
|
+ items.setSrcBoxBillType(tradingBoxFees.getBillType());
|
|
|
items.setItemType(tradingBox.getType());
|
|
|
items.setPrice(tradingBoxFees.getPrice());
|
|
|
//账单数据
|
|
|
@@ -1145,8 +1166,10 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
if ("ZR".equals(tradingBox.getType())) {
|
|
|
tradingBoxFees.setFeesType(2);
|
|
|
+ tradingBoxFees.setBillType("租入");
|
|
|
} else {
|
|
|
tradingBoxFees.setFeesType(1);
|
|
|
+ tradingBoxFees.setBillType("租出");
|
|
|
}
|
|
|
tradingBoxFees.setPid(tradingBox.getId());
|
|
|
tradingBoxFees.setSrcOrderNo(tradingBox.getContractNo());
|
|
|
@@ -1174,6 +1197,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
} else {
|
|
|
items.setSrcFeesType("付费");
|
|
|
}
|
|
|
+ items.setSrcBoxBillType(tradingBoxFees.getBillType());
|
|
|
items.setItemType(tradingBox.getType());
|
|
|
items.setPrice(tradingBoxFees.getPrice());
|
|
|
//账单数据
|
|
|
@@ -1289,8 +1313,13 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxItem.setUpdateTime(new Date());
|
|
|
tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- tradingBoxItem.setRentEndDate(tradingBoxFeesList.get(0).getRentEndDate());
|
|
|
- tradingBoxItem.setRentStartDate(tradingBoxFeesList.get(0).getRentStartDate());
|
|
|
+ if (tradingBoxFeesList.size() == 1) {
|
|
|
+ tradingBoxItem.setRentEndDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
+ tradingBoxItem.setRentStartDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentEndDate(tradingBoxFeesList.get(0).getRentEndDate());
|
|
|
+ tradingBoxItem.setRentStartDate(tradingBoxFeesList.get(0).getRentStartDate());
|
|
|
+ }
|
|
|
tradingBoxItemMapper.updateById(tradingBoxItem);
|
|
|
}
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
@@ -1300,8 +1329,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
- public R
|
|
|
- importTradingBoxInfo(List<TradingBoxItemRentExcelEnter> excelList, boolean b, Long corpId, String corpName, String billType) {
|
|
|
+ public R importTradingBoxInfo(List<TradingBoxItemRentExcelEnter> excelList, boolean b, Long corpId, String corpName, String billType) {
|
|
|
List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
|
|
|
List<TradingBoxFees> tradingBoxFeesList = new ArrayList<>();
|
|
|
for (TradingBoxItemRentExcelEnter tradingBoxItemExcelEnter : excelList) {
|
|
|
@@ -1318,6 +1346,16 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
Archives archives = archivesMapper.selectOne(lambdaQueryWrapper);
|
|
|
if (ObjectUtils.isNull(archives)) {
|
|
|
throw new RuntimeException("箱号:" + tradingBoxItem.getCode() + "不存在,请修改后再进行操作!");
|
|
|
+ } else {
|
|
|
+ if ("SELL".equals(billType)) {
|
|
|
+ if (!"购买".equals(archives.getBoxSource()) || !"待使用".equals(archives.getStatus())) {
|
|
|
+ throw new RuntimeException("箱号:" + tradingBoxItem.getCode() + "。不是购买的或正在使用不能卖出");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!"待使用".equals(archives.getStatus())) {
|
|
|
+ throw new RuntimeException("箱号:" + tradingBoxItem.getCode() + "。正在使用不能重复使用");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (ObjectUtils.isNull(tradingBoxItem.getAddress())) {
|
|
|
@@ -1405,6 +1443,171 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public TradingBox copyDocument(TradingBox tradingBox) {
|
|
|
+ if (tradingBox.getId() == null) {
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
+ }
|
|
|
+ TradingBox details = baseMapper.selectById(tradingBox.getId());
|
|
|
+
|
|
|
+ Long feesId = null;
|
|
|
+
|
|
|
+ //获取费用id
|
|
|
+ R<FeesDesc> fees = feesDescClient.getFeesByName("租金");
|
|
|
+ if (fees.isSuccess() && fees.getData() != null) {
|
|
|
+ feesId = fees.getData().getId();
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(details)) {
|
|
|
+ //获取明细信息
|
|
|
+ LambdaQueryWrapper<TradingBoxItem> tradingBoxItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tradingBoxItemLambdaQueryWrapper.eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
+ .eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(TradingBoxItem::getPid, details.getId());
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = tradingBoxItemMapper.selectList(tradingBoxItemLambdaQueryWrapper);
|
|
|
+ for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
+ //获取费用信息
|
|
|
+ LambdaQueryWrapper<TradingBoxFees> tradingBoxFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getIsDeleted, 0)
|
|
|
+ .eq(TradingBoxFees::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(TradingBoxFees::getCode, tradingBoxItem.getCode())
|
|
|
+ .eq(ObjectUtils.isNotNull(feesId), TradingBoxFees::getItemId, feesId)
|
|
|
+ .eq(TradingBoxFees::getPid, details.getId());
|
|
|
+ int count = tradingBoxFeesMapper.selectCount(tradingBoxFeesLambdaQueryWrapper);
|
|
|
+ tradingBoxItem.setCount(count);
|
|
|
+ tradingBoxItem.setId(null);
|
|
|
+ tradingBoxItem.setPid(null);
|
|
|
+ tradingBoxItem.setCreateUserName(null);
|
|
|
+ tradingBoxItem.setCreateUser(null);
|
|
|
+ tradingBoxItem.setCreateTime(null);
|
|
|
+ tradingBoxItem.setUpdateUserName(null);
|
|
|
+ tradingBoxItem.setUpdateTime(null);
|
|
|
+ tradingBoxItem.setUpdateUser(null);
|
|
|
+ if ("ZR".equals(tradingBox.getType()) || "ZC".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setLeaseCommencementDate(null);
|
|
|
+ tradingBoxItem.setRentingOutDate(null);
|
|
|
+ tradingBoxItem.setRentEndDate(null);
|
|
|
+ tradingBoxItem.setRentStartDate(null);
|
|
|
+ if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setStatus("录入");
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setStatus("使用");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tradingBoxItem.setTradingBoxFilesList(new ArrayList<>());
|
|
|
+ }
|
|
|
+ details.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
+
|
|
|
+ //获取费用信息
|
|
|
+ LambdaQueryWrapper<TradingBoxFees> tradingBoxFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getIsDeleted, 0)
|
|
|
+ .eq(TradingBoxFees::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(TradingBoxFees::getPid, details.getId());
|
|
|
+ List<TradingBoxFees> tradingBoxFeesList = tradingBoxFeesMapper.selectList(tradingBoxFeesLambdaQueryWrapper);
|
|
|
+ for (TradingBoxFees tradingBoxFees : tradingBoxFeesList) {
|
|
|
+ R<FeesDesc> r = feesDescClient.detail(tradingBoxFees.getItemId());
|
|
|
+ if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
|
|
|
+ tradingBoxFees.setItemName(r.getData().getCname());
|
|
|
+ }
|
|
|
+ CorpsDesc corpsDesc = corpsDescClient.getCorpId(tradingBoxFees.getCorpId());
|
|
|
+ if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
+ tradingBoxFees.setCorpName(corpsDesc.getCname());
|
|
|
+ }
|
|
|
+ tradingBoxFees.setId(null);
|
|
|
+ tradingBoxFees.setPid(null);
|
|
|
+ tradingBoxFees.setCreateUser(null);
|
|
|
+ tradingBoxFees.setCreateTime(null);
|
|
|
+ tradingBoxFees.setUpdateTime(null);
|
|
|
+ tradingBoxFees.setUpdateUser(null);
|
|
|
+ tradingBoxFees.setSubmitPay(0);
|
|
|
+ }
|
|
|
+ details.setTradingBoxFeesList(tradingBoxFeesList);
|
|
|
+ details.setTradingBoxFilesList(new ArrayList<>());
|
|
|
+ }
|
|
|
+ details.setId(null);
|
|
|
+ details.setCreateUserName(null);
|
|
|
+ details.setCreateUser(null);
|
|
|
+ details.setCreateTime(null);
|
|
|
+ details.setUpdateUserName(null);
|
|
|
+ details.setUpdateTime(null);
|
|
|
+ details.setUpdateUser(null);
|
|
|
+ details.setStatus(0);
|
|
|
+ details.setApprovalStatus(null);
|
|
|
+ details.setPageStatus(null);
|
|
|
+ details.setSysNo(null);
|
|
|
+ return details;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object revokeRentingOut(TradingBox tradingBox) {
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = tradingBox.getTradingBoxItemsList();
|
|
|
+ if (tradingBoxItemList.size() < 1) {
|
|
|
+ throw new RuntimeException("明细不能为空");
|
|
|
+ }
|
|
|
+ for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
+ //获取订单费用信息
|
|
|
+ LambdaQueryWrapper<TradingBoxFees> tradingBoxFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getIsDeleted, 0);
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getPid, tradingBox.getId());
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getTenantId, AuthUtil.getTenantId());
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getSubmitPay, 1);
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getCode, tradingBoxItem.getCode());
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.orderByDesc(TradingBoxFees::getCreateTime);
|
|
|
+ List<TradingBoxFees> tradingBoxFeesList = tradingBoxFeesMapper.selectList(tradingBoxFeesLambdaQueryWrapper);
|
|
|
+ if (tradingBoxFeesList.size() > 0) {
|
|
|
+ tradingBoxFeesMapper.deleteById(tradingBoxFeesList.get(0).getId());
|
|
|
+ //获取账单信息
|
|
|
+ Acc acc = new Acc();
|
|
|
+ acc.setSrcParentId(tradingBox.getId());
|
|
|
+ acc.setSrcFeesId(tradingBoxFeesList.get(0).getId());
|
|
|
+ if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ acc.setBillType("申请");
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
+ } else {
|
|
|
+ acc.setBillType("收费");
|
|
|
+ tradingBoxItem.setStatus("使用");
|
|
|
+ }
|
|
|
+ acc.setTradeType("BOX");
|
|
|
+ acc.setSrcType(5);
|
|
|
+ R<List<Acc>> r = financeClient.getAccListByCondition(acc);
|
|
|
+ if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
|
|
|
+ for (Acc acc_ : r.getData()) {
|
|
|
+ //判断是否有结算 true 不允许撤销审核 false 删除账单信息并撤销审核
|
|
|
+ if (!acc_.getSettlementAmount().equals(new BigDecimal("0.00"))) {
|
|
|
+ throw new SecurityException("订单已结算,不允许撤销");
|
|
|
+ } else {
|
|
|
+ financeClient.remove(acc_.getId() + "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new SecurityException("箱号:" + tradingBoxItem.getCode() + "未计算租金,撤销失败");
|
|
|
+ }
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setRentEndDate(tradingBoxFeesList.get(0).getRentEndDate());
|
|
|
+ tradingBoxItem.setRentStartDate(tradingBoxFeesList.get(0).getRentStartDate());
|
|
|
+ tradingBoxItem.setRentingOutDate(null);
|
|
|
+ tradingBoxItemMapper.updateById(tradingBoxItem);
|
|
|
+ if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
+ //更新箱档案信息
|
|
|
+ Archives archivesR = archivesMapper.selectOne(new LambdaQueryWrapper<Archives>().eq(Archives::getIsDeleted, 0).eq(Archives::getTenantId, AuthUtil.getTenantId()).eq(Archives::getCode, tradingBoxItem.getCode()));
|
|
|
+ if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
+ archivesR.setUpdateTime(new Date());
|
|
|
+ archivesR.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archivesR.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ archivesR.setStatus("待使用");
|
|
|
+ } else {
|
|
|
+ archivesR.setStatus("使用");
|
|
|
+ }
|
|
|
+ archivesMapper.updateById(archivesR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tradingBox;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 订单生成账单 并且推送财务消息
|
|
|
*
|
|
|
@@ -1452,6 +1655,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
} else {
|
|
|
items.setSrcFeesType("付费");
|
|
|
}
|
|
|
+ items.setSrcBoxBillType(tradingBoxFees.getBillType());
|
|
|
items.setItemType(itemType);
|
|
|
items.setPrice(price);
|
|
|
//账单数据
|