Ver código fonte

1.海运进出口增加撤销锁单接口
2.账期锁定判断日期修改

纪新园 6 meses atrás
pai
commit
866f3c02b3

+ 10 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java

@@ -490,6 +490,16 @@ public class BillsController extends BladeController {
 	}
 
 	/**
+	 * 撤销锁单
+	 */
+	@PostMapping("/revokeLockOrder")
+	@RepeatSubmit
+	public R revokeLockOrder(@RequestBody Bills bills) {
+		Bills declare = billsService.revokeLockOrder(bills);
+		return R.data(declare);
+	}
+
+	/**
 	 * 审核通过
 	 */
 	@PostMapping("/passCheck")

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/IBillsService.java

@@ -193,4 +193,6 @@ public interface IBillsService extends IService<Bills> {
 	R submitCustomerBooking(Bills bills);
 
 	R revokeCustomerBooking(Bills bills);
+
+	Bills revokeLockOrder(Bills bills);
 }

+ 45 - 2
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java

@@ -968,8 +968,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 						.eq(FinAccBills::getIsDeleted, 0)
 						.in(FinAccBills::getBusinessBillId, billIds));
 					for (FinAccBills item : finAccBillsList) {
-						Bills bill = billsList.stream().filter(e-> e.getId().equals(item.getBusinessBillId())).findFirst().orElse(null);
-						if (bill != null){
+						Bills bill = billsList.stream().filter(e -> e.getId().equals(item.getBusinessBillId())).findFirst().orElse(null);
+						if (bill != null) {
 							item.setVesselId(bill.getVesselId());
 							item.setVesselCnName(bill.getVesselCnName());
 							item.setVesselEnName(bill.getVesselEnName());
@@ -5180,6 +5180,49 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		return R.data(bills);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public Bills revokeLockOrder(Bills bills) {
+		Bills declare = baseMapper.selectById(bills.getId());
+		if (ObjectUtils.isNotNull(declare.getBillDate())) {
+			LocalDate date = declare.getBillDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+			int year = date.getYear();
+			int month = date.getMonthValue();
+			FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
+				.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
+				.eq(FinPeriod::getIsDeleted, 0)
+				.eq(FinPeriod::getPeriodYear, year)
+				.eq(FinPeriod::getPeriodMonth, month));
+			if (finPeriod != null) {
+				if (1 == finPeriod.getIsClosed()) {
+					throw new RuntimeException(year + "年" + month + "月账期已结转,撤销失败");
+				}
+				if (1 == finPeriod.getLockingStatus()) {
+					throw new RuntimeException(year + "年" + month + "月账期已锁定,撤销失败");
+				}
+			}
+		}
+		declare.setStatus(0);
+		baseMapper.updateById(declare);
+		if ("MM".equals(declare.getBillType())) {
+			List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
+				.eq(Bills::getTenantId, AuthUtil.getTenantId())
+				.eq(Bills::getIsDeleted, 0)
+				.eq(Bills::getMasterId, declare.getId())
+				.eq(Bills::getBillType, "MH"));
+			if (!billsList.isEmpty()) {
+				for (Bills item : billsList) {
+					item.setStatus(0);
+					item.setUpdateTime(new Date());
+					item.setUpdateUserName(AuthUtil.getUserName());
+					item.setUpdateUser(AuthUtil.getUserId());
+				}
+				this.updateBatchById(billsList);
+			}
+		}
+		return declare;
+	}
+
 	/**
 	 * 删除海运进出口明细表
 	 *

+ 2 - 6
blade-service/blade-los/src/main/java/org/springblade/los/finance/genleg/service/impl/FinPeriodServiceImpl.java

@@ -221,7 +221,7 @@ public class FinPeriodServiceImpl extends ServiceImpl<FinPeriodMapper, FinPeriod
 			.eq(Bills::getBranchId, detail.getBranchId())
 			.apply("not find_in_set(bill_status,'1,3')")
 			.apply("((business_type = 'SE' and etd >='" + beginDate + "' and etd <= '" + endDate + "' ) " +
-				"or (business_type = 'SI' and eta >='" + beginDate + "' and eta <= '" + endDate + "'))"));
+				"or (business_type = 'SI' and actual_eta >='" + beginDate + "' and actual_eta <= '" + endDate + "'))"));
 		if (!billsList.isEmpty()) {
 			for (Bills item : billsList) {
 				ReviewFailedExcel reviewFailedExcel = new ReviewFailedExcel();
@@ -245,11 +245,7 @@ public class FinPeriodServiceImpl extends ServiceImpl<FinPeriodMapper, FinPeriod
 			.eq(Amends::getIsDeleted, 0)
 			.eq(Amends::getBranchId, detail.getBranchId())
 			.apply("not find_in_set(bill_status,'3')")
-			.apply("((business_type = 'SEA' and etd >='" + beginDate + "' and etd <= '" + endDate + "' ) " +
-				"or (business_type = 'SIA' and eta >='" + beginDate + "' and eta <= '" + endDate + "')" +
-				"or (business_type = 'AEA' and etd >='" + beginDate + "' and etd <= '" + endDate + "')" +
-				"or (business_type = 'AIA' and eta >='" + beginDate + "' and eta <= '" + endDate + "'))"
-			));
+			.apply("((create_time >='" + beginDate + "' and create_time <= '" + endDate + "' )"));
 		List<Bills> billsList1 = new ArrayList<>();
 		if (!amendsList.isEmpty()) {
 			List<Long> billsId = amendsList.stream().map(Amends::getOrigId).collect(Collectors.toList());