|
|
@@ -24,8 +24,12 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.los.Util.IDeptUtils;
|
|
|
+import org.springblade.los.basic.fees.entity.BFees;
|
|
|
+import org.springblade.los.basic.fees.service.IBFeesService;
|
|
|
import org.springblade.los.business.sea.entity.Bills;
|
|
|
import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
+import org.springblade.los.finance.fee.entity.FeeCenter;
|
|
|
+import org.springblade.los.finance.fee.mapper.FeeCenterMapper;
|
|
|
import org.springblade.los.trade.entity.AgentItems;
|
|
|
import org.springblade.los.trade.entity.DispatchVehicles;
|
|
|
import org.springblade.los.trade.entity.InOutStorage;
|
|
|
@@ -39,6 +43,8 @@ import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -64,6 +70,10 @@ public class DispatchVehiclesServiceImpl extends ServiceImpl<DispatchVehiclesMap
|
|
|
|
|
|
private final AgentItemsMapper agentItemsMapper;
|
|
|
|
|
|
+ private final FeeCenterMapper feeCenterMapper;
|
|
|
+
|
|
|
+ private final IBFeesService bFeesService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<DispatchVehiclesVO> selectDispatchVehiclesPage(IPage<DispatchVehiclesVO> page, DispatchVehiclesVO dispatchVehicles) {
|
|
|
return page.setRecords(baseMapper.selectDispatchVehiclesPage(page, dispatchVehicles));
|
|
|
@@ -178,6 +188,60 @@ public class DispatchVehiclesServiceImpl extends ServiceImpl<DispatchVehiclesMap
|
|
|
dispatchVehicles.setUpdateUserName(AuthUtil.getUserName());
|
|
|
dispatchVehicles.setDispatchVehiclesDate(new Date());
|
|
|
baseMapper.updateById(dispatchVehicles);
|
|
|
+ if (ObjectUtils.isNotNull(dispatchVehicles.getFreightPrice())
|
|
|
+ && new BigDecimal("0.00").compareTo(dispatchVehicles.getFreightPrice()) != 0) {
|
|
|
+ BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
|
|
|
+ .eq(BFees::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BFees::getIsDeleted, 0)
|
|
|
+ .eq(BFees::getCode, "LYF"));
|
|
|
+ if (fees == null) {
|
|
|
+ throw new RuntimeException("请先维护仓储费用基础信息");
|
|
|
+ }
|
|
|
+ FeeCenter feeCenter = new FeeCenter();
|
|
|
+ feeCenter.setCreateTime(new Date());
|
|
|
+ feeCenter.setCreateUser(AuthUtil.getUserId());
|
|
|
+ feeCenter.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
|
|
|
+ feeCenter.setCreateDept(bills.getCreateDept());
|
|
|
+ feeCenter.setBranchId(bills.getBranchId());
|
|
|
+ feeCenter.setCreateDeptName(bills.getCreateDeptName());
|
|
|
+ }
|
|
|
+ feeCenter.setBusinessType(bills.getBusinessType());
|
|
|
+ feeCenter.setPid(bills.getId());
|
|
|
+ feeCenter.setLineNo(1L);
|
|
|
+ feeCenter.setBillNo(bills.getBillNo());
|
|
|
+ feeCenter.setBillDate(bills.getBillDate());
|
|
|
+ feeCenter.setCorpId(dispatchVehicles.getFleetId());
|
|
|
+ feeCenter.setCorpCnName(dispatchVehicles.getFleetName());
|
|
|
+ feeCenter.setBillCorpId(bills.getCorpId());
|
|
|
+ feeCenter.setBillCorpCnName(bills.getCorpCnName());
|
|
|
+ feeCenter.setMblno(bills.getMblno());
|
|
|
+ feeCenter.setPolId(bills.getPolId());
|
|
|
+ feeCenter.setPolCode(bills.getPolCode());
|
|
|
+ feeCenter.setPolCnName(bills.getPolCnName());
|
|
|
+ feeCenter.setPolEnName(bills.getPolEnName());
|
|
|
+ feeCenter.setPodId(bills.getPodId());
|
|
|
+ feeCenter.setPodCode(bills.getPodCode());
|
|
|
+ feeCenter.setPodCnName(bills.getPodCnName());
|
|
|
+ feeCenter.setPodEnName(bills.getPodEnName());
|
|
|
+ feeCenter.setFeeId(fees.getId());
|
|
|
+ feeCenter.setFeeCode(fees.getCode());
|
|
|
+ feeCenter.setFeeCnName(fees.getCnName());
|
|
|
+ feeCenter.setFeeEnName(fees.getEnName());
|
|
|
+ feeCenter.setDc("C");
|
|
|
+ feeCenter.setCurCode(fees.getCurNo());
|
|
|
+ feeCenter.setSort(1);
|
|
|
+ feeCenter.setElementsId(fees.getAccElementId());
|
|
|
+ feeCenter.setElementsCode(fees.getElementsCode());
|
|
|
+ feeCenter.setElementsCnName(fees.getAccElementName());
|
|
|
+ feeCenter.setElementsEnName(fees.getElementsEnName());
|
|
|
+ feeCenter.setUnitNo("JOB");
|
|
|
+ feeCenter.setQuantity(new BigDecimal("1.00"));
|
|
|
+ feeCenter.setPrice(dispatchVehicles.getFreightPrice());
|
|
|
+ feeCenter.setAmount(dispatchVehicles.getFreightPrice());
|
|
|
+ feeCenter.setSrcItemId(dispatchVehicles.getId());
|
|
|
+ feeCenterMapper.insert(feeCenter);
|
|
|
+ }
|
|
|
return R.data(dispatchVehicles);
|
|
|
}
|
|
|
|
|
|
@@ -208,6 +272,19 @@ public class DispatchVehiclesServiceImpl extends ServiceImpl<DispatchVehiclesMap
|
|
|
dispatchVehicles.setUpdateUserName(AuthUtil.getUserName());
|
|
|
dispatchVehicles.setDispatchVehiclesDate(new Date());
|
|
|
baseMapper.updateById(dispatchVehicles);
|
|
|
+ if (ObjectUtils.isNotNull(dispatchVehicles.getFreightPrice())
|
|
|
+ && new BigDecimal("0.00").compareTo(dispatchVehicles.getFreightPrice()) != 0) {
|
|
|
+ FeeCenter feeCenter = feeCenterMapper.selectOne(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId,AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted,0)
|
|
|
+ .eq(FeeCenter::getPid,bills.getId())
|
|
|
+ .eq(FeeCenter::getFeeCode,"LYF")
|
|
|
+ .eq(FeeCenter::getSrcItemId,dispatchVehicles.getId())
|
|
|
+ .eq(FeeCenter::getDc,"C"));
|
|
|
+ if (feeCenter != null){
|
|
|
+ feeCenterMapper.deleteById(feeCenter.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.data(dispatchVehicles);
|
|
|
}
|
|
|
|