|
|
@@ -204,134 +204,10 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (ObjectUtils.isNotNull(boxTypeNumber)) {
|
|
|
tradingBox.setBoxTypeNumber(boxTypeNumber.substring(0, boxTypeNumber.length() - 1));
|
|
|
}
|
|
|
- for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
- if ("BUY".equals(tradingBox.getType())) {
|
|
|
- tradingBoxItem.setBoxSource("购买");
|
|
|
- tradingBoxItem.setStatus("待使用");
|
|
|
- } else {
|
|
|
- if (tradingBoxItem.getBoxSource().equals("购买")) {
|
|
|
- tradingBoxItem.setStatus("卖出");
|
|
|
- } else {
|
|
|
- tradingBoxItem.setStatus("退租");
|
|
|
- }
|
|
|
- }
|
|
|
- tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxItem.setCreateTime(new Date());
|
|
|
- tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
- tradingBoxItem.setTenantId(AuthUtil.getTenantId());
|
|
|
- tradingBoxItem.setPid(tradingBox.getId());
|
|
|
- tradingBoxItem.setStackingStatus("未堆存");
|
|
|
- tradingBoxItemService.updateById(tradingBoxItem);
|
|
|
- String updateChar = tradingBoxItem.getCode() + tradingBoxItem.getBoxType() + tradingBoxItem.getAddress() + tradingBoxItem.getNewDate() + tradingBoxItem.getStatus();
|
|
|
- if (ObjectUtils.isNull(tradingBoxItem.getUpdateChar()) || !updateChar.equals(tradingBoxItem.getUpdateChar())) {
|
|
|
- tradingBoxItem.setUpdateChar(updateChar);
|
|
|
- tradingBoxItemService.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()));
|
|
|
- Archives archives = new Archives();
|
|
|
- if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
- BeanUtil.copy(archivesR, archives);
|
|
|
- } else {
|
|
|
- archives.setCode(tradingBoxItem.getCode());
|
|
|
- archives.setName(tradingBoxItem.getBoxType());
|
|
|
- archives.setVolume(tradingBoxItem.getVolume());
|
|
|
- archives.setGorssWeight(tradingBoxItem.getGrossWeight());
|
|
|
- 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());
|
|
|
- archives.setBoxAccessStatus("");
|
|
|
- }
|
|
|
- archives.setStatus(tradingBoxItem.getStatus());
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- //记录箱轨迹信息
|
|
|
- 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());
|
|
|
- archivesTrajectory.setSrcId(tradingBox.getId());
|
|
|
- archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
- } else {
|
|
|
- throw new RuntimeException("箱号不能为空");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
tradingBox.setBoxNumber(tradingBoxItemList.size());
|
|
|
}
|
|
|
baseMapper.updateById(tradingBox);
|
|
|
- //费用明细
|
|
|
- LambdaQueryWrapper<TradingBoxFees> tradingBoxFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- tradingBoxFeesLambdaQueryWrapper.eq(TradingBoxFees::getIsDeleted, 0)
|
|
|
- .eq(TradingBoxFees::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(TradingBoxFees::getPid, tradingBox.getId())
|
|
|
- .orderByDesc(TradingBoxFees::getCreateTime);
|
|
|
- List<TradingBoxFees> tradingBoxFeesList = tradingBoxFeesService.list(tradingBoxFeesLambdaQueryWrapper);
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxFeesList) && tradingBoxFeesList.size() > 0) {
|
|
|
- for (TradingBoxFees tradingBoxFees : tradingBoxFeesList) {
|
|
|
- if ("BUY".equals(tradingBox.getType())) {
|
|
|
- tradingBoxFees.setBillType("买箱");
|
|
|
- } else {
|
|
|
- tradingBoxFees.setBillType("卖箱");
|
|
|
- }
|
|
|
- tradingBoxFees.setCreateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxFees.setCreateTime(new Date());
|
|
|
- tradingBoxFees.setTenantId(AuthUtil.getTenantId());
|
|
|
- tradingBoxFees.setPid(tradingBox.getId());
|
|
|
- }
|
|
|
- tradingBox.setTradingBoxFeesList(tradingBoxFeesList);
|
|
|
- tradingBoxFeesService.updateBatchById(tradingBoxFeesList);
|
|
|
- }
|
|
|
//主表附件
|
|
|
List<TradingBoxFiles> tradingBoxFilesList = tradingBox.getTradingBoxFilesList();
|
|
|
if (ObjectUtils.isNotNull(tradingBoxFilesList) && tradingBoxFilesList.size() > 0) {
|
|
|
@@ -397,7 +273,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
baseMapper.updateById(tradingBox);
|
|
|
}
|
|
|
//明细数据
|
|
|
- List<TradingBoxItem> tradingBoxItemList = tradingBox.getTradingBoxItemsList();
|
|
|
+ LambdaQueryWrapper<TradingBoxItem> tradingBoxItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tradingBoxItemLambdaQueryWrapper.eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
+ .eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(TradingBoxItem::getPid, tradingBox.getId())
|
|
|
+ .orderByDesc(TradingBoxItem::getCreateTime);
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(tradingBoxItemLambdaQueryWrapper);
|
|
|
if (ObjectUtils.isNotNull(tradingBoxItemList) && tradingBoxItemList.size() > 0) {
|
|
|
//箱号拼接字符串
|
|
|
List<String> codes = tradingBoxItemList.stream().map(TradingBoxItem::getCode).distinct().collect(Collectors.toList());
|
|
|
@@ -418,206 +299,10 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (ObjectUtils.isNotNull(boxTypeNumber)) {
|
|
|
tradingBox.setBoxTypeNumber(boxTypeNumber.substring(0, boxTypeNumber.length() - 1));
|
|
|
}
|
|
|
- for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
- if (tradingBox.getType().equals("ZR")) {
|
|
|
- tradingBoxItem.setBoxSource("租入");
|
|
|
- } else if (tradingBox.getType().equals("ZC")) {
|
|
|
- }
|
|
|
- if (ObjectUtils.isNull(tradingBoxItem.getRentEndDate()) && ObjectUtils.isNull(tradingBoxItem.getRentStartDate())) {
|
|
|
- tradingBoxItem.setRentEndDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
- tradingBoxItem.setRentStartDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
- }
|
|
|
- if (tradingBoxItem.getId() == null) {
|
|
|
-
|
|
|
- LambdaQueryWrapper<TradingBoxItem> tradingBoxItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- tradingBoxItemLambdaQueryWrapper.eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
- .eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(TradingBoxItem::getPid, tradingBox.getId())
|
|
|
- .eq(TradingBoxItem::getCode, tradingBoxItem.getCode());
|
|
|
- List<TradingBoxItem> tradingBoxItemList1 = tradingBoxItemService.list(tradingBoxItemLambdaQueryWrapper);
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItemList1) && tradingBoxItemList1.size() > 0) {
|
|
|
- throw new RuntimeException("箱号:" + tradingBoxItem.getCode() + "已存在,保存失败");
|
|
|
- }
|
|
|
- if (tradingBox.getType().equals("ZR")) {
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItem.getLeaseCommencementDate())) {
|
|
|
- tradingBoxItem.setStatus("待使用");
|
|
|
- } else {
|
|
|
- tradingBoxItem.setStatus("录入");
|
|
|
- }
|
|
|
- } else if (tradingBox.getType().equals("ZC")) {
|
|
|
-// tradingBoxItem.setStatus("使用");
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItem.getLeaseCommencementDate())) {
|
|
|
- tradingBoxItem.setStatus("使用");
|
|
|
- } else {
|
|
|
- tradingBoxItem.setStatus("录入");
|
|
|
- }
|
|
|
- List<String> codeList = new ArrayList<>();
|
|
|
- codeList.add(tradingBoxItem.getCode());
|
|
|
- transferService.stockpilingFee(codeList);
|
|
|
- }
|
|
|
- tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxItem.setCreateTime(new Date());
|
|
|
- tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
- tradingBoxItem.setTenantId(AuthUtil.getTenantId());
|
|
|
- tradingBoxItem.setPid(tradingBox.getId());
|
|
|
- tradingBoxItemService.save(tradingBoxItem);
|
|
|
- } else {
|
|
|
- if (tradingBox.getType().equals("ZR") && "录入".equals(tradingBoxItem.getStatus())) {
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItem.getLeaseCommencementDate())) {
|
|
|
- tradingBoxItem.setStatus("待使用");
|
|
|
- } else {
|
|
|
- tradingBoxItem.setStatus("录入");
|
|
|
- }
|
|
|
- } else if (tradingBox.getType().equals("ZC") && "录入".equals(tradingBoxItem.getStatus())) {
|
|
|
-// tradingBoxItem.setStatus("使用");
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItem.getLeaseCommencementDate())) {
|
|
|
- tradingBoxItem.setStatus("使用");
|
|
|
- } else {
|
|
|
- tradingBoxItem.setStatus("录入");
|
|
|
- }
|
|
|
- }
|
|
|
- tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxItem.setUpdateTime(new Date());
|
|
|
- tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- tradingBoxItem.setPid(tradingBox.getId());
|
|
|
- tradingBoxItemService.updateById(tradingBoxItem);
|
|
|
- }
|
|
|
- //明细图片
|
|
|
- List<TradingBoxFiles> tradingBoxItemFilesList = tradingBoxItem.getTradingBoxFilesList();
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxItemFilesList) && tradingBoxItemFilesList.size() > 0) {
|
|
|
- for (TradingBoxFiles tradingBoxFiles : tradingBoxItemFilesList) {
|
|
|
- if (tradingBoxFiles.getId() == null) {
|
|
|
- tradingBoxFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxFiles.setCreateTime(new Date());
|
|
|
- tradingBoxFiles.setTenantId(AuthUtil.getTenantId());
|
|
|
- tradingBoxFiles.setPid(tradingBoxItem.getId());
|
|
|
- tradingBoxFiles.setType("2");
|
|
|
- tradingBoxFiles.setFileName(tradingBoxFiles.getLabel());
|
|
|
- tradingBoxFiles.setUrl(tradingBoxFiles.getValue());
|
|
|
- tradingBoxFilesMapper.insert(tradingBoxFiles);
|
|
|
- } else {
|
|
|
- tradingBoxFiles.setUpdateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxFiles.setUpdateTime(new Date());
|
|
|
- tradingBoxFiles.setPid(tradingBoxItem.getId());
|
|
|
- tradingBoxFiles.setType("2");
|
|
|
- tradingBoxFiles.setFileName(tradingBoxFiles.getLabel());
|
|
|
- tradingBoxFiles.setUrl(tradingBoxFiles.getValue());
|
|
|
- tradingBoxFilesMapper.updateById(tradingBoxFiles);
|
|
|
- }
|
|
|
- }
|
|
|
- tradingBoxItem.setTradingBoxFilesList(tradingBoxItemFilesList);
|
|
|
- }
|
|
|
- String updateChar = tradingBoxItem.getCode() + tradingBoxItem.getBoxType() + tradingBoxItem.getAddress() + tradingBoxItem.getNewDate() + tradingBoxItem.getStatus();
|
|
|
- if (ObjectUtils.isNull(tradingBoxItem.getUpdateChar()) || !updateChar.equals(tradingBoxItem.getUpdateChar())) {
|
|
|
- tradingBoxItem.setUpdateChar(updateChar);
|
|
|
- tradingBoxItemService.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()));
|
|
|
- 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());
|
|
|
- archives.setBoxAccessStatus("");
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //记录箱轨迹信息
|
|
|
- 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());
|
|
|
- archivesTrajectory.setSrcId(tradingBox.getId());
|
|
|
- archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
- } else {
|
|
|
- throw new RuntimeException("箱号不能为空");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
tradingBox.setBoxNumber(tradingBoxItemList.size());
|
|
|
}
|
|
|
baseMapper.updateById(tradingBox);
|
|
|
- //费用明细
|
|
|
- List<TradingBoxFees> tradingBoxFeesList = tradingBox.getTradingBoxFeesList();
|
|
|
- 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());
|
|
|
- tradingBoxFees.setPid(tradingBox.getId());
|
|
|
- } else {
|
|
|
- tradingBoxFees.setUpdateUser(AuthUtil.getUserId());
|
|
|
- tradingBoxFees.setUpdateTime(new Date());
|
|
|
- tradingBoxFees.setPid(tradingBox.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- tradingBox.setTradingBoxFeesList(tradingBoxFeesList);
|
|
|
- tradingBoxFeesService.saveOrUpdateBatch(tradingBoxFeesList);
|
|
|
- }
|
|
|
//主表附件
|
|
|
List<TradingBoxFiles> tradingBoxFilesList = tradingBox.getTradingBoxFilesList();
|
|
|
if (ObjectUtils.isNotNull(tradingBoxFilesList) && tradingBoxFilesList.size() > 0) {
|
|
|
@@ -1238,19 +923,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (ObjectUtils.isNotNull(tradingBox.getRentCalculationDate()) && ObjectUtils.isNotNull(tradingBox.getRentStartDate())) {
|
|
|
days = (int) ((tradingBox.getRentCalculationDate().getTime() - tradingBox.getRentStartDate().getTime()) / (1000 * 3600 * 24)) + 1;
|
|
|
}
|
|
|
- /*Long pid = tradingBox.getId();
|
|
|
|
|
|
- //账单数据
|
|
|
- ApplyDTO applyDTO = new ApplyDTO();
|
|
|
- if ("ZR".equals(tradingBox.getType())) {
|
|
|
- applyDTO.setBillType("申请");
|
|
|
- } else {
|
|
|
- applyDTO.setBillType("收费");
|
|
|
- }
|
|
|
- applyDTO.setTradeType("BOX");
|
|
|
- applyDTO.setBelongCompany(tradingBox.getPurchaseCompanyName());
|
|
|
- //账单明细
|
|
|
- List<Items> itemsList = new ArrayList<>();*/
|
|
|
List<TradingBoxFees> tradingBoxFeesList = new ArrayList<>();
|
|
|
for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
TradingBoxFees tradingBoxFees = new TradingBoxFees();
|
|
|
@@ -1294,77 +967,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxItem.setRentStartDate(tradingBox.getRentStartDate());
|
|
|
tradingBoxItem.setCount(tradingBoxItem.getCount() + 1);
|
|
|
tradingBoxItemService.updateById(tradingBoxItem);
|
|
|
-
|
|
|
- /*Items items = new Items();
|
|
|
- if (1 == tradingBoxFees.getFeesType()) {
|
|
|
- items.setSrcFeesType("收费");
|
|
|
- } else {
|
|
|
- items.setSrcFeesType("申请");
|
|
|
- }
|
|
|
- items.setSrcBoxBillType(tradingBoxFees.getBillType());
|
|
|
- items.setItemType(tradingBox.getType());
|
|
|
- items.setPrice(tradingBoxFees.getPrice());
|
|
|
- //账单数据
|
|
|
- items.setAmount(tradingBoxFees.getAmount());
|
|
|
- items.setQuantity(tradingBoxFees.getQuantity());
|
|
|
- items.setSrcOrderno(tradingBox.getContractNo());
|
|
|
- items.setCorpId(tradingBoxFees.getCorpId());
|
|
|
- items.setSrcParentId(pid);
|
|
|
- items.setCurrency(tradingBoxFees.getCurrency());
|
|
|
- items.setSrcType(5);
|
|
|
- items.setTradeType("BOX");
|
|
|
- items.setUnit(tradingBoxFees.getUnit());
|
|
|
- items.setSrcSysNo(tradingBoxFees.getCode());
|
|
|
- items.setRemarks(tradingBoxFees.getRemarks());
|
|
|
- items.setSrcBillNo(tradingBox.getSysNo());
|
|
|
- items.setStatusJT(0);
|
|
|
- items.setBillNo(tradingBox.getSysNo());
|
|
|
- items.setStockTime(tradingBox.getPurchaseDate());
|
|
|
- items.setRentStartDate(tradingBox.getRentStartDate());
|
|
|
- items.setRentEndDate(tradingBox.getRentCalculationDate());
|
|
|
- //获取费用id
|
|
|
- if (ObjectUtils.isNotNull(tradingBoxFees.getItemId())) {
|
|
|
- items.setCostType(tradingBoxFees.getItemId().toString());
|
|
|
- }
|
|
|
- items.setSrcFeesId(tradingBoxFees.getId());
|
|
|
- itemsList.add(items);
|
|
|
- applyDTO.setItemsList(itemsList);*/
|
|
|
}
|
|
|
- /*if (CollectionUtils.isNotEmpty(itemsList)) {
|
|
|
- //生成账单
|
|
|
- R paymentApply = financeClient.paymentApplyBoxTube(applyDTO);
|
|
|
- if (!paymentApply.isSuccess()) {
|
|
|
- throw new RuntimeException(paymentApply.getMsg());
|
|
|
- }
|
|
|
- //给角色为财务的人发送消息
|
|
|
- R<String> clientDeptIds = sysClient.getRoleIds(SecureUtil.getTenantId(), "财务");
|
|
|
- if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
|
|
|
- R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()));
|
|
|
- if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
|
|
|
- for (User datum : userList.getData()) {
|
|
|
- //循环发送消息
|
|
|
- Message sendMessage = new Message();
|
|
|
- sendMessage.setParameter(String.valueOf(pid));
|
|
|
- sendMessage.setUserName(AuthUtil.getUserName());
|
|
|
- sendMessage.setUserId(AuthUtil.getUserId());
|
|
|
- sendMessage.setToUserId(datum.getId());
|
|
|
- sendMessage.setToUserName(datum.getName());
|
|
|
- sendMessage.setMessageType(1);
|
|
|
- sendMessage.setTenantId(AuthUtil.getTenantId());
|
|
|
- sendMessage.setCreateUser(AuthUtil.getUserId());
|
|
|
- sendMessage.setCreateTime(new Date());
|
|
|
- sendMessage.setUrl(tradingBox.getUrl());
|
|
|
- sendMessage.setPageLabel(tradingBox.getPageLabel());
|
|
|
- sendMessage.setPageStatus(tradingBox.getPageStatus());
|
|
|
- sendMessage.setMessageBody("您订单" + tradingBox.getSysNo() + "审核通过,请查看");
|
|
|
- R save = messageClient.save(sendMessage);
|
|
|
- if (!save.isSuccess()) {
|
|
|
- throw new SecurityException("发送消息失败");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
tradingBox.setTradingBoxFeesList(tradingBoxFeesList);
|
|
|
return tradingBox;
|
|
|
}
|