杂录

/**
	 * 判断该笔付款确认书是否需补出账
	 * @param payUuid 付款确认书uuid
	 * @return
	 * @throws ActiveRecordException
	 */
	public void checkAddAccount(QhyfController controller,String payUuid) throws ActiveRecordException {
		String sql = "SELECT " +
				"	uuid, " +
				"	pay_id " +
				"FROM " +
				"	biz_supplement_account " +
				"WHERE " +
				"	sys_status = 1  " +
				"AND pay_id = ? ";
		Record record = Db.findFirst(sql,payUuid);
		if (record!=null) {
			// 查询该笔付款确认书账户证明份数
			String documentSql = "SELECT " +
					"	need_num, " +
					"	valid_num " +
					"FROM " +
					"	biz_factoring_material_list " +
					"WHERE " +
					"	sys_status = 1 " +
					"AND biz_id = ? " +
					"AND document_id IN ('BLCS1024', 'BLCS1025') ";
			List<Record> documentRd = Db.find(documentSql,payUuid);
			if(documentRd!=null) {
				boolean checkFlag = true;
				for (Record record2 : documentRd) {
					if(record2.getInt("validNum")<record2.getInt("needNum")) {
						checkFlag = false;
						break;
					}
				}
				if(checkFlag) {
					// 更新补出账信息表,将补出账状态更新成“9:补出账确认完成”
					BizSupplementAccount bizSupplementAccount = new BizSupplementAccount();
					bizSupplementAccount.set("uuid", record.get("uuid"));
					bizSupplementAccount.set("supplementStatus", "9");
					AssertUtils.isTrue(controller.merge(BizSupplementAccount.dao.getTable().getName(), bizSupplementAccount),"更新补出账状态失败");
				}
			}
		}
	}

猜你喜欢

转载自www.cnblogs.com/xiaowoniulx/p/11102557.html