| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.ruoyi.common.utils.RandomUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.reflect.ReflectUtils; |
| | | import com.ruoyi.cwgl.domain.EstimatedReceivable; |
| | | import com.ruoyi.cwgl.domain.PendingSettlementBusiness; |
| | | import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule; |
| | | import com.ruoyi.cwgl.mapper.SmartLockerApplicationMapper; |
| | | import com.ruoyi.cwgl.service.IEstimatedReceivableService; |
| | | import com.ruoyi.cwgl.service.IPendingSettlementBusinessService; |
| | | import com.ruoyi.cwgl.service.ISmartLockerApplicationService; |
| | | import com.ruoyi.cwgl.service.impl.ExactPricingRuleMatcher; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Component("settlementTask") |
| | | public class SettlementTask |
| | | { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SettlementTask.class); |
| | | @Autowired |
| | | private IPendingSettlementBusinessService pendingSettlementBusinessService; |
| | | @Autowired |
| | | private IEstimatedReceivableService estimatedReceivableService; |
| | | @Autowired |
| | | private ISmartLockerApplicationService smartLockerApplicationService; |
| | | |
| | | public void insertPendingSettlement() |
| | | { |
| | |
| | | |
| | | List<EstimatedReceivable> estimatedReceivables = new ArrayList<>(); |
| | | for (PendingSettlementBusiness pendingSettlementBusiness : pendingSettlementBusinesses) { |
| | | pendingSettlementBusiness.setIsCreate(1); |
| | | pendingSettlementBusiness.setIsCreate(0); |
| | | pendingSettlementBusiness.setEstimatedTotalCost(BigDecimal.ZERO); |
| | | |
| | | pendingSettlementBusiness.setEstimatedTotalIncome(BigDecimal.ZERO); |
| | | ReceivableLineTruckPriceRule exactMatchingRule = ExactPricingRuleMatcher.findExactMatchingRule(receivableLineTruckPriceRules, pendingSettlementBusiness.getCustomerName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType()); |
| | | if (exactMatchingRule!=null) { |
| | | //应收数据 |
| | |
| | | estimatedReceivable.setCurrency("人民币"); |
| | | estimatedReceivable.setIsConfirmed(1); |
| | | estimatedReceivable.setFeeType(0); |
| | | estimatedReceivable.setRelatedBillStatus(0); |
| | | estimatedReceivables.add(estimatedReceivable); |
| | | } |
| | | ReceivableLineTruckPriceRule exactMatchingRule2 = ExactPricingRuleMatcher.findExactMatchingRule(payableLineTruckPriceRules, pendingSettlementBusiness.getCarrierName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType()); |
| | |
| | | estimatedReceivableService.insertEstimatedReceivableBatch(estimatedReceivables); |
| | | } |
| | | pendingSettlementBusinessService.insertPendingSettlement(pendingSettlementBusinesses); |
| | | } |
| | | |
| | | //更新同步状态用 |
| | | Integer[] ids = pendingSettlementBusinesses.stream().map(PendingSettlementBusiness::getServiceId).toArray(Integer[]::new); |
| | | int i = pendingSettlementBusinessService.updeteCwData(ids); |
| | | if (i>0){ |
| | | logger.info("同步状态更新成功"); |
| | | } |
| | | |
| | | } |
| | | public void checkExpiredApplications() { |
| | | smartLockerApplicationService.updateExpiredStatus(); |
| | | } |
| | | |
| | | |
| | | } |