|
|
@@ -28,6 +28,7 @@ import org.springblade.box.tube.dto.TradingBoxItemRentExcelEnter;
|
|
|
import org.springblade.box.tube.entity.*;
|
|
|
import org.springblade.box.tube.mapper.*;
|
|
|
import org.springblade.box.tube.service.ITradingBoxService;
|
|
|
+import org.springblade.box.tube.utils.GeneralToolsUtils;
|
|
|
import org.springblade.box.tube.vo.TradingBoxVO;
|
|
|
import org.springblade.check.dto.AuditProecessDTO;
|
|
|
import org.springblade.check.entity.AuditPathsActs;
|
|
|
@@ -208,16 +209,21 @@ 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 ("BUY".equals(tradingBox.getType())) {
|
|
|
tradingBoxItem.setBoxSource("购买");
|
|
|
- tradingBoxItem.setBoxStatus("待使用");
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
} else {
|
|
|
if (tradingBoxItem.getBoxSource().equals("购买")) {
|
|
|
- tradingBoxItem.setBoxStatus("卖出");
|
|
|
+ tradingBoxItem.setStatus("卖出");
|
|
|
} else {
|
|
|
- tradingBoxItem.setBoxStatus("退租");
|
|
|
+ tradingBoxItem.setStatus("退租");
|
|
|
}
|
|
|
}
|
|
|
if (tradingBoxItem.getId() == null) {
|
|
|
@@ -316,10 +322,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
//记录箱轨迹信息
|
|
|
ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
if ("BUY".equals(tradingBox.getType())) {
|
|
|
- archivesTrajectory.setStatus("空箱入场");
|
|
|
+ archivesTrajectory.setStatus("买箱");
|
|
|
} else if ("SELL".equals(tradingBox.getType())) {
|
|
|
- archivesTrajectory.setStatus("空箱离场");
|
|
|
+ archivesTrajectory.setStatus("卖箱");
|
|
|
}
|
|
|
+ archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
archivesTrajectory.setCode(tradingBoxItem.getCode());
|
|
|
@@ -336,6 +344,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
}
|
|
|
+ tradingBox.setBoxNumber(boxNumber);
|
|
|
+ baseMapper.updateById(tradingBox);
|
|
|
//费用明细
|
|
|
List<TradingBoxFees> tradingBoxFeesList = tradingBox.getTradingBoxFeesList();
|
|
|
if (ObjectUtils.isNotNull(tradingBoxFeesList) && tradingBoxFeesList.size() > 0) {
|
|
|
@@ -406,18 +416,33 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
//明细数据
|
|
|
List<TradingBoxItem> tradingBoxItemList = tradingBox.getTradingBoxItemsList();
|
|
|
+ int boxNumber = 0;
|
|
|
if (ObjectUtils.isNotNull(tradingBoxItemList) && tradingBoxItemList.size() > 0) {
|
|
|
for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
+ boxNumber += GeneralToolsUtils.boxNumber(tradingBoxItem.getBoxType());
|
|
|
if (tradingBox.getType().equals("ZR")) {
|
|
|
tradingBoxItem.setBoxSource("租入");
|
|
|
} else if (tradingBox.getType().equals("ZC")) {
|
|
|
}
|
|
|
- if (ObjectUtils.isNull(tradingBoxItem.getRentEndDate()) && ObjectUtils.isNull(tradingBoxItem.getRentStartDate())){
|
|
|
+ if (ObjectUtils.isNull(tradingBoxItem.getRentEndDate()) && ObjectUtils.isNull(tradingBoxItem.getRentStartDate())) {
|
|
|
tradingBoxItem.setRentEndDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
tradingBoxItem.setRentStartDate(tradingBoxItem.getLeaseCommencementDate());
|
|
|
}
|
|
|
if (tradingBoxItem.getId() == null) {
|
|
|
- tradingBoxItem.setStatus("录入");
|
|
|
+ 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("录入");
|
|
|
+ }
|
|
|
+ }
|
|
|
tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
tradingBoxItem.setCreateTime(new Date());
|
|
|
tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
@@ -517,6 +542,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
} 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());
|
|
|
@@ -533,6 +560,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
tradingBox.setTradingBoxItemsList(tradingBoxItemList);
|
|
|
}
|
|
|
+ tradingBox.setBoxNumber(boxNumber);
|
|
|
+ baseMapper.updateById(tradingBox);
|
|
|
//费用明细
|
|
|
List<TradingBoxFees> tradingBoxFeesList = tradingBox.getTradingBoxFeesList();
|
|
|
if (ObjectUtils.isNotNull(tradingBoxFeesList) && tradingBoxFeesList.size() > 0) {
|
|
|
@@ -842,8 +871,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
if ("1".equals(tradingBox.getRentType())) {
|
|
|
tradingBoxItem.setLeaseCommencementDate(tradingBox.getRentDate());
|
|
|
- tradingBoxItem.setBoxStatus("租入");
|
|
|
- tradingBoxItem.setStatus("待使用");
|
|
|
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()));
|
|
|
@@ -858,8 +885,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archives.setGorssWeight(tradingBoxItem.getGrossWeight());
|
|
|
archives.setStatus(tradingBoxItem.getStatus());
|
|
|
archives.setTypeId(tradingBoxItem.getBoxTypeId());
|
|
|
- archives.setAddressId(tradingBoxItem.getAddressId());
|
|
|
- archives.setAddress(tradingBoxItem.getAddress());
|
|
|
+ archives.setAddressId(tradingBox.getAddressId());
|
|
|
+ archives.setAddress(tradingBox.getAddress());
|
|
|
archives.setNewDate(tradingBoxItem.getNewDate());
|
|
|
archives.setEmptyWeight(tradingBoxItem.getEmptyWeight());
|
|
|
archives.setTare(tradingBoxItem.getTare());
|
|
|
@@ -873,7 +900,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archives.setContractNo(tradingBox.getContractNo());
|
|
|
archives.setBoxAccessStatus("空箱入场");
|
|
|
archives.setBoxSource("租入");
|
|
|
- archives.setStatus("待使用");
|
|
|
archives.setLeasingCompanyId(tradingBox.getPurchaseCompanyId());
|
|
|
archives.setLeasingCompany(tradingBox.getPurchaseCompanyName());
|
|
|
if (ObjectUtils.isNotNull(archivesR)) {
|
|
|
@@ -883,7 +909,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archivesMapper.updateById(archives);
|
|
|
} else {
|
|
|
archives.setBoxSource(tradingBoxItem.getBoxSource());
|
|
|
- archives.setBoxStatus(tradingBoxItem.getBoxStatus());
|
|
|
+ archives.setStatus(tradingBoxItem.getStatus());
|
|
|
archives.setCreateUser(AuthUtil.getUserId());
|
|
|
archives.setCreateTime(new Date());
|
|
|
archives.setCreateUserName(AuthUtil.getUserName());
|
|
|
@@ -901,6 +927,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
}
|
|
|
archivesTrajectory.setStatus("租入");
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
} else {
|
|
|
archives.setBoxAccessStatus("空箱离场");
|
|
|
archives.setStatus("使用");
|
|
|
@@ -911,6 +938,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
archivesMapper.updateById(archives);
|
|
|
archivesTrajectory.setStatus("租出");
|
|
|
+ tradingBoxItem.setStatus("使用");
|
|
|
}
|
|
|
} else {
|
|
|
throw new RuntimeException("箱号不能为空");
|
|
|
@@ -928,8 +956,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archivesR.setUpdateTime(new Date());
|
|
|
archivesR.setUpdateUserName(AuthUtil.getUserName());
|
|
|
archivesR.setUpdateUser(AuthUtil.getUserId());
|
|
|
- archivesR.setAddress(tradingBoxItem.getAddress());
|
|
|
- archivesR.setAddressId(tradingBoxItem.getAddressId());
|
|
|
+ archivesR.setAddress(tradingBox.getAddress());
|
|
|
+ archivesR.setAddressId(tradingBox.getAddressId());
|
|
|
archivesMapper.updateById(archivesR);
|
|
|
} else {
|
|
|
archivesR.setBoxAccessStatus("空箱入场");
|
|
|
@@ -937,8 +965,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archivesR.setUpdateTime(new Date());
|
|
|
archivesR.setUpdateUserName(AuthUtil.getUserName());
|
|
|
archivesR.setUpdateUser(AuthUtil.getUserId());
|
|
|
- archivesR.setAddress(tradingBoxItem.getAddress());
|
|
|
- archivesR.setAddressId(tradingBoxItem.getAddressId());
|
|
|
+ archivesR.setAddress(tradingBox.getAddress());
|
|
|
+ archivesR.setAddressId(tradingBox.getAddressId());
|
|
|
archivesMapper.updateById(archivesR);
|
|
|
}
|
|
|
archivesTrajectory.setStatus("退租");
|
|
|
@@ -1020,9 +1048,13 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxItem.setStatus("退租");
|
|
|
tradingBoxItem.setRentEndDate(tradingBox.getRentDate());
|
|
|
tradingBoxItem.setRentingOutDate(tradingBox.getRentDate());
|
|
|
+ tradingBoxItem.setAddress(tradingBox.getAddress());
|
|
|
+ tradingBoxItem.setAddressId(tradingBox.getAddressId());
|
|
|
}
|
|
|
tradingBoxItemMapper.updateById(tradingBoxItem);
|
|
|
//记录箱轨迹信息
|
|
|
+ archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
archivesTrajectory.setCode(tradingBoxItem.getCode());
|
|
|
@@ -1268,7 +1300,8 @@ 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) {
|
|
|
@@ -1319,13 +1352,13 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxItem.setAddressId(null);
|
|
|
}
|
|
|
}
|
|
|
- if ("SELL".equals(billType) || "BUY".equals(billType)){
|
|
|
+ if ("SELL".equals(billType) || "BUY".equals(billType)) {
|
|
|
tradingBoxItem.setAmount(tradingBoxItem.getPrice());
|
|
|
TradingBoxFees tradingBoxFees = new TradingBoxFees();
|
|
|
tradingBoxFees.setCorpId(corpId);
|
|
|
tradingBoxFees.setCorpName(corpName);
|
|
|
tradingBoxFees.setAmount(tradingBoxItem.getPrice());
|
|
|
- if ("SELL".equals(billType)){
|
|
|
+ if ("SELL".equals(billType)) {
|
|
|
//获取费用id
|
|
|
R<FeesDesc> fees = feesDescClient.getFeesByName("卖箱费");
|
|
|
if (fees.isSuccess() && fees.getData() != null) {
|
|
|
@@ -1333,7 +1366,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxFees.setItemName("卖箱费");
|
|
|
}
|
|
|
tradingBoxFees.setFeesType(1);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//获取费用id
|
|
|
R<FeesDesc> fees = feesDescClient.getFeesByName("买箱费");
|
|
|
if (fees.isSuccess() && fees.getData() != null) {
|
|
|
@@ -1344,9 +1377,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
tradingBoxFees.setUnit(tradingBoxItem.getBoxType());
|
|
|
tradingBoxFees.setCurrency(tradingBoxItem.getCurrency());
|
|
|
- if ("CNY".equals(tradingBoxItem.getCurrency())){
|
|
|
+ if ("CNY".equals(tradingBoxItem.getCurrency())) {
|
|
|
tradingBoxFees.setExchangeRate(new BigDecimal(1));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
tradingBoxFees.setExchangeRate(new BigDecimal("6.30"));
|
|
|
}
|
|
|
tradingBoxFees.setAutoGenerate("1");
|
|
|
@@ -1356,18 +1389,18 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxFees.setCode(tradingBoxItem.getCode());
|
|
|
tradingBoxFeesList.add(tradingBoxFees);
|
|
|
}
|
|
|
- if("ZC".equals(billType) && ObjectUtils.isNotNull(tradingBoxItemExcelEnter.getLeaseCommencementDate())){
|
|
|
+ if ("ZC".equals(billType) && ObjectUtils.isNotNull(tradingBoxItemExcelEnter.getLeaseCommencementDate())) {
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
}
|
|
|
|
|
|
tradingBoxItemList.add(tradingBoxItem);
|
|
|
}
|
|
|
- if ("SELL".equals(billType) || "BUY".equals(billType)){
|
|
|
+ if ("SELL".equals(billType) || "BUY".equals(billType)) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("tradingBoxItemList",tradingBoxItemList);
|
|
|
- map.put("tradingBoxFeesList",tradingBoxFeesList);
|
|
|
+ map.put("tradingBoxItemList", tradingBoxItemList);
|
|
|
+ map.put("tradingBoxFeesList", tradingBoxFeesList);
|
|
|
return R.data(map);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return R.data(tradingBoxItemList);
|
|
|
}
|
|
|
}
|